mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 04:07:16 +03:00
Added additional test.
This commit is contained in:
parent
7913052d07
commit
ef8d7e2bd2
|
@ -27,10 +27,13 @@ class OtherMutation(ClientIDMutation):
|
||||||
class Input(SharedFields):
|
class Input(SharedFields):
|
||||||
additional_field = String()
|
additional_field = String()
|
||||||
|
|
||||||
|
name = String()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def mutate_and_get_payload(cls, args, context, info):
|
def mutate_and_get_payload(cls, args, context, info):
|
||||||
what = args.get('what')
|
shared = args.get('shared', '')
|
||||||
return SaySomething(shared=str(what), additional_field='additional')
|
additionalField = args.get('additionalField', '')
|
||||||
|
return SaySomething(name=shared + additionalField)
|
||||||
|
|
||||||
|
|
||||||
class RootQuery(ObjectType):
|
class RootQuery(ObjectType):
|
||||||
|
@ -75,6 +78,17 @@ def test_mutation_input():
|
||||||
assert fields['client_mutation_id'].type == String
|
assert fields['client_mutation_id'].type == String
|
||||||
|
|
||||||
|
|
||||||
|
def test_subclassed_mutation():
|
||||||
|
fields = OtherMutation._meta.fields
|
||||||
|
assert list(fields.keys()) == ['name']
|
||||||
|
assert isinstance(fields['name'], Field)
|
||||||
|
field = OtherMutation.Field()
|
||||||
|
assert field.type == OtherMutation
|
||||||
|
assert list(field.args.keys()) == ['input']
|
||||||
|
assert isinstance(field.args['input'], Argument)
|
||||||
|
assert field.args['input'].type == OtherMutation.Input
|
||||||
|
|
||||||
|
|
||||||
def test_subclassed_mutation_input():
|
def test_subclassed_mutation_input():
|
||||||
Input = OtherMutation.Input
|
Input = OtherMutation.Input
|
||||||
assert issubclass(Input, InputObjectType)
|
assert issubclass(Input, InputObjectType)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user