| 171 | self.assertIsNone(self.response._connection) |
| 172 | |
| 173 | def test_json(self): |
| 174 | def side_effect(*args, **kwargs): |
| 175 | fut = asyncio.Future(loop=self.loop) |
| 176 | fut.set_result('{"тест": "пройден"}'.encode('cp1251')) |
| 177 | return fut |
| 178 | self.response.headers = { |
| 179 | 'CONTENT-TYPE': 'application/json;charset=cp1251'} |
| 180 | content = self.response.content = unittest.mock.Mock() |
| 181 | content.read.side_effect = side_effect |
| 182 | |
| 183 | res = self.loop.run_until_complete(self.response.json()) |
| 184 | self.assertEqual(res, {'тест': 'пройден'}) |
| 185 | self.assertIsNone(self.response._connection) |
| 186 | |
| 187 | def test_json_custom_loader(self): |
| 188 | self.response.headers = { |