@@ -184,9 +184,9 @@ def test_batch_allows_post_with_json_encoding(client):
184
184
185
185
186
186
def test_batch_fails_if_is_empty (client ):
187
- response = client .post (batch_url_string (), j ([]) , 'application/json' )
187
+ response = client .post (batch_url_string (), '[]' , 'application/json' )
188
188
189
- assert response .status_code == 200
189
+ assert response .status_code == 400
190
190
assert response_json (response ) == {
191
191
'errors' : [{'message' : 'Received an empty list in the batch request.' }]
192
192
}
@@ -441,9 +441,18 @@ def test_handles_errors_caused_by_a_lack_of_query(client):
441
441
}
442
442
443
443
444
- def test_handles_invalid_json_bodies (client ):
444
+ def test_handles_not_expected_json_bodies (client ):
445
445
response = client .post (url_string (), '[]' , 'application/json' )
446
446
447
+ assert response .status_code == 400
448
+ assert response_json (response ) == {
449
+ 'errors' : [{'message' : 'The received data is not a valid JSON query.' }]
450
+ }
451
+
452
+
453
+ def test_handles_invalid_json_bodies (client ):
454
+ response = client .post (url_string (), '[oh}' , 'application/json' )
455
+
447
456
assert response .status_code == 400
448
457
assert response_json (response ) == {
449
458
'errors' : [{'message' : 'POST body sent invalid JSON.' }]
0 commit comments