MCPcopy
hub / github.com/aio-libs/aiohttp / test_text

Method test_text

tests/test_client_response.py:114–126  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 1

textMethod · 0.45

Tested by

no test coverage detected