|
2 | 2 | The PRIVMSG and NOTICE commands. |
3 | 3 | """ |
4 | 4 |
|
| 5 | +import pytest |
| 6 | + |
5 | 7 | from irctest import cases |
6 | 8 | from irctest.numerics import ERR_INPUTTOOLONG |
7 | 9 | from irctest.patma import ANYSTR |
@@ -123,26 +125,31 @@ def testNoticeNonexistentChannel(self): |
123 | 125 |
|
124 | 126 |
|
125 | 127 | class TagsTestCase(cases.BaseServerTestCase): |
| 128 | + @pytest.mark.parametrize("tag_length", [4096, 10000]) |
126 | 129 | @cases.mark_capabilities("message-tags") |
127 | 130 | @cases.xfailIf( |
128 | | - lambda self: bool( |
| 131 | + lambda self, tag_length: bool( |
129 | 132 | self.controller.software_name == "UnrealIRCd" |
130 | 133 | and self.controller.software_version == 5 |
131 | 134 | ), |
132 | 135 | "UnrealIRCd <6.0.7 dropped messages with excessively large tags: " |
133 | 136 | "https://bugs.unrealircd.org/view.php?id=5947", |
134 | 137 | ) |
135 | | - def testLineTooLong(self): |
| 138 | + def testLineTooLong(self, tag_length): |
136 | 139 | self.connectClient("bar", capabilities=["message-tags"], skip_if_cap_nak=True) |
137 | 140 | self.connectClient( |
138 | 141 | "recver", capabilities=["message-tags"], skip_if_cap_nak=True |
139 | 142 | ) |
140 | 143 | self.joinChannel(1, "#xyz") |
141 | | - monsterMessage = "@+clientOnlyTagExample=" + "a" * 4096 + " PRIVMSG #xyz hi!" |
| 144 | + |
| 145 | + monsterMessage = ( |
| 146 | + "@+clientOnlyTagExample=" + "a" * tag_length + " PRIVMSG #xyz hi!" |
| 147 | + ) |
142 | 148 | self.sendLine(1, monsterMessage) |
143 | 149 | self.assertEqual(self.getMessages(2), [], "overflowing message was relayed") |
144 | 150 | replies = self.getMessages(1) |
145 | | - self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies)) |
| 151 | + if len(replies) > 0: |
| 152 | + self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies)) |
146 | 153 |
|
147 | 154 |
|
148 | 155 | class LengthLimitTestCase(cases.BaseServerTestCase): |
|
0 commit comments