File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -457,14 +457,18 @@ def test_handles_invalid_json_bodies(client):
457457 }
458458
459459
460- def test_handles_django_request_error (client , settings ):
461- settings .DATA_UPLOAD_MAX_MEMORY_SIZE = 1000
462- valid_json = json .dumps (dict (test = 'x' * 1000 ))
460+ def test_handles_django_request_error (client , monkeypatch ):
461+ def mocked_read (* args ):
462+ raise IOError ("foo-bar" )
463+
464+ monkeypatch .setattr ("django.http.request.HttpRequest.read" , mocked_read )
465+
466+ valid_json = json .dumps (dict (foo = 'bar' ))
463467 response = client .post (url_string (), valid_json , 'application/json' )
464468
465469 assert response .status_code == 400
466470 assert response_json (response ) == {
467- 'errors' : [{'message' : 'Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE. ' }]
471+ 'errors' : [{'message' : 'foo-bar ' }]
468472 }
469473
470474
You can’t perform that action at this time.
0 commit comments