Skip to content

Commit

Permalink
fix bytes/str bug in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hodbn committed Aug 14, 2020
1 parent eab8aaf commit a9e4e70
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_lowlevel.py
Expand Up @@ -32,10 +32,11 @@ def test_chunked_upload_uses_only_the_specified_host_header():
text_200 = (b'HTTP/1.1 200 OK\r\n'
b'Content-Length: 0\r\n\r\n')
correct_host = 'sample-host'
expected_host_header = b'Host: sample-host'
def single_host_header_response_handler(sock):
request_content = consume_socket_content(sock, timeout=0.5)
assert 'Host: {}'.format(correct_host) in request_content
assert request_content.count('Host: ') == 1
assert expected_host_header in request_content
assert request_content.count(b'Host: ') == 1
sock.send(text_200)

return request_content
Expand All @@ -50,8 +51,6 @@ def single_host_header_response_handler(sock):
close_server.set() # release server block

assert r.status_code == 200
assert r.request.headers['Transfer-Encoding'] == 'chunked'
assert r.request.headers['Host'] == correct_host


def test_digestauth_401_count_reset_on_redirect():
Expand Down

0 comments on commit a9e4e70

Please sign in to comment.