tests: get test_finish_interrupted_request responses content (#36515)
This commit is contained in:
parent
3e78ff2e19
commit
6b07387ad4
|
@ -15,6 +15,7 @@ from django.core.management.base import CommandError
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.test import override_settings
|
from django.test import override_settings
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.six import BytesIO, StringIO
|
from django.utils.six import BytesIO, StringIO
|
||||||
from quixote import cleanup
|
from quixote import cleanup
|
||||||
from wcs.qommon import get_publisher_class
|
from wcs.qommon import get_publisher_class
|
||||||
|
@ -106,7 +107,7 @@ def test_finish_interrupted_request():
|
||||||
'CONTENT_LENGTH': 'aaa',
|
'CONTENT_LENGTH': 'aaa',
|
||||||
})
|
})
|
||||||
response = pub.process_request(req)
|
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(''), {
|
req = HTTPRequest(StringIO(''), {
|
||||||
'SERVER_NAME': 'example.net',
|
'SERVER_NAME': 'example.net',
|
||||||
'SCRIPT_NAME': '',
|
'SCRIPT_NAME': '',
|
||||||
|
@ -114,7 +115,7 @@ def test_finish_interrupted_request():
|
||||||
'CONTENT_LENGTH': '1',
|
'CONTENT_LENGTH': '1',
|
||||||
})
|
})
|
||||||
response = pub.process_request(req)
|
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(''), {
|
req = HTTPRequest(StringIO(''), {
|
||||||
'SERVER_NAME': 'example.net',
|
'SERVER_NAME': 'example.net',
|
||||||
'SCRIPT_NAME': '',
|
'SCRIPT_NAME': '',
|
||||||
|
@ -122,7 +123,7 @@ def test_finish_interrupted_request():
|
||||||
'CONTENT_LENGTH': '1',
|
'CONTENT_LENGTH': '1',
|
||||||
})
|
})
|
||||||
response = pub.process_request(req)
|
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):
|
with pytest.raises(Http404):
|
||||||
req = HTTPRequest(StringIO(''), {
|
req = HTTPRequest(StringIO(''), {
|
||||||
'SERVER_NAME': 'example.net',
|
'SERVER_NAME': 'example.net',
|
||||||
|
|
Loading…
Reference in New Issue