Add testBanList

This commit is contained in:
2021-09-04 21:08:06 +02:00
committed by Val Lorentz
parent 3b96b5992c
commit 39587c3c49

View File

@ -1,9 +1,10 @@
from irctest import cases from irctest import cases
from irctest.numerics import ERR_BANNEDFROMCHAN from irctest.numerics import ERR_BANNEDFROMCHAN, RPL_BANLIST, RPL_ENDOFBANLIST
from irctest.patma import ANYSTR, StrRe
class BanModeTestCase(cases.BaseServerTestCase): class BanModeTestCase(cases.BaseServerTestCase):
@cases.mark_specifications("RFC1459", "RFC2812") @cases.mark_specifications("RFC1459", "RFC2812", "Modern")
def testBan(self): def testBan(self):
"""Basic ban operation""" """Basic ban operation"""
self.connectClient("chanop", name="chanop") self.connectClient("chanop", name="chanop")
@ -23,6 +24,52 @@ class BanModeTestCase(cases.BaseServerTestCase):
self.sendLine("bar", "JOIN #chan") self.sendLine("bar", "JOIN #chan")
self.assertMessageMatch(self.getMessage("bar"), command="JOIN") self.assertMessageMatch(self.getMessage("bar"), command="JOIN")
@cases.mark_specifications("Modern")
def testBanList(self):
"""https://github.com/ircdocs/modern-irc/pull/125"""
self.connectClient("chanop")
self.joinChannel(1, "#chan")
self.getMessages(1)
self.sendLine(1, "MODE #chan +b bar!*@*")
self.assertMessageMatch(self.getMessage(1), command="MODE")
self.sendLine(1, "MODE #chan +b")
m = self.getMessage(1)
if len(m.params) == 3:
# Old format
self.assertMessageMatch(
m,
command=RPL_BANLIST,
params=[
"chanop",
"#chan",
"bar!*@*",
],
)
else:
self.assertMessageMatch(
m,
command=RPL_BANLIST,
params=[
"chanop",
"#chan",
"bar!*@*",
StrRe("chanop(!.*@.*)?"),
StrRe("[0-9]+"),
],
)
self.assertMessageMatch(
self.getMessage(1),
command=RPL_ENDOFBANLIST,
params=[
"chanop",
"#chan",
ANYSTR,
],
)
@cases.mark_specifications("Ergo") @cases.mark_specifications("Ergo")
def testCaseInsensitive(self): def testCaseInsensitive(self):
"""Some clients allow unsetting modes if their argument matches """Some clients allow unsetting modes if their argument matches