tests: get test_finish_interrupted_request responses content (#36515)

This commit is contained in:
Frédéric Péters 2019-11-19 14:34:17 +01:00
parent 3e78ff2e19
commit 6b07387ad4
1 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ from django.core.management.base import CommandError
from django.http import Http404
from django.test import override_settings
from django.utils import six
from django.utils.encoding import force_text
from django.utils.six import BytesIO, StringIO
from quixote import cleanup
from wcs.qommon import get_publisher_class
@ -106,7 +107,7 @@ def test_finish_interrupted_request():
'CONTENT_LENGTH': 'aaa',
})
response = pub.process_request(req)
assert 'invalid content-length header' in str(response)
assert b'invalid content-length header' in response.getvalue()
req = HTTPRequest(StringIO(''), {
'SERVER_NAME': 'example.net',
'SCRIPT_NAME': '',
@ -114,7 +115,7 @@ def test_finish_interrupted_request():
'CONTENT_LENGTH': '1',
})
response = pub.process_request(req)
assert 'Invalid request: unexpected end of request body' in str(response)
assert b'Invalid request: unexpected end of request body' in response.getvalue()
req = HTTPRequest(StringIO(''), {
'SERVER_NAME': 'example.net',
'SCRIPT_NAME': '',
@ -122,7 +123,7 @@ def test_finish_interrupted_request():
'CONTENT_LENGTH': '1',
})
response = pub.process_request(req)
assert 'Invalid request: multipart/form-data missing boundary' in str(response)
assert b'Invalid request: multipart/form-data missing boundary' in response.getvalue()
with pytest.raises(Http404):
req = HTTPRequest(StringIO(''), {
'SERVER_NAME': 'example.net',