Skip to content

Commit 07c5109

Browse files
authored
Rename op_name to operation_name (#941)
1 parent 10d22de commit 07c5109

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

graphene_django/tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_camelize():
4040
@patch("graphene_django.utils.testing.Client.post")
4141
def test_graphql_test_case_op_name(post_mock):
4242
"""
43-
Test that `GraphQLTestCase.query()`'s `op_name` argument produces an `operationName` field.
43+
Test that `GraphQLTestCase.query()`'s `operation_name` argument produces an `operationName` field.
4444
"""
4545

4646
class TestClass(GraphQLTestCase):
@@ -51,7 +51,7 @@ def runTest(self):
5151

5252
tc = TestClass()
5353
tc.setUpClass()
54-
tc.query("query { }", op_name="QueryName")
54+
tc.query("query { }", operation_name="QueryName")
5555
body = json.loads(post_mock.call_args.args[1])
5656
# `operationName` field from https://graphql.org/learn/serving-over-http/#post-request
5757
assert (

graphene_django/utils/testing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ def setUpClass(cls):
2424

2525
cls._client = Client()
2626

27-
def query(self, query, op_name=None, input_data=None, variables=None, headers=None):
27+
def query(
28+
self, query, operation_name=None, input_data=None, variables=None, headers=None
29+
):
2830
"""
2931
Args:
3032
query (string) - GraphQL query to run
31-
op_name (string) - If the query is a mutation or named query, you must
33+
operation_name (string) - If the query is a mutation or named query, you must
3234
supply the op_name. For annon queries ("{ ... }"),
3335
should be None (default).
3436
input_data (dict) - If provided, the $input variable in GraphQL will be set
@@ -44,8 +46,8 @@ def query(self, query, op_name=None, input_data=None, variables=None, headers=No
4446
Response object from client
4547
"""
4648
body = {"query": query}
47-
if op_name:
48-
body["operationName"] = op_name
49+
if operation_name:
50+
body["operationName"] = operation_name
4951
if variables:
5052
body["variables"] = variables
5153
if input_data:

0 commit comments

Comments
 (0)