graphene/tests/starwars_relay/test_connections.py
2015-10-02 22:17:51 -07:00

39 lines
786 B
Python

from pytest import raises
from graphql.core import graphql
from .schema import schema
def test_correct_fetch_first_ship_rebels():
query = '''
query RebelsShipsQuery {
rebels {
name,
ships(first: 1) {
edges {
node {
name
}
}
}
}
}
'''
expected = {
'rebels': {
'name': 'Alliance to Restore the Republic',
'ships': {
'edges': [
{
'node': {
'name': 'X-Wing'
}
}
]
}
}
}
result = schema.execute(query)
assert not result.errors
assert result.data == expected