Skip to content

Commit a17f63c

Browse files
committed
add failing type_map test, bar_graphql_type has no interfaces
1 parent 86b7e6a commit a17f63c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

graphene/types/tests/test_type_map.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,33 @@ class Meta:
270270
assert graphql_type.is_type_of
271271
assert graphql_type.is_type_of({}, None) is True
272272
assert graphql_type.is_type_of(MyObjectType(), None) is False
273+
274+
275+
def test_interface_with_interfaces():
276+
class FooInterface(Interface):
277+
foo = String()
278+
279+
class BarInterface(Interface):
280+
class Meta:
281+
interfaces = [FooInterface]
282+
283+
foo = String()
284+
bar = String()
285+
286+
type_map = create_type_map([FooInterface, BarInterface])
287+
assert "FooInterface" in type_map
288+
foo_graphql_type = type_map["FooInterface"]
289+
assert isinstance(foo_graphql_type, GraphQLInterfaceType)
290+
assert foo_graphql_type.name == "FooInterface"
291+
292+
assert "BarInterface" in type_map
293+
bar_graphql_type = type_map["BarInterface"]
294+
assert isinstance(bar_graphql_type, GraphQLInterfaceType)
295+
assert bar_graphql_type.name == "BarInterface"
296+
297+
fields = bar_graphql_type.fields
298+
assert list(fields) == ["foo", "bar"]
299+
assert isinstance(fields["foo"], GraphQLField)
300+
assert isinstance(fields["bar"], GraphQLField)
301+
302+
assert bar_graphql_type.interfaces == [foo_graphql_type]

0 commit comments

Comments
 (0)