tests: get test_finish_interrupted_request responses content (#36515)
This commit is contained in:
parent
f1b90ce1e2
commit
7a29de02bb
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue