def test_includes_interfaces_thunk_subtypes_in_the_type_map(): SomeInterface = GraphQLInterfaceType( name='SomeInterface', fields={ 'f': GraphQLField(GraphQLInt) } ) SomeSubtype = GraphQLObjectType( name='SomeSubtype', fields={ 'f': GraphQLField(GraphQLInt) }, interfaces=lambda: [SomeInterface], is_type_of=lambda: True ) schema = GraphQLSchema(query=GraphQLObjectType( name='Query', fields={ 'iface': GraphQLField(SomeInterface) } )) assert schema.get_type_map()['SomeSubtype'] is SomeSubtype
def test_includes_nested_input_objects_in_the_map(): NestedInputObject = GraphQLInputObjectType( name='NestedInputObject', fields={'value': GraphQLInputObjectField(GraphQLString)} ) SomeInputObject = GraphQLInputObjectType( name='SomeInputObject', fields={'nested': GraphQLInputObjectField(NestedInputObject)} ) SomeMutation = GraphQLObjectType( name='SomeMutation', fields={ 'mutateSomething': GraphQLField( type=BlogArticle, args={ 'input': GraphQLArgument(SomeInputObject) } ) } ) schema = GraphQLSchema( query=BlogQuery, mutation=SomeMutation ) assert schema.get_type_map()['NestedInputObject'] is NestedInputObject
def test_includes_nested_input_objects_in_the_map(): NestedInputObject = GraphQLInputObjectType( name='NestedInputObject', fields={'value': GraphQLInputObjectField(GraphQLString)}) SomeInputObject = GraphQLInputObjectType( name='SomeInputObject', fields={'nested': GraphQLInputObjectField(NestedInputObject)}) SomeMutation = GraphQLObjectType( name='SomeMutation', fields={ 'mutateSomething': GraphQLField(type=BlogArticle, args={'input': GraphQLArgument(SomeInputObject)}) }) SomeSubscription = GraphQLObjectType( name='SomeSubscription', fields={ 'subscribeToSomething': GraphQLField(type=BlogArticle, args={'input': GraphQLArgument(SomeInputObject)}) }) schema = GraphQLSchema(query=BlogQuery, mutation=SomeMutation, subscription=SomeSubscription) assert schema.get_type_map()['NestedInputObject'] is NestedInputObject
def test_includes_interfaces_subtypes_in_the_type_map(): SomeInterface = GraphQLInterfaceType('SomeInterface') SomeSubtype = GraphQLObjectType(name='SomeSubtype', fields={}, interfaces=[SomeInterface]) schema = GraphQLSchema(SomeInterface) assert schema.get_type_map()['SomeSubtype'] == SomeSubtype
def test_includes_interfaces_subtypes_in_the_type_map(): SomeInterface = GraphQLInterfaceType('SomeInterface') SomeSubtype = GraphQLObjectType( name='SomeSubtype', fields={}, interfaces=[SomeInterface] ) schema = GraphQLSchema(SomeInterface) assert schema.get_type_map()['SomeSubtype'] == SomeSubtype