mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-24 10:33:59 +03:00
Add testcase
This commit is contained in:
parent
05d7e61b84
commit
26932b2080
45
graphene/tests/issues/test_719.py
Normal file
45
graphene/tests/issues/test_719.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# https://github.com/graphql-python/graphene/issues/719
|
||||||
|
|
||||||
|
import graphene
|
||||||
|
|
||||||
|
|
||||||
|
class InvitationType(graphene.ObjectType):
|
||||||
|
creation_date = graphene.String()
|
||||||
|
|
||||||
|
|
||||||
|
class CreateInvitation(graphene.Mutation):
|
||||||
|
class Arguments:
|
||||||
|
email = graphene.String(required=True)
|
||||||
|
|
||||||
|
invitation = graphene.Field(InvitationType)
|
||||||
|
|
||||||
|
def mutate(self, info, email):
|
||||||
|
return InvitationType(creation_date='2018-05-04T14:45:36')
|
||||||
|
|
||||||
|
|
||||||
|
class Mutations(graphene.ObjectType):
|
||||||
|
create_invitation = CreateInvitation.Field()
|
||||||
|
|
||||||
|
|
||||||
|
class Query(graphene.ObjectType):
|
||||||
|
name = graphene.String(default_value="Dave")
|
||||||
|
|
||||||
|
|
||||||
|
def test_issue():
|
||||||
|
query_string = '''
|
||||||
|
mutation ($email: String!) {
|
||||||
|
createInvitation(email: $email) {
|
||||||
|
invitation {
|
||||||
|
creationDate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
|
||||||
|
schema = graphene.Schema(query=Query, mutation=Mutations)
|
||||||
|
result = schema.execute(query_string, variable_values={
|
||||||
|
'email': 'foo@bar.com',
|
||||||
|
})
|
||||||
|
|
||||||
|
assert not result.errors
|
||||||
|
# assert result.data['someField'] == 'Oh'
|
Loading…
Reference in New Issue
Block a user