MCPcopy
hub / github.com/caronc/apprise / test_plugin_irc_client_join

Function test_plugin_irc_client_join

tests/test_plugin_irc.py:524–553  ·  view source on GitHub ↗

IRCClient join timeout path.

()

Source from the content-addressed store, hash-verified

522
523
524def test_plugin_irc_client_join() -> None:
525 """IRCClient join timeout path."""
526 client = IRCClient(
527 host="irc.example.com",
528 nickname="nick",
529 fullname="full",
530 )
531 client.transport = _DummyTransport()
532
533 # join() calls monotonic frequently; use a callable so we never exhaust
534 # a finite side_effect list.
535 calls = {"n": 0}
536
537 def _mono() -> float:
538 calls["n"] += 1
539 # Stay below deadline long enough to exercise the loop, then exceed it.
540 return 0.0 if calls["n"] < 2000 else 1.0
541
542 with (
543 mock.patch.object(client, "_flush") as m_flush,
544 mock.patch.object(client, "_handshake") as m_hs,
545 mock.patch("time.monotonic", side_effect=_mono),
546 ):
547 client.join(channel="#chan", timeout=0.01, prefix="ap", key=None)
548 assert m_flush.called
549 assert m_hs.called
550
551 with mock.patch.object(client, "_write") as m_write:
552 client.quit(message="bye", timeout=0.1)
553 assert m_write.called
554
555
556def test_plugin_irc_protocol_parse_blank_line() -> None:

Callers

nothing calls this directly

Calls 4

joinMethod · 0.95
quitMethod · 0.95
IRCClientClass · 0.90
_DummyTransportClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…