mirror of
https://github.com/graphql-python/graphene.git
synced 2025-04-08 03:14:13 +03:00
add failing type_map test, bar_graphql_type has no interfaces
This commit is contained in:
parent
86b7e6ac86
commit
a17f63cf03
|
@ -270,3 +270,33 @@ def test_objecttype_with_possible_types():
|
|||
assert graphql_type.is_type_of
|
||||
assert graphql_type.is_type_of({}, None) is True
|
||||
assert graphql_type.is_type_of(MyObjectType(), None) is False
|
||||
|
||||
|
||||
def test_interface_with_interfaces():
|
||||
class FooInterface(Interface):
|
||||
foo = String()
|
||||
|
||||
class BarInterface(Interface):
|
||||
class Meta:
|
||||
interfaces = [FooInterface]
|
||||
|
||||
foo = String()
|
||||
bar = String()
|
||||
|
||||
type_map = create_type_map([FooInterface, BarInterface])
|
||||
assert "FooInterface" in type_map
|
||||
foo_graphql_type = type_map["FooInterface"]
|
||||
assert isinstance(foo_graphql_type, GraphQLInterfaceType)
|
||||
assert foo_graphql_type.name == "FooInterface"
|
||||
|
||||
assert "BarInterface" in type_map
|
||||
bar_graphql_type = type_map["BarInterface"]
|
||||
assert isinstance(bar_graphql_type, GraphQLInterfaceType)
|
||||
assert bar_graphql_type.name == "BarInterface"
|
||||
|
||||
fields = bar_graphql_type.fields
|
||||
assert list(fields) == ["foo", "bar"]
|
||||
assert isinstance(fields["foo"], GraphQLField)
|
||||
assert isinstance(fields["bar"], GraphQLField)
|
||||
|
||||
assert bar_graphql_type.interfaces == [foo_graphql_type]
|
||||
|
|
Loading…
Reference in New Issue
Block a user