mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-02-22 22:53:05 +03:00
Update imports
This commit is contained in:
parent
e66c1faf44
commit
061d9eb52a
|
@ -1,10 +1,10 @@
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import Schema, relay, ObjectType
|
from graphene import Schema, relay, ObjectType
|
||||||
from ..filter import DjangoFilterConnectionField
|
from graphene_django.filter import DjangoFilterConnectionField
|
||||||
from django.test import TestCase, RequestFactory
|
from django.test import TestCase, RequestFactory
|
||||||
from graphene_django import DjangoObjectType
|
from graphene_django import DjangoObjectType
|
||||||
|
from graphene_django.auth.mixins import AuthNodeMixin, AuthMutationMixin
|
||||||
from .models import Pet
|
from .models import Pet
|
||||||
from ..auth.mixins import AuthNodeMixin, AuthMutationMixin
|
|
||||||
|
|
||||||
|
|
||||||
class PetNode(AuthNodeMixin, DjangoObjectType):
|
class PetNode(AuthNodeMixin, DjangoObjectType):
|
||||||
|
@ -45,7 +45,6 @@ class CreatePet(AuthMutationMixin, graphene.Mutation):
|
||||||
|
|
||||||
class QueryRoot(ObjectType):
|
class QueryRoot(ObjectType):
|
||||||
pet = relay.Node.Field(PetNode)
|
pet = relay.Node.Field(PetNode)
|
||||||
pets = DjangoFilterConnectionField(PetNode)
|
|
||||||
|
|
||||||
|
|
||||||
class MutationRoot(ObjectType):
|
class MutationRoot(ObjectType):
|
||||||
|
@ -160,8 +159,6 @@ class AuthorizationTests(TestCase):
|
||||||
Making query with an user who does not have the permission
|
Making query with an user who does not have the permission
|
||||||
"""
|
"""
|
||||||
result = self.schema.execute(self.query_node, context_value={'user': self.storm_tropper})
|
result = self.schema.execute(self.query_node, context_value={'user': self.storm_tropper})
|
||||||
print(result.errors)
|
|
||||||
print(result.data)
|
|
||||||
self.assertNotEqual(result.errors, [])
|
self.assertNotEqual(result.errors, [])
|
||||||
self.assertEqual(result.errors[0].message, 'Permission Denied')
|
self.assertEqual(result.errors[0].message, 'Permission Denied')
|
||||||
|
|
||||||
|
@ -170,6 +167,4 @@ class AuthorizationTests(TestCase):
|
||||||
Making query with an user who has the permission
|
Making query with an user who has the permission
|
||||||
"""
|
"""
|
||||||
result = self.schema.execute(self.query_node, context_value={'user': self.luke})
|
result = self.schema.execute(self.query_node, context_value={'user': self.luke})
|
||||||
print(result.errors)
|
|
||||||
print(result.data)
|
|
||||||
self.assertEqual(result.errors, [])
|
self.assertEqual(result.errors, [])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user