From: Christian Heller Date: Mon, 15 Sep 2025 21:01:48 +0000 (+0200) Subject: For test file, allow (ignore) empty and #-prefixed lines. X-Git-Url: https://plomlompom.com/repos/do_todos?a=commitdiff_plain;h=050be1babda06822d5bcb14fb779aa376de18c56;p=ircplom For test file, allow (ignore) empty and #-prefixed lines. --- diff --git a/ircplom/client.py b/ircplom/client.py index 8e8e760..508e382 100644 --- a/ircplom/client.py +++ b/ircplom/client.py @@ -735,6 +735,7 @@ class Client(ABC, ClientQueueMixin): self.db.port = PORT_SSL def start_connecting(self) -> None: + 'Start thread establishing connection, then triggering ._on_connect.' def connect(self) -> None: try: diff --git a/ircplom/testing.py b/ircplom/testing.py index dbcee35..f57c59f 100644 --- a/ircplom/testing.py +++ b/ircplom/testing.py @@ -123,13 +123,17 @@ class TestingClientTui(ClientTui): while True: self._playbook_idx += 1 line = self._playbook[self._playbook_idx] + if not line.strip(): + continue context, msg = line.split(' ', maxsplit=1) + if context == '#': + continue if context == '>': for c in msg: self._q_keypresses.put(c) self._q_keypresses.put('KEY_ENTER') - else: - if context == '2' and msg[:2] == '< ': - assert isinstance(self._client.conn, _FakeIrcConnection) - self._client.conn.put_server_msg(msg[2:]) - break + continue + if context == '2' and msg[:2] == '< ': + assert isinstance(self._client.conn, _FakeIrcConnection) + self._client.conn.put_server_msg(msg[2:]) + break diff --git a/test.txt b/test.txt index b642653..bb26b26 100644 --- a/test.txt +++ b/test.txt @@ -11,9 +11,11 @@ 0 # /window.prompt.backspace 0 # /window.prompt.move_cursor DIRECTION 0 # /window.prompt.scroll DIRECTION + > /list 0 # windows available via /window: 0 # 0) :start + > /connect foo.bar.baz foo:bar baz 1,2 $ caps cleared 1,2 $ caps cleared @@ -30,22 +32,29 @@ 1,2 $ users:me:user set to: [plom] 1,2 $ connection_state set to: [connected] 1,2 $ caps cleared + 2 > CAP LS :302 2 > USER plom 0 * :baz 2 > NICK :foo + 2 < :*.?.net NOTICE * :*** Looking up your ident... 1,2 $$$ *** Looking up your ident... 2 < :*.?.net NOTICE * :*** Looking up your hostname... 1,2 $$$ *** Looking up your hostname... 2 < :*.?.net NOTICE * :*** Found your hostname (baz.bar.foo) 1,2 $$$ *** Found your hostname (baz.bar.foo) + 2 < :*.?.net CAP * LS : foo bar sasl=PLAIN,EXTERNAL baz + 1,2 $ isupport:CHANTYPES set to: [#&] 1,2 $ isupport:PREFIX set to: [(ov)@+] + 2 > CAP REQ :sasl 2 > CAP :LIST + 2 < PING :? 2 > PONG :? + 2 < :*.?.net CAP ? ACK :sasl 2 < :*.?.net CAP ? LIST :cap-notify sasl 1,2 $ caps:bar:data set to: [] @@ -54,21 +63,27 @@ 1,2 $ caps:sasl:data set to: [] 1,2 $ caps:sasl:data set to: [PLAIN,EXTERNAL] 1,2 $ caps:sasl:enabled set to: [True] + 1,2 $ sasl_auth_state set to: [attempting] 2 > AUTHENTICATE :PLAIN 2 < AUTHENTICATE + 2 > AUTHENTICATE :Zm9vAGZvbwBiYXI= 2 < :foo.bar.baz 900 foo foo!plom@baz.bar.foo foo :You are now logged in as foo + 1,2 $ ?!plom@? renames foo 1,2 $ users:me:host set to: [baz.bar.foo] + 1,2 $ sasl_account set to: [foo] 2 < :foo.bar.baz 903 foo :SASL authentication successful 1,2 $ sasl_auth_state set to: [SASL authentication successful] + 2 > CAP :END + 2 < :foo.bar.baz 001 foo :Welcome to the foo.bar.baz network 2 < :foo.bar.baz 002 foo :Your host is foo.bar.baz 2 < :foo.bar.baz 003 foo :This server was created Jan 1 2020 2 < :foo.bar.baz 004 foo foo.bar.baz ircserver-1.0 abc def ghi + 2 < :foo.bar.baz 005 foo ABC=DEF GHI=JKL :are supported by this server 1,2 $ isupport:ABC set to: [DEF] 1,2 $ isupport:GHI set to: [JKL] @@ -76,6 +91,7 @@ 1,2 $ isupport:MNO set to: [PQR] 1,2 $ isupport:STU set to: [VWX] 1,2 $ isupport:Y set to: [Z] + 2 < :foo.bar.baz 251 foo :There are 10 users and 1000 invisible on 5 servers 2 < :foo.bar.baz 252 foo 7 :IRC Operators online 2 < :foo.bar.baz 253 foo 4 :unknown connection(s) @@ -84,6 +100,7 @@ 2 < :foo.bar.baz 265 foo 100 150 :Current local users 100, max 150 2 < :foo.bar.baz 266 foo 1010 1050 :Current global users 1010, max 1050 2 < :foo.bar.baz 250 foo :Highest connection count: 151 (150 clients) (1080 connections received) + 2 < :foo.bar.baz 375 foo :- foo.bar.baz Message of the Day - 2 < :foo.bar.baz 372 foo :- Howdy! - 2 < :foo.bar.baz 372 foo :- Welcome! - @@ -93,12 +110,16 @@ 1,2 $ - Howdy! - 1,2 $ - Welcome! - 1,2 $ - (to this server) - + 2 < :foo MODE foo :+Ziw 1,2 $ users:me:modes set to: [+Ziw] + 2 < :SaslServ!SaslServ@services.bar.baz NOTICE foo :Last login from ~plom@foo.bar.baz on Jan 1 22:00:00 2021 +0000. 3 <<< [SaslServ] Last login from ~plom@foo.bar.baz on Jan 1 22:00:00 2021 +0000. + > /disconnect 0 !# invalid prompt command: /disconnect unknown + > /list 0 # windows available via /window: 0 # 0) :start @@ -106,6 +127,7 @@ 0 # 2) foo.bar.baz :RAW 0 # 3) foo.bar.baz SaslServ > /window 1 + > /disconnect 1,2 $ requesting disconnect … 2 > QUIT :ircplom says bye