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