mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +03:00
38 lines
713 B
Python
38 lines
713 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 result.errors == None
|
|
assert result.data == expected
|