From 038f81e8e1931e1f5fb55cad80773bf6c2d2d09c Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 10 Apr 2017 16:18:45 -0700 Subject: [PATCH] Added extra parameters section in testing docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @BossGrand 😉 --- docs/testing/index.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/testing/index.rst b/docs/testing/index.rst index 0dcb0034..516f0e8d 100644 --- a/docs/testing/index.rst +++ b/docs/testing/index.rst @@ -50,6 +50,27 @@ To use the test client, instantiate ``graphene.test.Client`` and retrieve GraphQ } +Execute parameters +~~~~~~~~~~~~~~~~~~ + +You can also add extra keyword arguments to the ``execute`` method, such as +``context_value``, ``root_value``, ``variable_values``, ...: + + +.. code:: python + + from graphene.test import Client + + def test_hey(): + client = Client(my_schema) + executed = client.execute('''{ hey }''', context_value={'user': 'Peter'}) + assert executed == { + 'data': { + 'hey': 'hello Peter!' + } + } + + Snapshot testing ~~~~~~~~~~~~~~~~