mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-23 01:56:54 +03:00
Added additional test.
This commit is contained in:
parent
7913052d07
commit
ef8d7e2bd2
|
@ -27,10 +27,13 @@ class OtherMutation(ClientIDMutation):
|
|||
class Input(SharedFields):
|
||||
additional_field = String()
|
||||
|
||||
name = String()
|
||||
|
||||
@classmethod
|
||||
def mutate_and_get_payload(cls, args, context, info):
|
||||
what = args.get('what')
|
||||
return SaySomething(shared=str(what), additional_field='additional')
|
||||
shared = args.get('shared', '')
|
||||
additionalField = args.get('additionalField', '')
|
||||
return SaySomething(name=shared + additionalField)
|
||||
|
||||
|
||||
class RootQuery(ObjectType):
|
||||
|
@ -75,6 +78,17 @@ def test_mutation_input():
|
|||
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():
|
||||
Input = OtherMutation.Input
|
||||
assert issubclass(Input, InputObjectType)
|
||||
|
|
Loading…
Reference in New Issue
Block a user