Skip to content

Commit

Permalink
optimize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nggit committed Nov 25, 2023
1 parent 53b6305 commit d5db2e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ async def my_response_middleware(**server):
response.set_status(503, b'Under Maintenance')
response.set_content_type(b'text/plain')

return b'Under Maintenance'


@app.route('/getheaderline')
async def get_headerline(**server):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ def test_get_ok_10(self):

self.assertEqual(
header[:header.find(b'\r\n')],
b'HTTP/1.0 503 Under Maintenance'
b'HTTP/1.0 503 Service Unavailable'
)
self.assertTrue(b'\r\nContent-Type: text/plain' in header)
self.assertFalse(chunked_detected(header))
self.assertEqual(body, b'Under Maintenance')

# these values are set by the request and response middleware
self.assertTrue(b'\r\nX-Foo: baz' in header and
Expand Down Expand Up @@ -174,7 +175,7 @@ def test_head_10(self):
version='1.0')

self.assertEqual(header[:header.find(b'\r\n')],
b'HTTP/1.0 503 Under Maintenance')
b'HTTP/1.0 503 Service Unavailable')
self.assertTrue(b'\r\nContent-Length: ' in header)
self.assertTrue(b'\r\nContent-Type: text/plain' in header)
self.assertFalse(b'\r\nTransfer-Encoding: chunked\r\n' in header)
Expand Down

0 comments on commit d5db2e4

Please sign in to comment.