Skip to content

Commit 038f81e

Browse files
committed
Added extra parameters section in testing docs
@BossGrand 😉
1 parent 917dc16 commit 038f81e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/testing/index.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,27 @@ To use the test client, instantiate ``graphene.test.Client`` and retrieve GraphQ
5050
}
5151
5252
53+
Execute parameters
54+
~~~~~~~~~~~~~~~~~~
55+
56+
You can also add extra keyword arguments to the ``execute`` method, such as
57+
``context_value``, ``root_value``, ``variable_values``, ...:
58+
59+
60+
.. code:: python
61+
62+
from graphene.test import Client
63+
64+
def test_hey():
65+
client = Client(my_schema)
66+
executed = client.execute('''{ hey }''', context_value={'user': 'Peter'})
67+
assert executed == {
68+
'data': {
69+
'hey': 'hello Peter!'
70+
}
71+
}
72+
73+
5374
Snapshot testing
5475
~~~~~~~~~~~~~~~~
5576

0 commit comments

Comments
 (0)