File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
+ import sys
2
3
3
4
import pytest
4
5
from django .utils .translation import gettext_lazy
9
10
from ..utils .testing import graphql_query
10
11
11
12
13
+ def call_args_compat (mock ):
14
+ if sys .version_info < (3 , 8 ):
15
+ setattr (mock .call_args , "args" , mock .call_args [0 ])
16
+ return mock .call_args
17
+
18
+
12
19
def test_get_model_fields_no_duplication ():
13
20
reporter_fields = get_model_fields (Reporter )
14
21
reporter_name_set = set ([field [0 ] for field in reporter_fields ])
@@ -54,7 +61,7 @@ def runTest(self):
54
61
tc ._pre_setup ()
55
62
tc .setUpClass ()
56
63
tc .query ("query { }" , operation_name = "QueryName" )
57
- body = json .loads (post_mock . call_args .args [1 ])
64
+ body = json .loads (call_args_compat ( post_mock ) .args [1 ])
58
65
# `operationName` field from https://graphql.org/learn/serving-over-http/#post-request
59
66
assert (
60
67
"operationName" ,
@@ -66,7 +73,7 @@ def runTest(self):
66
73
@patch ("graphene_django.utils.testing.Client.post" )
67
74
def test_graphql_query_case_operation_name (post_mock ):
68
75
graphql_query ("query { }" , operation_name = "QueryName" )
69
- body = json .loads (post_mock . call_args .args [1 ])
76
+ body = json .loads (call_args_compat ( post_mock ) .args [1 ])
70
77
# `operationName` field from https://graphql.org/learn/serving-over-http/#post-request
71
78
assert (
72
79
"operationName" ,
You can’t perform that action at this time.
0 commit comments