Skip to content

Commit

Permalink
Check for log warning record
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jul 14, 2014
1 parent 343bbd3 commit 29a52c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,18 @@ def custom(content):
res = self.loop.run_until_complete(self.response.json(loads=custom))
self.assertEqual(res, 'data-custom')

def test_json_no_content(self):
@unittest.mock.patch('aiohttp.client.client_log')
def test_json_no_content(self, m_log):
self.response.headers = {
'CONTENT-TYPE': 'data/octet-stream'}
self.response._content = b''
self.response.close = unittest.mock.Mock()

res = self.loop.run_until_complete(self.response.json())
self.assertIsNone(res)
m_log.warning.assert_called_with(
'Attempt to decode JSON with unexpected mimetype: %s',
'data/octet-stream')

def test_json_override_encoding(self):
def side_effect(*args, **kwargs):
Expand Down

0 comments on commit 29a52c3

Please sign in to comment.