2017-04-10 07:04:03 +03:00
|
|
|
from graphene.test import Client
|
2017-07-13 07:45:06 +03:00
|
|
|
|
2015-10-28 09:56:24 +03:00
|
|
|
from ..data import setup
|
2015-10-31 23:46:43 +03:00
|
|
|
from ..schema import schema
|
2015-10-27 09:54:51 +03:00
|
|
|
|
|
|
|
setup()
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
client = Client(schema)
|
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2017-07-13 07:21:16 +03:00
|
|
|
def test_str_schema(snapshot):
|
|
|
|
snapshot.assert_match(str(schema))
|
2016-08-14 09:00:25 +03:00
|
|
|
|
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
def test_correctly_fetches_id_name_rebels(snapshot):
|
2015-09-26 09:25:10 +03:00
|
|
|
query = '''
|
|
|
|
query RebelsQuery {
|
|
|
|
rebels {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2017-04-10 07:04:03 +03:00
|
|
|
snapshot.assert_match(client.execute(query))
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
def test_correctly_refetches_rebels(snapshot):
|
2015-09-26 09:25:10 +03:00
|
|
|
query = '''
|
|
|
|
query RebelsRefetchQuery {
|
|
|
|
node(id: "RmFjdGlvbjox") {
|
|
|
|
id
|
|
|
|
... on Faction {
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2017-04-10 07:04:03 +03:00
|
|
|
snapshot.assert_match(client.execute(query))
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
def test_correctly_fetches_id_name_empire(snapshot):
|
2015-09-26 09:25:10 +03:00
|
|
|
query = '''
|
|
|
|
query EmpireQuery {
|
|
|
|
empire {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2017-04-10 07:04:03 +03:00
|
|
|
snapshot.assert_match(client.execute(query))
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
def test_correctly_refetches_empire(snapshot):
|
2015-09-26 09:25:10 +03:00
|
|
|
query = '''
|
|
|
|
query EmpireRefetchQuery {
|
|
|
|
node(id: "RmFjdGlvbjoy") {
|
|
|
|
id
|
|
|
|
... on Faction {
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2017-04-10 07:04:03 +03:00
|
|
|
snapshot.assert_match(client.execute(query))
|
2015-09-26 09:25:10 +03:00
|
|
|
|
2015-10-03 08:17:51 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
def test_correctly_refetches_xwing(snapshot):
|
2015-09-26 09:25:10 +03:00
|
|
|
query = '''
|
|
|
|
query XWingRefetchQuery {
|
|
|
|
node(id: "U2hpcDox") {
|
|
|
|
id
|
|
|
|
... on Ship {
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
2017-04-10 07:04:03 +03:00
|
|
|
snapshot.assert_match(client.execute(query))
|