graphene/examples/starwars_relay/tests/test_mutation.py

34 lines
592 B
Python
Raw Normal View History

from graphene.test import Client
2017-07-13 07:45:06 +03:00
2015-10-30 10:36:31 +03:00
from ..data import setup
from ..schema import schema
2015-10-30 10:36:31 +03:00
setup()
client = Client(schema)
2015-10-30 10:36:31 +03:00
def test_mutations(snapshot):
2015-10-30 10:36:31 +03:00
query = '''
mutation MyMutation {
introduceShip(input:{clientMutationId:"abc", shipName: "Peter", factionId: "1"}) {
ship {
id
name
}
faction {
name
2016-06-15 09:48:25 +03:00
ships {
edges {
node {
id
name
}
}
}
2015-10-30 10:36:31 +03:00
}
}
}
'''
snapshot.assert_match(client.execute(query))