Added a test case for covering InputObjectType as Argument

This commit is contained in:
Syrus Akbary 2016-11-22 22:35:24 -08:00
parent 5cfa895881
commit 7c57d71e84

View File

@ -1,7 +1,9 @@
from ..abstracttype import AbstractType
from ..field import Field
from ..argument import Argument
from ..inputfield import InputField
from ..objecttype import ObjectType
from ..inputobjecttype import InputObjectType
from ..unmountedtype import UnmountedType
@ -61,6 +63,22 @@ def test_generate_inputobjecttype_unmountedtype():
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():
class MyAbstractType(AbstractType):
field1 = MyScalar(MyType)