2015-09-26 09:25:10 +03:00
|
|
|
from pytest import raises
|
|
|
|
from graphql.core import graphql
|
|
|
|
|
2015-09-28 06:19:33 +03:00
|
|
|
from .schema import schema
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2015-09-26 09:25:10 +03:00
|
|
|
def test_correct_fetch_first_ship_rebels():
|
|
|
|
query = '''
|
|
|
|
query RebelsShipsQuery {
|
|
|
|
rebels {
|
|
|
|
name,
|
|
|
|
ships(first: 1) {
|
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
expected = {
|
2015-10-03 08:17:51 +03:00
|
|
|
'rebels': {
|
|
|
|
'name': 'Alliance to Restore the Republic',
|
|
|
|
'ships': {
|
|
|
|
'edges': [
|
|
|
|
{
|
|
|
|
'node': {
|
|
|
|
'name': 'X-Wing'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2015-09-26 09:25:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-09-28 06:19:33 +03:00
|
|
|
result = schema.execute(query)
|
2015-09-29 10:31:59 +03:00
|
|
|
assert not result.errors
|
2015-09-26 09:25:10 +03:00
|
|
|
assert result.data == expected
|