2017-04-10 07:04:03 +03:00
|
|
|
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
|
2015-10-31 23:46:43 +03:00
|
|
|
from ..schema import schema
|
2015-10-30 10:36:31 +03:00
|
|
|
|
|
|
|
setup()
|
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
client = Client(schema)
|
2015-10-30 10:36:31 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
|
2024-08-08 12:49:26 +03:00
|
|
|
def test_mutations():
|
|
|
|
result = client.execute("""
|
|
|
|
mutation MyMutation {
|
|
|
|
introduceShip(input:{clientMutationId:"abc", shipName: "Peter", factionId: "1"}) {
|
|
|
|
ship {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
faction {
|
|
|
|
name
|
|
|
|
ships {
|
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
2016-06-15 09:48:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-30 10:36:31 +03:00
|
|
|
}
|
2024-08-08 12:49:26 +03:00
|
|
|
""")
|
|
|
|
assert result == {
|
|
|
|
"data": {
|
|
|
|
"introduceShip": {
|
|
|
|
"ship": {"id": "U2hpcDo5", "name": "Peter"},
|
|
|
|
"faction": {
|
|
|
|
"name": "Alliance to Restore the Republic",
|
|
|
|
"ships": {
|
|
|
|
"edges": [
|
|
|
|
{"node": {"id": "U2hpcDox", "name": "X-Wing"}},
|
|
|
|
{"node": {"id": "U2hpcDoy", "name": "Y-Wing"}},
|
|
|
|
{"node": {"id": "U2hpcDoz", "name": "A-Wing"}},
|
|
|
|
{"node": {"id": "U2hpcDo0", "name": "Millennium Falcon"}},
|
|
|
|
{"node": {"id": "U2hpcDo1", "name": "Home One"}},
|
|
|
|
{"node": {"id": "U2hpcDo5", "name": "Peter"}},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2015-10-30 10:36:31 +03:00
|
|
|
}
|