2016-06-15 09:48:25 +03:00
|
|
|
from ..data import setup
|
|
|
|
from ..schema import schema
|
2015-10-27 09:54:51 +03:00
|
|
|
|
2016-06-15 09:48:25 +03:00
|
|
|
setup()
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2016-06-15 09:48:25 +03:00
|
|
|
def test_correct_fetch_first_ship_rebels():
|
|
|
|
query = '''
|
|
|
|
query RebelsShipsQuery {
|
|
|
|
rebels {
|
|
|
|
name,
|
|
|
|
ships(first: 1) {
|
2016-06-16 08:45:28 +03:00
|
|
|
pageInfo {
|
|
|
|
startCursor
|
|
|
|
endCursor
|
|
|
|
hasNextPage
|
|
|
|
hasPreviousPage
|
|
|
|
}
|
2016-06-15 09:48:25 +03:00
|
|
|
edges {
|
2016-06-16 08:45:28 +03:00
|
|
|
cursor
|
2016-06-15 09:48:25 +03:00
|
|
|
node {
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
expected = {
|
|
|
|
'rebels': {
|
|
|
|
'name': 'Alliance to Restore the Republic',
|
|
|
|
'ships': {
|
2016-06-16 08:45:28 +03:00
|
|
|
'pageInfo': {
|
|
|
|
'startCursor': 'YXJyYXljb25uZWN0aW9uOjA=',
|
|
|
|
'endCursor': 'YXJyYXljb25uZWN0aW9uOjA=',
|
|
|
|
'hasNextPage': True,
|
|
|
|
'hasPreviousPage': False
|
|
|
|
},
|
2016-06-15 09:48:25 +03:00
|
|
|
'edges': [
|
|
|
|
{
|
2016-06-16 08:45:28 +03:00
|
|
|
'cursor': 'YXJyYXljb25uZWN0aW9uOjA=',
|
2016-06-15 09:48:25 +03:00
|
|
|
'node': {
|
|
|
|
'name': 'X-Wing'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
result = schema.execute(query)
|
|
|
|
assert not result.errors
|
|
|
|
assert result.data == expected
|