mirror of
https://github.com/progval/irctest.git
synced 2025-04-04 22:39:50 +00:00
move no-CTCP channel mode test (#232)
This commit is contained in:
committed by
GitHub
parent
c3aa97c428
commit
e1ff9fd7fe
31
irctest/server_tests/chmodes/no_ctcp.py
Normal file
31
irctest/server_tests/chmodes/no_ctcp.py
Normal file
@ -0,0 +1,31 @@
|
||||
from irctest import cases
|
||||
from irctest.numerics import ERR_CANNOTSENDTOCHAN
|
||||
|
||||
|
||||
class NoCTCPChannelModeTestCase(cases.BaseServerTestCase):
|
||||
@cases.mark_specifications("Ergo")
|
||||
def testNoCTCPChannelMode(self):
|
||||
"""Test Ergo's +C channel mode that blocks CTCPs."""
|
||||
self.connectClient("bar")
|
||||
self.joinChannel(1, "#chan")
|
||||
self.sendLine(1, "MODE #chan +C")
|
||||
self.getMessages(1)
|
||||
|
||||
self.connectClient("qux")
|
||||
self.joinChannel(2, "#chan")
|
||||
self.getMessages(2)
|
||||
|
||||
self.sendLine(1, "PRIVMSG #chan :\x01ACTION hi\x01")
|
||||
self.getMessages(1)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageMatch(
|
||||
ms[0], command="PRIVMSG", params=["#chan", "\x01ACTION hi\x01"]
|
||||
)
|
||||
|
||||
self.sendLine(1, "PRIVMSG #chan :\x01PING 1473523796 918320\x01")
|
||||
ms = self.getMessages(1)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageMatch(ms[0], command=ERR_CANNOTSENDTOCHAN)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(ms, [])
|
@ -10,7 +10,6 @@ TODO: cross-reference RFC 1459 and Modern
|
||||
import time
|
||||
|
||||
from irctest import cases
|
||||
from irctest.numerics import ERR_CANNOTSENDTOCHAN
|
||||
from irctest.patma import StrRe
|
||||
|
||||
|
||||
@ -40,31 +39,3 @@ class ChannelQuitTestCase(cases.BaseServerTestCase):
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageMatch(m, command="QUIT", params=[StrRe(".*qux out.*")])
|
||||
self.assertTrue(m.prefix.startswith("qux")) # nickmask of quitter
|
||||
|
||||
|
||||
class NoCTCPTestCase(cases.BaseServerTestCase):
|
||||
@cases.mark_specifications("Ergo")
|
||||
def testQuit(self):
|
||||
self.connectClient("bar")
|
||||
self.joinChannel(1, "#chan")
|
||||
self.sendLine(1, "MODE #chan +C")
|
||||
self.getMessages(1)
|
||||
|
||||
self.connectClient("qux")
|
||||
self.joinChannel(2, "#chan")
|
||||
self.getMessages(2)
|
||||
|
||||
self.sendLine(1, "PRIVMSG #chan :\x01ACTION hi\x01")
|
||||
self.getMessages(1)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageMatch(
|
||||
ms[0], command="PRIVMSG", params=["#chan", "\x01ACTION hi\x01"]
|
||||
)
|
||||
|
||||
self.sendLine(1, "PRIVMSG #chan :\x01PING 1473523796 918320\x01")
|
||||
ms = self.getMessages(1)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageMatch(ms[0], command=ERR_CANNOTSENDTOCHAN)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(ms, [])
|
||||
|
Reference in New Issue
Block a user