mirror of
https://github.com/progval/irctest.git
synced 2025-04-06 15:29:50 +00:00
Merge pull request #59 from ergochat/master
merge in a new ergo regression test
This commit is contained in:
@ -58,7 +58,6 @@ BASE_CONFIG = {
|
|||||||
},
|
},
|
||||||
"nick-reservation": {
|
"nick-reservation": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"additional-nick-limit": 2,
|
|
||||||
"method": "strict",
|
"method": "strict",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1180,6 +1180,64 @@ class ModeratedMode(cases.BaseServerTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class RegisteredOnlySpeakMode(cases.BaseServerTestCase):
|
||||||
|
run_services = True
|
||||||
|
|
||||||
|
@cases.mark_specifications("Ergo")
|
||||||
|
def testRegisteredOnlySpeakMode(self):
|
||||||
|
self.controller.registerUser(self, "evan", "sesame")
|
||||||
|
|
||||||
|
# test the +M (only registered users and ops can speak) channel mode
|
||||||
|
self.connectClient("chanop", name="chanop")
|
||||||
|
self.joinChannel("chanop", "#chan")
|
||||||
|
self.getMessages("chanop")
|
||||||
|
self.sendLine("chanop", "MODE #chan +M")
|
||||||
|
replies = self.getMessages("chanop")
|
||||||
|
modeLines = [line for line in replies if line.command == "MODE"]
|
||||||
|
self.assertMessageMatch(modeLines[0], command="MODE", params=["#chan", "+M"])
|
||||||
|
|
||||||
|
self.connectClient("baz", name="baz")
|
||||||
|
self.joinChannel("baz", "#chan")
|
||||||
|
self.getMessages("chanop")
|
||||||
|
# this message should be suppressed completely by +M
|
||||||
|
self.sendLine("baz", "PRIVMSG #chan :hi from baz")
|
||||||
|
replies = self.getMessages("baz")
|
||||||
|
reply_cmds = {reply.command for reply in replies}
|
||||||
|
self.assertIn(ERR_CANNOTSENDTOCHAN, reply_cmds)
|
||||||
|
self.assertEqual(self.getMessages("chanop"), [])
|
||||||
|
|
||||||
|
# +v exempts users from the registration requirement:
|
||||||
|
self.sendLine("chanop", "MODE #chan +v baz")
|
||||||
|
self.getMessages("chanop")
|
||||||
|
self.getMessages("baz")
|
||||||
|
self.sendLine("baz", "PRIVMSG #chan :hi again from baz")
|
||||||
|
replies = self.getMessages("baz")
|
||||||
|
# baz should not receive an error (or an echo)
|
||||||
|
self.assertEqual(replies, [])
|
||||||
|
replies = self.getMessages("chanop")
|
||||||
|
self.assertMessageMatch(
|
||||||
|
replies[0], command="PRIVMSG", params=["#chan", "hi again from baz"]
|
||||||
|
)
|
||||||
|
|
||||||
|
self.connectClient(
|
||||||
|
"evan",
|
||||||
|
name="evan",
|
||||||
|
account="evan",
|
||||||
|
password="sesame",
|
||||||
|
capabilities=["sasl"],
|
||||||
|
)
|
||||||
|
self.joinChannel("evan", "#chan")
|
||||||
|
self.getMessages("baz")
|
||||||
|
self.sendLine("evan", "PRIVMSG #chan :hi from evan")
|
||||||
|
replies = self.getMessages("evan")
|
||||||
|
# evan should not receive an error (or an echo)
|
||||||
|
self.assertEqual(replies, [])
|
||||||
|
replies = self.getMessages("baz")
|
||||||
|
self.assertMessageMatch(
|
||||||
|
replies[0], command="PRIVMSG", params=["#chan", "hi from evan"]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class OpModerated(cases.BaseServerTestCase):
|
class OpModerated(cases.BaseServerTestCase):
|
||||||
@cases.mark_specifications("Ergo")
|
@cases.mark_specifications("Ergo")
|
||||||
def testOpModerated(self):
|
def testOpModerated(self):
|
||||||
|
Reference in New Issue
Block a user