(make_srv)
| 282 | |
| 283 | |
| 284 | def test_handle_error_traceback_exc(make_srv): |
| 285 | log = mock.Mock() |
| 286 | srv = make_srv(debug=True, logger=log) |
| 287 | srv.transport = mock.Mock() |
| 288 | srv.transport.get_extra_info.return_value = '127.0.0.1' |
| 289 | srv.writer = mock.Mock() |
| 290 | srv._request_handler = mock.Mock() |
| 291 | |
| 292 | with mock.patch('aiohttp.server.traceback') as m_trace: |
| 293 | m_trace.format_exc.side_effect = ValueError |
| 294 | |
| 295 | srv.handle_error(500, exc=object()) |
| 296 | |
| 297 | content = b''.join( |
| 298 | [c[1][0] for c in list(srv.writer.write.mock_calls)]) |
| 299 | assert content.startswith(b'HTTP/1.1 500 Internal Server Error') |
| 300 | assert log.exception.called |
| 301 | |
| 302 | |
| 303 | def test_handle_error_debug(srv): |
nothing calls this directly
no test coverage detected