home · contact · privacy
For test file, allow (ignore) empty and #-prefixed lines.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 15 Sep 2025 21:01:48 +0000 (23:01 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 15 Sep 2025 21:01:48 +0000 (23:01 +0200)
ircplom/client.py
ircplom/testing.py
test.txt

index 8e8e760ea02b9920792e26380ea175edaae955dd..508e382c32cfd25b9af9c9cb6b2e027f679f9ad1 100644 (file)
@@ -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:
index dbcee353e400f88b174480c6e8bd473c95ad977d..f57c59fbd6d8e74470caf0c1340469a0f2844ba4 100644 (file)
@@ -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
index b642653e8d4e389c9a6db95a013464ab7566fdab..bb26b2657e7997870e476fac0c172f5e7bc9506e 100644 (file)
--- a/test.txt
+++ b/test.txt
 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
 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: []
 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)
 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! -
 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
 0 #   2) foo.bar.baz :RAW
 0 #   3) foo.bar.baz SaslServ
 > /window 1
+
 > /disconnect
 1,2 $ requesting disconnect …
 2 > QUIT :ircplom says bye