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

Method test_static_handle_again

tests/test_urldispatch.py:595–610  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

593 self.assertFalse(loop.remove_writer.called)
594
595 def test_static_handle_again(self):
596 loop = mock.Mock()
597 route = self.router.add_static('/st',
598 os.path.dirname(aiohttp.__file__))
599 with mock.patch('aiohttp.web_urldispatcher.os') as m_os:
600 out_fd = 30
601 in_fd = 31
602 fut = asyncio.Future(loop=self.loop)
603 m_os.sendfile.side_effect = BlockingIOError()
604 route._sendfile_cb(fut, out_fd, in_fd, 0, 100, loop, False)
605 m_os.sendfile.assert_called_with(out_fd, in_fd, 0, 100)
606 self.assertFalse(fut.done())
607 loop.add_writer.assert_called_with(out_fd, route._sendfile_cb,
608 fut, out_fd, in_fd, 0, 100,
609 loop, True)
610 self.assertFalse(loop.remove_writer.called)
611
612 def test_static_handle_exception(self):
613 loop = mock.Mock()

Callers

nothing calls this directly

Calls 3

add_staticMethod · 0.80
patchMethod · 0.80
_sendfile_cbMethod · 0.80

Tested by

no test coverage detected