mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-08 23:50:38 +03:00
Added failing test for relay mutation
This commit is contained in:
parent
0ef065e5cc
commit
7913052d07
|
@ -6,6 +6,10 @@ from ...types.scalars import String
|
|||
from ..mutation import ClientIDMutation
|
||||
|
||||
|
||||
class SharedFields(object):
|
||||
shared = String()
|
||||
|
||||
|
||||
class SaySomething(ClientIDMutation):
|
||||
|
||||
class Input:
|
||||
|
@ -18,12 +22,24 @@ class SaySomething(ClientIDMutation):
|
|||
return SaySomething(phrase=str(what))
|
||||
|
||||
|
||||
class OtherMutation(ClientIDMutation):
|
||||
|
||||
class Input(SharedFields):
|
||||
additional_field = String()
|
||||
|
||||
@classmethod
|
||||
def mutate_and_get_payload(cls, args, context, info):
|
||||
what = args.get('what')
|
||||
return SaySomething(shared=str(what), additional_field='additional')
|
||||
|
||||
|
||||
class RootQuery(ObjectType):
|
||||
something = String()
|
||||
|
||||
|
||||
class Mutation(ObjectType):
|
||||
say = SaySomething.Field()
|
||||
other = OtherMutation.Field()
|
||||
|
||||
schema = Schema(query=RootQuery, mutation=Mutation)
|
||||
|
||||
|
@ -59,6 +75,19 @@ def test_mutation_input():
|
|||
assert fields['client_mutation_id'].type == String
|
||||
|
||||
|
||||
def test_subclassed_mutation_input():
|
||||
Input = OtherMutation.Input
|
||||
assert issubclass(Input, InputObjectType)
|
||||
fields = Input._meta.fields
|
||||
assert list(fields.keys()) == ['shared', 'additional_field', 'client_mutation_id']
|
||||
assert isinstance(fields['shared'], InputField)
|
||||
assert fields['shared'].type == String
|
||||
assert isinstance(fields['additional_field'], InputField)
|
||||
assert fields['additional_field'].type == String
|
||||
assert isinstance(fields['client_mutation_id'], InputField)
|
||||
assert fields['client_mutation_id'].type == String
|
||||
|
||||
|
||||
# def test_node_query():
|
||||
# executed = schema.execute(
|
||||
# 'mutation a { say(input: {what:"hello", clientMutationId:"1"}) { phrase } }'
|
||||
|
|
Loading…
Reference in New Issue
Block a user