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 11import json
2+ import sys
23
34import pytest
45from django .utils .translation import gettext_lazy
910from ..utils .testing import graphql_query
1011
1112
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+
1219def test_get_model_fields_no_duplication ():
1320 reporter_fields = get_model_fields (Reporter )
1421 reporter_name_set = set ([field [0 ] for field in reporter_fields ])
@@ -54,7 +61,7 @@ def runTest(self):
5461 tc ._pre_setup ()
5562 tc .setUpClass ()
5663 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 ])
5865 # `operationName` field from https://graphql.org/learn/serving-over-http/#post-request
5966 assert (
6067 "operationName" ,
@@ -66,7 +73,7 @@ def runTest(self):
6673@patch ("graphene_django.utils.testing.Client.post" )
6774def test_graphql_query_case_operation_name (post_mock ):
6875 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 ])
7077 # `operationName` field from https://graphql.org/learn/serving-over-http/#post-request
7178 assert (
7279 "operationName" ,
You can’t perform that action at this time.
0 commit comments