unit test fixes #nolog
This commit is contained in:
@@ -21,7 +21,7 @@ class TestResponse(BaseTestResponse):
|
||||
|
||||
async def _initialize_body(self, res):
|
||||
self.body = b''
|
||||
async for body in res.body_iter():
|
||||
async for body in res.body_iter(): # pragma: no branch
|
||||
if isinstance(body, str):
|
||||
body = body.encode()
|
||||
self.body += body
|
||||
|
||||
@@ -238,14 +238,17 @@ class TestResponse(unittest.TestCase):
|
||||
def test_default_content_type(self):
|
||||
original_content_type = Response.default_content_type
|
||||
res = Response('foo')
|
||||
res.complete()
|
||||
self.assertEqual(res.headers['Content-Type'],
|
||||
'text/plain; charset=UTF-8')
|
||||
Response.default_content_type = 'text/html'
|
||||
res = Response('foo')
|
||||
res.complete()
|
||||
self.assertEqual(res.headers['Content-Type'],
|
||||
'text/html; charset=UTF-8')
|
||||
Response.default_content_type = 'text/html; charset=ISO-8859-1'
|
||||
res = Response('foo')
|
||||
res.complete()
|
||||
self.assertEqual(res.headers['Content-Type'],
|
||||
'text/html; charset=ISO-8859-1')
|
||||
Response.default_content_type = original_content_type
|
||||
|
||||
Reference in New Issue
Block a user