File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
from graphql .type import GraphQLObjectType
2
2
from mock import patch
3
3
4
- from graphene import Schema
4
+ from graphene import Schema , Interface
5
5
from graphene .contrib .django .types import DjangoNode , DjangoObjectType
6
6
from graphene .core .fields import Field
7
7
from graphene .core .types .scalars import Int
@@ -83,3 +83,20 @@ def test_object_type():
83
83
def test_node_notinterface ():
84
84
assert Human ._meta .interface is False
85
85
assert DjangoNode in Human ._meta .interfaces
86
+
87
+
88
+ def test_django_objecttype_could_extend_interface ():
89
+ schema = Schema ()
90
+
91
+ @schema .register
92
+ class Customer (Interface ):
93
+ id = Int ()
94
+
95
+ @schema .register
96
+ class UserType (DjangoObjectType ):
97
+ class Meta :
98
+ model = Reporter
99
+ interfaces = [Customer ]
100
+
101
+ object_type = schema .T (UserType )
102
+ assert schema .T (Customer ) in object_type .get_interfaces ()
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class ObjectTypeOptions(FieldsOptions):
20
20
def __init__ (self , * args , ** kwargs ):
21
21
super (ObjectTypeOptions , self ).__init__ (* args , ** kwargs )
22
22
self .interface = False
23
+ self .valid_attrs += ['interfaces' ]
23
24
self .interfaces = []
24
25
25
26
You can’t perform that action at this time.
0 commit comments