@@ -17,14 +17,14 @@ class GraphQLTestCase(TestCase):
17
17
18
18
@classmethod
19
19
def setUpClass (cls ):
20
- super ().setUpClass ()
20
+ super (GraphQLTestCase , cls ).setUpClass ()
21
21
22
22
if not cls .GRAPHQL_SCHEMA :
23
23
raise AttributeError ('Variable GRAPHQL_SCHEMA not defined in GraphQLTestCase.' )
24
24
25
25
cls ._client = Client (cls .GRAPHQL_SCHEMA )
26
26
27
- def query (self , query : str , op_name : str = None , input_data : dict = None ):
27
+ def query (self , query , op_name = None , input_data = None ):
28
28
"""
29
29
Args:
30
30
query (string) - GraphQL query to run
@@ -47,18 +47,20 @@ def query(self, query: str, op_name: str = None, input_data: dict = None):
47
47
content_type = 'application/json' )
48
48
return resp
49
49
50
- def assertResponseNoErrors (self , resp : HttpResponse ):
50
+ def assertResponseNoErrors (self , resp ):
51
51
"""
52
52
Assert that the call went through correctly. 200 means the syntax is ok, if there are no `errors`,
53
53
the call was fine.
54
+ :resp HttpResponse: Response
54
55
"""
55
56
content = json .loads (resp .content )
56
57
self .assertEqual (resp .status_code , 200 )
57
58
self .assertNotIn ('errors' , list (content .keys ()))
58
59
59
- def assertResponseHasErrors (self , resp : HttpResponse ):
60
+ def assertResponseHasErrors (self , resp ):
60
61
"""
61
62
Assert that the call was failing. Take care: Even with errors, GraphQL returns status 200!
63
+ :resp HttpResponse: Response
62
64
"""
63
65
content = json .loads (resp .content )
64
66
self .assertIn ('errors' , list (content .keys ()))
0 commit comments