mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-25 11:03:58 +03:00
48678afba4
* actually run the tests in python 3.12 and 3.13 * remove snapshottest from the example tests so that the tests pass in 3.12 and 3.13 again * remove the section about snapshot testing from the testing docs because the snapshottest package doesn't work on Python 3.12 and above * fix assertion for badly formed JSON input on Python 3.13 * fix deprecation warning about datetime.utcfromtimestamp()
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
from graphene.test import Client
|
|
|
|
from ..data import setup
|
|
from ..schema import schema
|
|
|
|
setup()
|
|
|
|
client = Client(schema)
|
|
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
""")
|
|
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"}},
|
|
]
|
|
},
|
|
},
|
|
}
|
|
}
|
|
}
|