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_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"
|
2019-08-18 00:07:53 +03:00
|
|
|
] = '''"""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."""
|
|
|
|
ships(before: String = null, after: String = null, first: Int = null, last: Int = null): ShipConnection
|
2017-07-13 07:21:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
input IntroduceShipInput {
|
|
|
|
shipName: String!
|
|
|
|
factionId: String!
|
2019-08-18 00:07:53 +03:00
|
|
|
clientMutationId: String = null
|
2017-07-13 07:21:16 +03:00
|
|
|
}
|
|
|
|
|
2017-08-02 09:12:21 +03:00
|
|
|
type IntroduceShipPayload {
|
|
|
|
ship: Ship
|
|
|
|
faction: Faction
|
|
|
|
clientMutationId: String
|
|
|
|
}
|
|
|
|
|
2017-07-13 07:21:16 +03:00
|
|
|
type Mutation {
|
2017-08-02 09:12:21 +03:00
|
|
|
introduceShip(input: IntroduceShipInput!): IntroduceShipPayload
|
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!
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
type Query {
|
|
|
|
rebels: Faction
|
|
|
|
empire: Faction
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""The ID of the object"""
|
2017-07-13 07:21:16 +03:00
|
|
|
node(id: ID!): Node
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
type ShipConnection {
|
2019-08-18 00:07:53 +03:00
|
|
|
"""Pagination data for this connection."""
|
2017-07-13 07:21:16 +03:00
|
|
|
pageInfo: PageInfo!
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""Contains the nodes in this connection."""
|
2017-07-13 07:21:16 +03:00
|
|
|
edges: [ShipEdge]!
|
|
|
|
}
|
|
|
|
|
2019-08-18 00:07:53 +03:00
|
|
|
"""A Relay edge containing a `Ship` and its cursor."""
|
2017-07-13 07:21:16 +03:00
|
|
|
type ShipEdge {
|
2019-08-18 00:07:53 +03:00
|
|
|
"""The item at the end of the edge"""
|
2017-07-13 07:21:16 +03:00
|
|
|
node: Ship
|
2019-08-18 00:07:53 +03:00
|
|
|
|
|
|
|
"""A cursor for use in pagination"""
|
2017-07-13 07:21:16 +03:00
|
|
|
cursor: String!
|
|
|
|
}
|
2019-08-18 00:07:53 +03:00
|
|
|
'''
|