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

Method test_static_handle_eof

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

Source from the content-addressed store, hash-verified

577 self.router.add_route('INVALID_METHOD', '/path', handler)
578
579 def test_static_handle_eof(self):
580 loop = mock.Mock()
581 route = self.router.add_static('/st',
582 os.path.dirname(aiohttp.__file__))
583 with mock.patch('aiohttp.web_urldispatcher.os') as m_os:
584 out_fd = 30
585 in_fd = 31
586 fut = asyncio.Future(loop=self.loop)
587 m_os.sendfile.return_value = 0
588 route._sendfile_cb(fut, out_fd, in_fd, 0, 100, loop, False)
589 m_os.sendfile.assert_called_with(out_fd, in_fd, 0, 100)
590 self.assertTrue(fut.done())
591 self.assertIsNone(fut.result())
592 self.assertFalse(loop.add_writer.called)
593 self.assertFalse(loop.remove_writer.called)
594
595 def test_static_handle_again(self):
596 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