mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Use more pytest.raises() in test_http.py
Signed-off-by: Berker Peksag <berker.peksag@gmail.com>
This commit is contained in:
parent
5b32dde3ef
commit
33924a8649
@ -81,21 +81,16 @@ def test_http_header_encoding():
|
||||
|
||||
# set umlaut header
|
||||
response.headers.append(('foo', 'häder'))
|
||||
try:
|
||||
with pytest.raises(UnicodeEncodeError):
|
||||
response.send_headers()
|
||||
except Exception as e:
|
||||
assert isinstance(e, UnicodeEncodeError)
|
||||
|
||||
|
||||
# build our own header_str to compare against
|
||||
tosend = response.default_headers()
|
||||
tosend.extend(["%s: %s\r\n" % (k, v) for k, v in response.headers])
|
||||
header_str = "%s\r\n" % "".join(tosend)
|
||||
|
||||
try:
|
||||
with pytest.raises(UnicodeEncodeError):
|
||||
mocked_socket.sendall(util.to_bytestring(header_str,"ascii"))
|
||||
except Exception as e:
|
||||
assert isinstance(e, UnicodeEncodeError)
|
||||
|
||||
|
||||
def test_http_inalid_response_header():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user