mirror of
https://github.com/progval/irctest.git
synced 2025-04-05 06:49:47 +00:00
Add testBanList
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
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):
|
||||
@cases.mark_specifications("RFC1459", "RFC2812")
|
||||
@cases.mark_specifications("RFC1459", "RFC2812", "Modern")
|
||||
def testBan(self):
|
||||
"""Basic ban operation"""
|
||||
self.connectClient("chanop", name="chanop")
|
||||
@ -23,6 +24,52 @@ class BanModeTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine("bar", "JOIN #chan")
|
||||
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")
|
||||
def testCaseInsensitive(self):
|
||||
"""Some clients allow unsetting modes if their argument matches
|
||||
|
Reference in New Issue
Block a user