| 112 | self.assertTrue(self.response.json.called) |
| 113 | |
| 114 | def test_text(self): |
| 115 | def side_effect(*args, **kwargs): |
| 116 | fut = asyncio.Future(loop=self.loop) |
| 117 | fut.set_result('{"тест": "пройден"}'.encode('cp1251')) |
| 118 | return fut |
| 119 | self.response.headers = { |
| 120 | 'CONTENT-TYPE': 'application/json;charset=cp1251'} |
| 121 | content = self.response.content = unittest.mock.Mock() |
| 122 | content.read.side_effect = side_effect |
| 123 | |
| 124 | res = self.loop.run_until_complete(self.response.text()) |
| 125 | self.assertEqual(res, '{"тест": "пройден"}') |
| 126 | self.assertIsNone(self.response._connection) |
| 127 | |
| 128 | def test_text_custom_encoding(self): |
| 129 | def side_effect(*args, **kwargs): |