mirror of
https://github.com/progval/irctest.git
synced 2025-04-05 06:49:47 +00:00
Compare commits
2 Commits
ca0fd7e463
...
join-key
Author | SHA1 | Date | |
---|---|---|---|
e90b14a44b | |||
739d459017 |
@ -200,3 +200,78 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
fail_msg="Expected 1 error when joining channels '#valid' and 'inv@lid', "
|
||||
"got {got}",
|
||||
)
|
||||
|
||||
@cases.mark_specifications("RFC1459", "RFC2812", "Modern")
|
||||
def testJoinKey(self):
|
||||
"""Joins a single channel with a key"""
|
||||
self.connectClient("chanop")
|
||||
self.joinChannel(1, "#chan")
|
||||
self.sendLine(1, "MODE #chan +k key")
|
||||
self.getMessages(1)
|
||||
|
||||
self.connectClient("joiner")
|
||||
self.sendLine(2, "JOIN #chan key")
|
||||
self.assertMessageMatch(
|
||||
self.getMessage(2),
|
||||
command="JOIN",
|
||||
params=["#chan"],
|
||||
)
|
||||
|
||||
@cases.mark_specifications("RFC1459", "RFC2812", "Modern")
|
||||
def testJoinKeys(self):
|
||||
"""Joins two channels, both with keys"""
|
||||
self.connectClient("chanop")
|
||||
if self.targmax.get("JOIN", "1000") == "1":
|
||||
raise runner.OptionalExtensionNotSupported("Multi-target JOIN")
|
||||
self.joinChannel(1, "#chan1")
|
||||
self.sendLine(1, "MODE #chan1 +k key1")
|
||||
self.getMessages(1)
|
||||
self.joinChannel(1, "#chan2")
|
||||
self.sendLine(1, "MODE #chan2 +k key2")
|
||||
self.getMessages(1)
|
||||
|
||||
self.connectClient("joiner")
|
||||
self.sendLine(2, "JOIN #chan1,#chan2 key1,key2")
|
||||
self.assertMessageMatch(
|
||||
self.getMessage(2),
|
||||
command="JOIN",
|
||||
params=["#chan1"],
|
||||
)
|
||||
self.assertMessageMatch(
|
||||
[
|
||||
msg
|
||||
for msg in self.getMessages(2)
|
||||
if msg.command not in {RPL_NAMREPLY, RPL_ENDOFNAMES}
|
||||
][0],
|
||||
command="JOIN",
|
||||
params=["#chan2"],
|
||||
)
|
||||
|
||||
@cases.mark_specifications("RFC1459", "RFC2812", "Modern")
|
||||
def testJoinManySingleKey(self):
|
||||
"""Joins two channels, the first one has a key."""
|
||||
self.connectClient("chanop")
|
||||
if self.targmax.get("JOIN", "1000") == "1":
|
||||
raise runner.OptionalExtensionNotSupported("Multi-target JOIN")
|
||||
self.joinChannel(1, "#chan1")
|
||||
self.sendLine(1, "MODE #chan1 +k key1")
|
||||
self.getMessages(1)
|
||||
self.joinChannel(1, "#chan2")
|
||||
self.getMessages(1)
|
||||
|
||||
self.connectClient("joiner")
|
||||
self.sendLine(2, "JOIN #chan1,#chan2 key1")
|
||||
self.assertMessageMatch(
|
||||
self.getMessage(2),
|
||||
command="JOIN",
|
||||
params=["#chan1"],
|
||||
)
|
||||
self.assertMessageMatch(
|
||||
[
|
||||
msg
|
||||
for msg in self.getMessages(2)
|
||||
if msg.command not in {RPL_NAMREPLY, RPL_ENDOFNAMES}
|
||||
][0],
|
||||
command="JOIN",
|
||||
params=["#chan2"],
|
||||
)
|
||||
|
Reference in New Issue
Block a user