@@ -45,8 +45,12 @@ def response_json(response):
45
45
return json .loads (response .data .decode ())
46
46
47
47
48
- j = lambda ** kwargs : json .dumps (kwargs )
49
- jl = lambda ** kwargs : json .dumps ([kwargs ])
48
+ def json_dump_kwarg (** kwargs ):
49
+ return json .dumps (kwargs )
50
+
51
+
52
+ def json_dump_kwarg_list (** kwargs ):
53
+ return json .dumps ([kwargs ])
50
54
51
55
52
56
def test_allows_get_with_query_param (app , client ):
@@ -188,7 +192,7 @@ def test_allows_mutation_to_exist_within_a_get(app, client):
188
192
189
193
190
194
def test_allows_post_with_json_encoding (app , client ):
191
- response = client .post (url_string (app ), data = j (query = '{test}' ), content_type = 'application/json' )
195
+ response = client .post (url_string (app ), data = json_dump_kwarg (query = '{test}' ), content_type = 'application/json' )
192
196
193
197
assert response .status_code == 200
194
198
assert response_json (response ) == {
@@ -197,7 +201,7 @@ def test_allows_post_with_json_encoding(app, client):
197
201
198
202
199
203
def test_allows_sending_a_mutation_via_post (app , client ):
200
- response = client .post (url_string (app ), data = j (query = 'mutation TestMutation { writeTest { test } }' ), content_type = 'application/json' )
204
+ response = client .post (url_string (app ), data = json_dump_kwarg (query = 'mutation TestMutation { writeTest { test } }' ), content_type = 'application/json' )
201
205
202
206
assert response .status_code == 200
203
207
assert response_json (response ) == {
@@ -228,7 +232,7 @@ def test_allows_post_with_url_encoding(app, client):
228
232
229
233
230
234
def test_supports_post_json_query_with_string_variables (app , client ):
231
- response = client .post (url_string (app ), data = j (
235
+ response = client .post (url_string (app ), data = json_dump_kwarg (
232
236
query = 'query helloWho($who: String){ test(who: $who) }' ,
233
237
variables = json .dumps ({'who' : "Dolly" })
234
238
), content_type = 'application/json' )
@@ -240,7 +244,7 @@ def test_supports_post_json_query_with_string_variables(app, client):
240
244
241
245
242
246
def test_supports_post_json_query_with_json_variables (app , client ):
243
- response = client .post (url_string (app ), data = j (
247
+ response = client .post (url_string (app ), data = json_dump_kwarg (
244
248
query = 'query helloWho($who: String){ test(who: $who) }' ,
245
249
variables = {'who' : "Dolly" }
246
250
), content_type = 'application/json' )
@@ -267,7 +271,7 @@ def test_supports_post_json_quey_with_get_variable_values(app, client):
267
271
response = client .post (url_string (
268
272
app ,
269
273
variables = json .dumps ({'who' : "Dolly" })
270
- ), data = j (
274
+ ), data = json_dump_kwarg (
271
275
query = 'query helloWho($who: String){ test(who: $who) }' ,
272
276
), content_type = 'application/json' )
273
277
@@ -307,7 +311,7 @@ def test_supports_post_raw_text_query_with_get_variable_values(app, client):
307
311
308
312
309
313
def test_allows_post_with_operation_name (app , client ):
310
- response = client .post (url_string (app ), data = j (
314
+ response = client .post (url_string (app ), data = json_dump_kwarg (
311
315
query = '''
312
316
query helloYou { test(who: "You"), ...shared }
313
317
query helloWorld { test(who: "World"), ...shared }
@@ -508,7 +512,7 @@ def test_post_multipart_data(app, client):
508
512
def test_batch_allows_post_with_json_encoding (app , client ):
509
513
response = client .post (
510
514
url_string (app ),
511
- data = jl (
515
+ data = json_dump_kwarg_list (
512
516
# id=1,
513
517
query = '{test}'
514
518
),
@@ -526,7 +530,7 @@ def test_batch_allows_post_with_json_encoding(app, client):
526
530
def test_batch_supports_post_json_query_with_json_variables (app , client ):
527
531
response = client .post (
528
532
url_string (app ),
529
- data = jl (
533
+ data = json_dump_kwarg_list (
530
534
# id=1,
531
535
query = 'query helloWho($who: String){ test(who: $who) }' ,
532
536
variables = {'who' : "Dolly" }
@@ -545,7 +549,7 @@ def test_batch_supports_post_json_query_with_json_variables(app, client):
545
549
def test_batch_allows_post_with_operation_name (app , client ):
546
550
response = client .post (
547
551
url_string (app ),
548
- data = jl (
552
+ data = json_dump_kwarg_list (
549
553
# id=1,
550
554
query = '''
551
555
query helloYou { test(who: "You"), ...shared }
0 commit comments