Added additional test.

This commit is contained in:
Markus Padourek 2016-08-16 11:43:04 +01:00
parent 7913052d07
commit ef8d7e2bd2

View File

@ -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)