Skip to content

Commit aee70e8

Browse files
committed
testLineTooLong: Also check with an egregiously long line
1 parent e3485b9 commit aee70e8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

irctest/server_tests/messages.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
The PRIVMSG and NOTICE commands.
33
"""
44

5+
import pytest
6+
57
from irctest import cases
68
from irctest.numerics import ERR_INPUTTOOLONG
79
from irctest.patma import ANYSTR
@@ -123,26 +125,29 @@ def testNoticeNonexistentChannel(self):
123125

124126

125127
class TagsTestCase(cases.BaseServerTestCase):
128+
@pytest.mark.parametrize("tag_length", [4096, 10000])
126129
@cases.mark_capabilities("message-tags")
127130
@cases.xfailIf(
128-
lambda self: bool(
131+
lambda self, tag_length: bool(
129132
self.controller.software_name == "UnrealIRCd"
130133
and self.controller.software_version == 5
131134
),
132135
"UnrealIRCd <6.0.7 dropped messages with excessively large tags: "
133136
"https://bugs.unrealircd.org/view.php?id=5947",
134137
)
135-
def testLineTooLong(self):
138+
def testLineTooLong(self, tag_length):
136139
self.connectClient("bar", capabilities=["message-tags"], skip_if_cap_nak=True)
137140
self.connectClient(
138141
"recver", capabilities=["message-tags"], skip_if_cap_nak=True
139142
)
140143
self.joinChannel(1, "#xyz")
141-
monsterMessage = "@+clientOnlyTagExample=" + "a" * 4096 + " PRIVMSG #xyz hi!"
144+
145+
monsterMessage = "@+clientOnlyTagExample=" + "a" * tag_length + " PRIVMSG #xyz hi!"
142146
self.sendLine(1, monsterMessage)
143147
self.assertEqual(self.getMessages(2), [], "overflowing message was relayed")
144148
replies = self.getMessages(1)
145-
self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies))
149+
if len(replies) > 0:
150+
self.assertIn(ERR_INPUTTOOLONG, set(reply.command for reply in replies))
146151

147152

148153
class LengthLimitTestCase(cases.BaseServerTestCase):

0 commit comments

Comments
 (0)