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

Method test_json

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

Source from the content-addressed store, hash-verified

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 = {

Callers

nothing calls this directly

Calls 1

jsonMethod · 0.45

Tested by

no test coverage detected