mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-13 10:00:39 +03:00
Merge pull request #187 from graphql-python/register-interface-failure-fix
Register interface failure fix
This commit is contained in:
commit
e5357ccc84
|
@ -77,6 +77,7 @@ class Schema(object):
|
||||||
self,
|
self,
|
||||||
query=self.T(self.query),
|
query=self.T(self.query),
|
||||||
mutation=self.T(self.mutation),
|
mutation=self.T(self.mutation),
|
||||||
|
types=[self.T(_type) for _type in list(self._types_names.values())],
|
||||||
subscription=self.T(self.subscription))
|
subscription=self.T(self.subscription))
|
||||||
|
|
||||||
def register(self, object_type, force=False):
|
def register(self, object_type, force=False):
|
||||||
|
|
|
@ -132,6 +132,21 @@ def test_schema_register():
|
||||||
assert schema.get_type('MyType') == MyType
|
assert schema.get_type('MyType') == MyType
|
||||||
|
|
||||||
|
|
||||||
|
def test_schema_register_interfaces():
|
||||||
|
class Query(ObjectType):
|
||||||
|
f = Field(Character)
|
||||||
|
|
||||||
|
def resolve_f(self, args, info):
|
||||||
|
return Human()
|
||||||
|
|
||||||
|
schema = Schema(query=Query)
|
||||||
|
|
||||||
|
schema.register(Human)
|
||||||
|
|
||||||
|
result = schema.execute('{ f { name } }')
|
||||||
|
assert not result.errors
|
||||||
|
|
||||||
|
|
||||||
def test_schema_register_no_query_type():
|
def test_schema_register_no_query_type():
|
||||||
schema = Schema(name='My own schema')
|
schema = Schema(name='My own schema')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user