2017-04-10 07:04:03 +03:00
|
|
|
# -*- coding: utf-8 -*-
|
2017-04-10 14:26:54 +03:00
|
|
|
# snapshottest: v1 - https://goo.gl/zC4yUc
|
2017-04-10 07:04:03 +03:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from snapshottest import Snapshot
|
|
|
|
|
|
|
|
snapshots = Snapshot()
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_hero_name_query 1"] = {"data": {"hero": {"name": "R2-D2"}}}
|
2017-04-10 07:04:03 +03:00
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_hero_name_and_friends_query 1"] = {
|
|
|
|
"data": {
|
|
|
|
"hero": {
|
|
|
|
"id": "2001",
|
|
|
|
"name": "R2-D2",
|
|
|
|
"friends": [
|
|
|
|
{"name": "Luke Skywalker"},
|
|
|
|
{"name": "Han Solo"},
|
|
|
|
{"name": "Leia Organa"},
|
|
|
|
],
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_nested_query 1"] = {
|
|
|
|
"data": {
|
|
|
|
"hero": {
|
|
|
|
"name": "R2-D2",
|
|
|
|
"friends": [
|
2017-04-10 07:04:03 +03:00
|
|
|
{
|
2018-07-06 22:09:23 +03:00
|
|
|
"name": "Luke Skywalker",
|
|
|
|
"appearsIn": ["NEWHOPE", "EMPIRE", "JEDI"],
|
|
|
|
"friends": [
|
|
|
|
{"name": "Han Solo"},
|
|
|
|
{"name": "Leia Organa"},
|
|
|
|
{"name": "C-3PO"},
|
|
|
|
{"name": "R2-D2"},
|
2017-04-10 07:04:03 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2018-07-06 22:09:23 +03:00
|
|
|
"name": "Han Solo",
|
|
|
|
"appearsIn": ["NEWHOPE", "EMPIRE", "JEDI"],
|
|
|
|
"friends": [
|
|
|
|
{"name": "Luke Skywalker"},
|
|
|
|
{"name": "Leia Organa"},
|
|
|
|
{"name": "R2-D2"},
|
2017-04-10 07:04:03 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2018-07-06 22:09:23 +03:00
|
|
|
"name": "Leia Organa",
|
|
|
|
"appearsIn": ["NEWHOPE", "EMPIRE", "JEDI"],
|
|
|
|
"friends": [
|
|
|
|
{"name": "Luke Skywalker"},
|
|
|
|
{"name": "Han Solo"},
|
|
|
|
{"name": "C-3PO"},
|
|
|
|
{"name": "R2-D2"},
|
2017-04-10 07:04:03 +03:00
|
|
|
],
|
2018-07-06 22:09:23 +03:00
|
|
|
},
|
|
|
|
],
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_fetch_luke_query 1"] = {"data": {"human": {"name": "Luke Skywalker"}}}
|
2017-04-10 07:04:03 +03:00
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_fetch_some_id_query 1"] = {
|
|
|
|
"data": {"human": {"name": "Luke Skywalker"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_fetch_some_id_query2 1"] = {"data": {"human": {"name": "Han Solo"}}}
|
2017-04-10 07:04:03 +03:00
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_invalid_id_query 1"] = {"data": {"human": None}}
|
2017-04-10 07:04:03 +03:00
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_fetch_luke_aliased 1"] = {"data": {"luke": {"name": "Luke Skywalker"}}}
|
2017-04-10 07:04:03 +03:00
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_fetch_luke_and_leia_aliased 1"] = {
|
|
|
|
"data": {"luke": {"name": "Luke Skywalker"}, "leia": {"name": "Leia Organa"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_duplicate_fields 1"] = {
|
|
|
|
"data": {
|
|
|
|
"luke": {"name": "Luke Skywalker", "homePlanet": "Tatooine"},
|
|
|
|
"leia": {"name": "Leia Organa", "homePlanet": "Alderaan"},
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_use_fragment 1"] = {
|
|
|
|
"data": {
|
|
|
|
"luke": {"name": "Luke Skywalker", "homePlanet": "Tatooine"},
|
|
|
|
"leia": {"name": "Leia Organa", "homePlanet": "Alderaan"},
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_check_type_of_r2 1"] = {
|
|
|
|
"data": {"hero": {"__typename": "Droid", "name": "R2-D2"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_check_type_of_luke 1"] = {
|
|
|
|
"data": {"hero": {"__typename": "Human", "name": "Luke Skywalker"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|