mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-25 19:13:57 +03:00
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
from ..data import setup
|
|
from ..schema import schema
|
|
|
|
setup()
|
|
|
|
|
|
def test_correct_fetch_first_ship_rebels():
|
|
query = '''
|
|
query RebelsShipsQuery {
|
|
rebels {
|
|
name,
|
|
ships(first: 1) {
|
|
pageInfo {
|
|
startCursor
|
|
endCursor
|
|
hasNextPage
|
|
hasPreviousPage
|
|
}
|
|
edges {
|
|
cursor
|
|
node {
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
'''
|
|
expected = {
|
|
'rebels': {
|
|
'name': 'Alliance to Restore the Republic',
|
|
'ships': {
|
|
'pageInfo': {
|
|
'startCursor': 'YXJyYXljb25uZWN0aW9uOjA=',
|
|
'endCursor': 'YXJyYXljb25uZWN0aW9uOjA=',
|
|
'hasNextPage': True,
|
|
'hasPreviousPage': False
|
|
},
|
|
'edges': [
|
|
{
|
|
'cursor': 'YXJyYXljb25uZWN0aW9uOjA=',
|
|
'node': {
|
|
'name': 'X-Wing'
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
result = schema.execute(query)
|
|
assert not result.errors
|
|
assert result.data == expected
|