@@ -184,9 +184,9 @@ def test_batch_allows_post_with_json_encoding(client):
184184
185185
186186def 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' )
188188
189- assert response .status_code == 200
189+ assert response .status_code == 400
190190 assert response_json (response ) == {
191191 'errors' : [{'message' : 'Received an empty list in the batch request.' }]
192192 }
@@ -441,9 +441,18 @@ def test_handles_errors_caused_by_a_lack_of_query(client):
441441 }
442442
443443
444- def test_handles_invalid_json_bodies (client ):
444+ def test_handles_not_expected_json_bodies (client ):
445445 response = client .post (url_string (), '[]' , 'application/json' )
446446
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+
447456 assert response .status_code == 400
448457 assert response_json (response ) == {
449458 'errors' : [{'message' : 'POST body sent invalid JSON.' }]
0 commit comments