|
3 | 3 | from graphene.types import ID, Field, ObjectType, Schema |
4 | 4 | from graphene.types.scalars import String |
5 | 5 | from graphene.relay.mutation import ClientIDMutation |
| 6 | +from graphene.test import Client |
6 | 7 |
|
7 | 8 |
|
8 | 9 | class SharedFields(object): |
@@ -61,24 +62,27 @@ class Mutation(ObjectType): |
61 | 62 |
|
62 | 63 |
|
63 | 64 | schema = Schema(query=RootQuery, mutation=Mutation) |
| 65 | +client = Client(schema) |
64 | 66 |
|
65 | 67 |
|
66 | 68 | @mark.asyncio |
67 | 69 | async def test_node_query_promise(): |
68 | | - executed = await schema.execute_async( |
| 70 | + executed = await client.execute_async( |
69 | 71 | 'mutation a { sayPromise(input: {what:"hello", clientMutationId:"1"}) { phrase } }' |
70 | 72 | ) |
71 | | - assert not executed.errors |
72 | | - assert executed.data == {"sayPromise": {"phrase": "hello"}} |
| 73 | + assert isinstance(executed, dict) |
| 74 | + assert "errors" not in executed |
| 75 | + assert executed["data"] == {"sayPromise": {"phrase": "hello"}} |
73 | 76 |
|
74 | 77 |
|
75 | 78 | @mark.asyncio |
76 | 79 | async def test_edge_query(): |
77 | | - executed = await schema.execute_async( |
| 80 | + executed = await client.execute_async( |
78 | 81 | 'mutation a { other(input: {clientMutationId:"1"}) { clientMutationId, myNodeEdge { cursor node { name }} } }' |
79 | 82 | ) |
80 | | - assert not executed.errors |
81 | | - assert dict(executed.data) == { |
| 83 | + assert isinstance(executed, dict) |
| 84 | + assert "errors" not in executed |
| 85 | + assert executed["data"] == { |
82 | 86 | "other": { |
83 | 87 | "clientMutationId": "1", |
84 | 88 | "myNodeEdge": {"cursor": "1", "node": {"name": "name"}}, |
|
0 commit comments