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 snapshottest import Snapshot
|
|
|
|
|
2019-12-31 17:08:30 +03:00
|
|
|
|
2017-04-10 07:04:03 +03:00
|
|
|
snapshots = Snapshot()
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_correctly_fetches_id_name_rebels 1"] = {
|
|
|
|
"data": {
|
|
|
|
"rebels": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_correctly_refetches_rebels 1"] = {
|
|
|
|
"data": {"node": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_correctly_fetches_id_name_empire 1"] = {
|
|
|
|
"data": {"empire": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_correctly_refetches_empire 1"] = {
|
|
|
|
"data": {"node": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots["test_correctly_refetches_xwing 1"] = {
|
|
|
|
"data": {"node": {"id": "U2hpcDox", "name": "X-Wing"}}
|
2017-04-10 07:04:03 +03:00
|
|
|
}
|
2017-07-13 07:21:16 +03:00
|
|
|
|
2018-07-06 22:09:23 +03:00
|
|
|
snapshots[
|
|
|
|
"test_str_schema 1"
|
2020-03-04 14:23:40 +03:00
|
|
|
] = '''type Query {
|
|
|
|
rebels: Faction
|
|
|
|
empire: Faction
|
|
|
|
node(
|
|
|
|
"""The ID of the object"""
|
|
|
|
id: ID!
|
|
|
|
): Node
|
|
|
|
}
|
|
|
|
|
|
|
|
"""A faction in the Star Wars saga"""
|
2017-07-13 07:21:16 +03:00
|
|
|
type Faction implements Node {
|
2019-08-18 00:07:53 +03:00
|
|
|
"""The ID of the object"""
|
2017-07-13 07:21:16 +03:00
|
|
|
id: ID!
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""The name of the faction."""
|
2017-07-13 07:21:16 +03:00
|
|
|
name: String
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""The ships used by the faction."""
|
2022-03-20 19:52:44 +03:00
|
|
|
ships(before: String, after: String, first: Int, last: Int): ShipConnection
|
2017-07-13 07:21:16 +03:00
|
|
|
}
|
|
|
|
|
2019-08-18 00:07:53 +03:00
|
|
|
"""An object with an ID"""
|
2017-07-13 07:21:16 +03:00
|
|
|
interface Node {
|
2019-08-18 00:07:53 +03:00
|
|
|
"""The ID of the object"""
|
2017-07-13 07:21:16 +03:00
|
|
|
id: ID!
|
|
|
|
}
|
|
|
|
|
2020-03-04 14:23:40 +03:00
|
|
|
type ShipConnection {
|
|
|
|
"""Pagination data for this connection."""
|
|
|
|
pageInfo: PageInfo!
|
|
|
|
|
|
|
|
"""Contains the nodes in this connection."""
|
|
|
|
edges: [ShipEdge]!
|
|
|
|
}
|
|
|
|
|
2019-08-18 00:07:53 +03:00
|
|
|
"""
|
|
|
|
The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
|
|
|
|
"""
|
2017-07-13 07:21:16 +03:00
|
|
|
type PageInfo {
|
2019-08-18 00:07:53 +03:00
|
|
|
"""When paginating forwards, are there more items?"""
|
2017-07-13 07:21:16 +03:00
|
|
|
hasNextPage: Boolean!
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""When paginating backwards, are there more items?"""
|
2017-07-13 07:21:16 +03:00
|
|
|
hasPreviousPage: Boolean!
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""When paginating backwards, the cursor to continue."""
|
2017-07-13 07:21:16 +03:00
|
|
|
startCursor: String
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""When paginating forwards, the cursor to continue."""
|
2017-07-13 07:21:16 +03:00
|
|
|
endCursor: String
|
|
|
|
}
|
|
|
|
|
2020-03-04 14:23:40 +03:00
|
|
|
"""A Relay edge containing a `Ship` and its cursor."""
|
|
|
|
type ShipEdge {
|
|
|
|
"""The item at the end of the edge"""
|
|
|
|
node: Ship
|
|
|
|
|
|
|
|
"""A cursor for use in pagination"""
|
|
|
|
cursor: String!
|
2017-07-13 07:21:16 +03:00
|
|
|
}
|
|
|
|
|
2019-08-18 00:07:53 +03:00
|
|
|
"""A ship in the Star Wars saga"""
|
2017-07-13 07:21:16 +03:00
|
|
|
type Ship implements Node {
|
2019-08-18 00:07:53 +03:00
|
|
|
"""The ID of the object"""
|
2017-07-13 07:21:16 +03:00
|
|
|
id: ID!
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""The name of the ship."""
|
2017-07-13 07:21:16 +03:00
|
|
|
name: String
|
|
|
|
}
|
|
|
|
|
2020-03-04 14:23:40 +03:00
|
|
|
type Mutation {
|
|
|
|
introduceShip(input: IntroduceShipInput!): IntroduceShipPayload
|
2017-07-13 07:21:16 +03:00
|
|
|
}
|
|
|
|
|
2020-03-04 14:23:40 +03:00
|
|
|
type IntroduceShipPayload {
|
|
|
|
ship: Ship
|
|
|
|
faction: Faction
|
|
|
|
clientMutationId: String
|
|
|
|
}
|
2019-08-18 00:07:53 +03:00
|
|
|
|
2020-03-04 14:23:40 +03:00
|
|
|
input IntroduceShipInput {
|
|
|
|
shipName: String!
|
|
|
|
factionId: String!
|
|
|
|
clientMutationId: String
|
2022-05-07 01:48:04 +03:00
|
|
|
}'''
|