mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 17:46:57 +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 ..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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user