mirror of
https://github.com/progval/irctest.git
synced 2025-04-07 15:59:49 +00:00
test no-CTCP mode
This commit is contained in:
@ -132,3 +132,32 @@ class AwayTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(2, "PRIVMSG bar :what's up")
|
||||
replies = self.getMessages(2)
|
||||
self.assertEqual(len(replies), 0)
|
||||
|
||||
class TestNoCTCPMode(cases.BaseServerTestCase):
|
||||
|
||||
@cases.SpecificationSelector.requiredBySpecification('Oragono')
|
||||
def testNoCTCPMode(self):
|
||||
self.connectClient('bar', 'bar')
|
||||
self.connectClient('qux', 'qux')
|
||||
# CTCP is not blocked by default:
|
||||
self.sendLine('qux', 'PRIVMSG bar :\x01VERSION\x01')
|
||||
self.getMessages('qux')
|
||||
relay = [msg for msg in self.getMessages('bar') if msg.command == 'PRIVMSG'][0]
|
||||
self.assertEqual(relay.params[-1], '\x01VERSION\x01')
|
||||
|
||||
# set the no-CTCP user mode on bar:
|
||||
self.sendLine('bar', 'MODE bar +T')
|
||||
replies = self.getMessages('bar')
|
||||
umode_line = [msg for msg in replies if msg.command == 'MODE'][0]
|
||||
self.assertMessageEqual(umode_line, command='MODE', params=['bar', '+T'])
|
||||
|
||||
# CTCP is now blocked:
|
||||
self.sendLine('qux', 'PRIVMSG bar :\x01VERSION\x01')
|
||||
self.getMessages('qux')
|
||||
self.assertEqual(self.getMessages('bar'), [])
|
||||
|
||||
# normal PRIVMSG go through:
|
||||
self.sendLine('qux', 'PRIVMSG bar :please just tell me your client version')
|
||||
self.getMessages('qux')
|
||||
relay = self.getMessages('bar')[0]
|
||||
self.assertMessageEqual(relay, command='PRIVMSG', nick='qux', params=['bar', 'please just tell me your client version'])
|
||||
|
Reference in New Issue
Block a user