mirror of
https://github.com/graphql-python/graphene.git
synced 2024-12-04 07:23:59 +03:00
7ef3c8ee3e
* Changed dependencies to core-next * Converted Scalars * ResolveInfo name change * Ignore .venv * Make Schema compatible with GraphQL-core-next * Ignore more venv names and mypy and pytest caches * Remove print statements for debugging in schema test * core-next now provides out_type and out_name * Adapt date and time scalar types to core-next * Ignore the non-standard result.invalid flag * Results are named tuples in core-next (immutable) * Enum values are returned as dict in core-next * Fix mutation tests with promises * Make all 345 tests pass with graphql-core-next * Remove the compat module which was only needed for older Py version * Remove object as base class (not needed in Py 3) * We can assume that dicts are ordered in Py 3.6+ * Make use of the fact that dicts are iterable * Use consistent style of importing from pytest * Restore compatibility with graphql-relay-py v3 Add adpaters for the PageInfo and Connection args. * Avoid various deprecation warnings * Use graphql-core 3 instead of graphql-core-next * Update dependencies, reformat changes with black * Update graphene/relay/connection.py Co-Authored-By: Jonathan Kim <jkimbo@gmail.com> * Run black on setup.py * Remove trailing whitespace
118 lines
2.5 KiB
Python
118 lines
2.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# snapshottest: v1 - https://goo.gl/zC4yUc
|
|
from __future__ import unicode_literals
|
|
|
|
from snapshottest import Snapshot
|
|
|
|
snapshots = Snapshot()
|
|
|
|
snapshots["test_correctly_fetches_id_name_rebels 1"] = {
|
|
"data": {
|
|
"rebels": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"}
|
|
}
|
|
}
|
|
|
|
snapshots["test_correctly_refetches_rebels 1"] = {
|
|
"data": {"node": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"}}
|
|
}
|
|
|
|
snapshots["test_correctly_fetches_id_name_empire 1"] = {
|
|
"data": {"empire": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}}
|
|
}
|
|
|
|
snapshots["test_correctly_refetches_empire 1"] = {
|
|
"data": {"node": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}}
|
|
}
|
|
|
|
snapshots["test_correctly_refetches_xwing 1"] = {
|
|
"data": {"node": {"id": "U2hpcDox", "name": "X-Wing"}}
|
|
}
|
|
|
|
snapshots[
|
|
"test_str_schema 1"
|
|
] = '''"""A faction in the Star Wars saga"""
|
|
type Faction implements Node {
|
|
"""The ID of the object"""
|
|
id: ID!
|
|
|
|
"""The name of the faction."""
|
|
name: String
|
|
|
|
"""The ships used by the faction."""
|
|
ships(before: String = null, after: String = null, first: Int = null, last: Int = null): ShipConnection
|
|
}
|
|
|
|
input IntroduceShipInput {
|
|
shipName: String!
|
|
factionId: String!
|
|
clientMutationId: String = null
|
|
}
|
|
|
|
type IntroduceShipPayload {
|
|
ship: Ship
|
|
faction: Faction
|
|
clientMutationId: String
|
|
}
|
|
|
|
type Mutation {
|
|
introduceShip(input: IntroduceShipInput!): IntroduceShipPayload
|
|
}
|
|
|
|
"""An object with an ID"""
|
|
interface Node {
|
|
"""The ID of the object"""
|
|
id: ID!
|
|
}
|
|
|
|
"""
|
|
The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
|
|
"""
|
|
type PageInfo {
|
|
"""When paginating forwards, are there more items?"""
|
|
hasNextPage: Boolean!
|
|
|
|
"""When paginating backwards, are there more items?"""
|
|
hasPreviousPage: Boolean!
|
|
|
|
"""When paginating backwards, the cursor to continue."""
|
|
startCursor: String
|
|
|
|
"""When paginating forwards, the cursor to continue."""
|
|
endCursor: String
|
|
}
|
|
|
|
type Query {
|
|
rebels: Faction
|
|
empire: Faction
|
|
|
|
"""The ID of the object"""
|
|
node(id: ID!): Node
|
|
}
|
|
|
|
"""A ship in the Star Wars saga"""
|
|
type Ship implements Node {
|
|
"""The ID of the object"""
|
|
id: ID!
|
|
|
|
"""The name of the ship."""
|
|
name: String
|
|
}
|
|
|
|
type ShipConnection {
|
|
"""Pagination data for this connection."""
|
|
pageInfo: PageInfo!
|
|
|
|
"""Contains the nodes in this connection."""
|
|
edges: [ShipEdge]!
|
|
}
|
|
|
|
"""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!
|
|
}
|
|
'''
|