(caplog_async)
| 323 | |
| 324 | |
| 325 | async def test_udp_start_stop(caplog_async): |
| 326 | caplog_async.set_level("INFO") |
| 327 | manager = MagicMock() |
| 328 | manager.connections = {} |
| 329 | |
| 330 | with taddons.context(): |
| 331 | inst = ServerInstance.make("dns@127.0.0.1:0", manager) |
| 332 | await inst.start() |
| 333 | assert await caplog_async.await_log("server listening") |
| 334 | |
| 335 | host, port, *_ = inst.listen_addrs[0] |
| 336 | stream = await mitmproxy_rs.udp.open_udp_connection(host, port) |
| 337 | |
| 338 | stream.write(b"\x00\x00\x01") |
| 339 | assert await caplog_async.await_log("sent an invalid message") |
| 340 | |
| 341 | stream.close() |
| 342 | await stream.wait_closed() |
| 343 | |
| 344 | await inst.stop() |
| 345 | assert await caplog_async.await_log("stopped") |
| 346 | |
| 347 | |
| 348 | async def test_udp_start_error(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…