mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-25 19:13:57 +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()
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
from graphene.test import Client
|
|
|
|
from ..data import setup
|
|
from ..schema import schema
|
|
|
|
setup()
|
|
|
|
client = Client(schema)
|
|
|
|
|
|
def test_correct_fetch_first_ship_rebels():
|
|
result = client.execute("""
|
|
query RebelsShipsQuery {
|
|
rebels {
|
|
name,
|
|
ships(first: 1) {
|
|
pageInfo {
|
|
startCursor
|
|
endCursor
|
|
hasNextPage
|
|
hasPreviousPage
|
|
}
|
|
edges {
|
|
cursor
|
|
node {
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
""")
|
|
assert result == {
|
|
"data": {
|
|
"rebels": {
|
|
"name": "Alliance to Restore the Republic",
|
|
"ships": {
|
|
"pageInfo": {
|
|
"startCursor": "YXJyYXljb25uZWN0aW9uOjA=",
|
|
"endCursor": "YXJyYXljb25uZWN0aW9uOjA=",
|
|
"hasNextPage": True,
|
|
"hasPreviousPage": False,
|
|
},
|
|
"edges": [
|
|
{
|
|
"cursor": "YXJyYXljb25uZWN0aW9uOjA=",
|
|
"node": {"name": "X-Wing"},
|
|
}
|
|
],
|
|
},
|
|
}
|
|
}
|
|
}
|