Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hubo1016 committed May 26, 2017
1 parent 1ac84a2 commit 534c8d8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_web_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,23 @@ def write_headers(status_line, headers):
assert resp.content_length == 123


@asyncio.coroutine
def test_force_compression_identity_response():
writer = mock.Mock()

def write_headers(status_line, headers):
assert headers[hdrs.CONTENT_LENGTH] == "6"
assert hdrs.TRANSFER_ENCODING not in headers

writer.write_headers.side_effect = write_headers
req = make_request('GET', '/',
payload_writer=writer)
resp = Response(body=b'answer')
resp.enable_compression(ContentCoding.identity)
yield from resp.prepare(req)
assert resp.content_length == 6


@asyncio.coroutine
def test_remove_content_length_if_compression_enabled_on_payload_http11():
writer = mock.Mock()
Expand Down

0 comments on commit 534c8d8

Please sign in to comment.