mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-16 19:40:39 +03:00
Added a test case for covering InputObjectType as Argument
This commit is contained in:
parent
5cfa895881
commit
7c57d71e84
|
@ -1,7 +1,9 @@
|
||||||
|
|
||||||
from ..abstracttype import AbstractType
|
from ..abstracttype import AbstractType
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
|
from ..argument import Argument
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
|
from ..objecttype import ObjectType
|
||||||
from ..inputobjecttype import InputObjectType
|
from ..inputobjecttype import InputObjectType
|
||||||
from ..unmountedtype import UnmountedType
|
from ..unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
@ -61,6 +63,22 @@ def test_generate_inputobjecttype_unmountedtype():
|
||||||
assert isinstance(MyInputObjectType._meta.fields['field'], InputField)
|
assert isinstance(MyInputObjectType._meta.fields['field'], InputField)
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_inputobjecttype_as_argument():
|
||||||
|
class MyInputObjectType(InputObjectType):
|
||||||
|
field = MyScalar()
|
||||||
|
|
||||||
|
class MyObjectType(ObjectType):
|
||||||
|
field = Field(MyType, input=MyInputObjectType())
|
||||||
|
|
||||||
|
assert 'field' in MyObjectType._meta.fields
|
||||||
|
field = MyObjectType._meta.fields['field']
|
||||||
|
assert isinstance(field, Field)
|
||||||
|
assert field.type == MyType
|
||||||
|
assert 'input' in field.args
|
||||||
|
assert isinstance(field.args['input'], Argument)
|
||||||
|
assert field.args['input'].type == MyInputObjectType
|
||||||
|
|
||||||
|
|
||||||
def test_generate_inputobjecttype_inherit_abstracttype():
|
def test_generate_inputobjecttype_inherit_abstracttype():
|
||||||
class MyAbstractType(AbstractType):
|
class MyAbstractType(AbstractType):
|
||||||
field1 = MyScalar(MyType)
|
field1 = MyScalar(MyType)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user