mirror of
https://github.com/progval/irctest.git
synced 2025-04-06 07:19:54 +00:00
Rename assertMessageEqual to assertMessageMatch
it describes the function better
This commit is contained in:
@ -103,7 +103,7 @@ class _IrcTestCase(unittest.TestCase, Generic[TController]):
|
||||
if self.show_io:
|
||||
print("---- new test ----")
|
||||
|
||||
def assertMessageEqual(self, msg: Message, **kwargs: Any) -> None:
|
||||
def assertMessageMatch(self, msg: Message, **kwargs: Any) -> None:
|
||||
"""Helper for partially comparing a message.
|
||||
|
||||
Takes the message as first arguments, and comparisons to be made
|
||||
@ -543,7 +543,7 @@ class BaseServerTestCase(
|
||||
caps = []
|
||||
while True:
|
||||
m = self.getRegistrationMessage(client)
|
||||
self.assertMessageEqual(m, command="CAP")
|
||||
self.assertMessageMatch(m, command="CAP")
|
||||
self.assertEqual(m.params[1], "LS", fail_msg="Expected CAP * LS, got {got}")
|
||||
if m.params[2] == "*":
|
||||
caps.extend(m.params[3].split())
|
||||
@ -594,7 +594,7 @@ class BaseServerTestCase(
|
||||
self.sendLine(client, "CAP REQ :{}".format(" ".join(capabilities)))
|
||||
m = self.getRegistrationMessage(client)
|
||||
try:
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="CAP", fail_msg="Expected CAP ACK, got: {msg}"
|
||||
)
|
||||
self.assertEqual(
|
||||
|
@ -87,7 +87,7 @@ class SaslTestCase(cases.BaseClientTestCase, cases.OptionalityHelper):
|
||||
self.assertEqual(m, Message({}, None, "AUTHENTICATE", ["PLAIN"]))
|
||||
self.sendLine("904 {} :SASL auth failed".format(self.nick))
|
||||
m = self.getMessage()
|
||||
self.assertMessageEqual(m, command="CAP")
|
||||
self.assertMessageMatch(m, command="CAP")
|
||||
|
||||
@cases.OptionalityHelper.skipUnlessHasMechanism("PLAIN")
|
||||
def testPlainLarge(self):
|
||||
@ -167,7 +167,7 @@ class SaslTestCase(cases.BaseClientTestCase, cases.OptionalityHelper):
|
||||
"AUTHENTICATE {}".format(base64.b64encode(CHALLENGE).decode("ascii"))
|
||||
)
|
||||
m = self.getMessage()
|
||||
self.assertMessageEqual(m, command="AUTHENTICATE")
|
||||
self.assertMessageMatch(m, command="AUTHENTICATE")
|
||||
sk = ecdsa.SigningKey.from_pem(ECDSA_KEY)
|
||||
vk = sk.get_verifying_key()
|
||||
signature = base64.b64decode(m.params[0])
|
||||
|
@ -13,7 +13,7 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
assert "sasl" in capabilities
|
||||
self.sendLine(2, "AUTHENTICATE PLAIN")
|
||||
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="AUTHENTICATE",
|
||||
params=["+"],
|
||||
@ -22,7 +22,7 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(2, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=")
|
||||
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="900",
|
||||
fail_msg="Did not send 900 after correct SASL authentication.",
|
||||
@ -42,7 +42,7 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.sendLine(2, "PRIVMSG foo :hi")
|
||||
self.getMessages(2)
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="PRIVMSG",
|
||||
params=["foo", "hi"],
|
||||
|
@ -23,7 +23,7 @@ class AwayNotifyTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.getMessages(2)
|
||||
|
||||
awayNotify = self.getMessage(1)
|
||||
self.assertMessageEqual(awayNotify, command="AWAY", params=["i'm going away"])
|
||||
self.assertMessageMatch(awayNotify, command="AWAY", params=["i'm going away"])
|
||||
self.assertTrue(
|
||||
awayNotify.prefix.startswith("bar!"),
|
||||
"Unexpected away-notify source: %s" % (awayNotify.prefix,),
|
||||
@ -55,7 +55,7 @@ class AwayNotifyTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
"but users in the channel did not get AWAY messages.",
|
||||
)
|
||||
awayNotify = messages[0]
|
||||
self.assertMessageEqual(awayNotify, command="AWAY", params=["i'm already away"])
|
||||
self.assertMessageMatch(awayNotify, command="AWAY", params=["i'm already away"])
|
||||
self.assertTrue(
|
||||
awayNotify.prefix.startswith("bar!"),
|
||||
"Unexpected away-notify source: %s" % (awayNotify.prefix,),
|
||||
|
@ -140,7 +140,7 @@ class Bouncer(cases.BaseServerTestCase):
|
||||
msg for msg in self.getMessages(3) if msg.command == "PRIVMSG"
|
||||
]
|
||||
self.assertEqual(len(messagesforthree), 1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
messagesforthree[0], command="PRIVMSG", params=["#chan", "hey again"]
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.sendLine(1, "NICK foo")
|
||||
self.sendLine(1, "CAP END")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="001", fail_msg="Expected 001 after sending CAP END, got {msg}."
|
||||
)
|
||||
|
||||
@ -36,7 +36,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.sendLine(1, "NICK foo")
|
||||
self.sendLine(1, "CAP REQ :foo")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=[..., "NAK", "foo"],
|
||||
@ -45,7 +45,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "CAP END")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="001", fail_msg="Expected 001 after sending CAP END, got {msg}."
|
||||
)
|
||||
|
||||
@ -63,7 +63,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
# alphabetical
|
||||
self.sendLine(1, "CAP REQ :foo qux bar baz qux quux")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=[..., "NAK", "foo qux bar baz qux quux"],
|
||||
@ -82,7 +82,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.assertIn("multi-prefix", self.getCapLs(1))
|
||||
self.sendLine(1, "CAP REQ :foo multi-prefix bar")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=[..., "NAK", "foo multi-prefix bar"],
|
||||
@ -91,7 +91,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "CAP REQ :multi-prefix bar")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=[..., "NAK", "multi-prefix bar"],
|
||||
@ -100,7 +100,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "CAP REQ :foo multi-prefix")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=[..., "NAK", "foo multi-prefix"],
|
||||
@ -110,7 +110,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
# TODO: make sure multi-prefix is not enabled at this point
|
||||
self.sendLine(1, "CAP REQ :multi-prefix")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=[..., "ACK", "multi-prefix"],
|
||||
@ -133,7 +133,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.sendLine(1, "user user 0 * realname")
|
||||
self.sendLine(1, "CAP END")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(m, command="CAP", params=[..., "ACK", ...])
|
||||
self.assertMessageMatch(m, command="CAP", params=[..., "ACK", ...])
|
||||
self.assertEqual(
|
||||
set(m.params[2].split()), {cap1, cap2}, "Didn't ACK both REQed caps"
|
||||
)
|
||||
@ -152,7 +152,7 @@ class CapTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
m = self.getMessage(1)
|
||||
# Must be either ACK or NAK
|
||||
if self.messageDiffers(m, command="CAP", params=[..., "ACK", f"-{cap2}"]):
|
||||
self.assertMessageEqual(m, command="CAP", params=[..., "NAK", f"-{cap2}"])
|
||||
self.assertMessageMatch(m, command="CAP", params=[..., "NAK", f"-{cap2}"])
|
||||
raise ImplementationChoice(f"Does not support CAP REQ -{cap2}")
|
||||
|
||||
# server-time should be disabled
|
||||
|
@ -24,7 +24,7 @@ class ChannelForwarding(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine("bar", "MODE #bar +f #nonexistent")
|
||||
msg = self.getMessage("bar")
|
||||
self.assertMessageEqual(msg, command=ERR_INVALIDMODEPARAM)
|
||||
self.assertMessageMatch(msg, command=ERR_INVALIDMODEPARAM)
|
||||
|
||||
# need chanops in the target channel as well
|
||||
self.sendLine("bar", "MODE #bar +f #baz")
|
||||
@ -33,7 +33,7 @@ class ChannelForwarding(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine("bar", "MODE #bar +f #bar_two")
|
||||
msg = self.getMessage("bar")
|
||||
self.assertMessageEqual(msg, command="MODE", params=["#bar", "+f", "#bar_two"])
|
||||
self.assertMessageMatch(msg, command="MODE", params=["#bar", "+f", "#bar_two"])
|
||||
|
||||
# can still join the channel fine
|
||||
self.joinChannel("baz", "#bar")
|
||||
@ -49,4 +49,4 @@ class ChannelForwarding(cases.BaseServerTestCase):
|
||||
forward = [msg for msg in msgs if msg.command == ERR_LINKCHANNEL]
|
||||
self.assertEqual(forward[0].params[:3], ["baz", "#bar", "#bar_two"])
|
||||
join = [msg for msg in msgs if msg.command == "JOIN"]
|
||||
self.assertMessageEqual(join[0], params=["#bar_two"])
|
||||
self.assertMessageMatch(join[0], params=["#bar_two"])
|
||||
|
@ -145,7 +145,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.getMessages(1) # Synchronize
|
||||
self.sendLine(2, "PART #chan")
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="442", # ERR_NOTONCHANNEL
|
||||
fail_msg="Expected ERR_NOTONCHANNEL (442) "
|
||||
@ -160,7 +160,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("foo")
|
||||
self.sendLine(1, "JOIN #chan")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
self.getMessages(1)
|
||||
self.sendLine(1, "JOIN #chan")
|
||||
# Note that there may be no message. Both RFCs require replies only
|
||||
@ -202,12 +202,12 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("bar")
|
||||
self.sendLine(1, "JOIN #chan")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
|
||||
self.connectClient("baz")
|
||||
self.sendLine(2, "JOIN #chan")
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
|
||||
# skip the rest of the JOIN burst:
|
||||
self.getMessages(1)
|
||||
@ -217,9 +217,9 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
# both the PART'ing client and the other channel member should receive
|
||||
# a PART line:
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="PART")
|
||||
self.assertMessageMatch(m, command="PART")
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="PART")
|
||||
self.assertMessageMatch(m, command="PART")
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testBasicPartRfc2812(self):
|
||||
@ -230,12 +230,12 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("bar")
|
||||
self.sendLine(1, "JOIN #chan")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
|
||||
self.connectClient("baz")
|
||||
self.sendLine(2, "JOIN #chan")
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
|
||||
# skip the rest of the JOIN burst:
|
||||
self.getMessages(1)
|
||||
@ -245,9 +245,9 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
# both the PART'ing client and the other channel member should receive
|
||||
# a PART line:
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="PART", params=["#chan", "bye everyone"])
|
||||
self.assertMessageMatch(m, command="PART", params=["#chan", "bye everyone"])
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="PART", params=["#chan", "bye everyone"])
|
||||
self.assertMessageMatch(m, command="PART", params=["#chan", "bye everyone"])
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testPartMessage(self):
|
||||
@ -258,12 +258,12 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("bar")
|
||||
self.sendLine(1, "JOIN #chan")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
|
||||
self.connectClient("baz")
|
||||
self.sendLine(2, "JOIN #chan")
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(m, command="JOIN", params=["#chan"])
|
||||
|
||||
# skip the rest of the JOIN burst:
|
||||
self.getMessages(1)
|
||||
@ -273,9 +273,9 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
# both the PART'ing client and the other channel member should receive
|
||||
# a PART line:
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="PART", params=["#chan", "bye everyone"])
|
||||
self.assertMessageMatch(m, command="PART", params=["#chan", "bye everyone"])
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="PART", params=["#chan", "bye everyone"])
|
||||
self.assertMessageMatch(m, command="PART", params=["#chan", "bye everyone"])
|
||||
|
||||
@cases.mark_specifications("RFC1459", "RFC2812")
|
||||
def testTopic(self):
|
||||
@ -306,12 +306,12 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
"channel modes to no allow regular users to change "
|
||||
"topic."
|
||||
)
|
||||
self.assertMessageEqual(m, command="TOPIC")
|
||||
self.assertMessageMatch(m, command="TOPIC")
|
||||
except client_mock.NoMessageException:
|
||||
# The RFCs do not say TOPIC must be echoed
|
||||
pass
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="TOPIC", params=["#chan", "T0P1C"])
|
||||
self.assertMessageMatch(m, command="TOPIC", params=["#chan", "T0P1C"])
|
||||
|
||||
@cases.mark_specifications("RFC1459", "RFC2812")
|
||||
def testTopicMode(self):
|
||||
@ -338,7 +338,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.getMessages(2)
|
||||
self.sendLine(2, "TOPIC #chan :T0P1C")
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="482", fail_msg="Non-op user was not refused use of TOPIC: {msg}"
|
||||
)
|
||||
self.assertEqual(self.getMessages(1), [])
|
||||
@ -357,7 +357,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
# The RFCs do not say TOPIC must be echoed
|
||||
pass
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="TOPIC", params=["#chan", "T0P1C"])
|
||||
self.assertMessageMatch(m, command="TOPIC", params=["#chan", "T0P1C"])
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testTopicNonexistentChannel(self):
|
||||
@ -429,7 +429,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
"322", # RPL_LIST
|
||||
"LIST response gives (at least) one channel, whereas there " "is none.",
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="323", # RPL_LISTEND
|
||||
fail_msg="Second reply to LIST is not 322 (RPL_LIST) "
|
||||
@ -457,7 +457,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
fail_msg="LIST response ended (ie. 323, aka RPL_LISTEND) "
|
||||
"without listing any channel, whereas there is one.",
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="322", # RPL_LIST
|
||||
fail_msg="Second reply to LIST is not 322 (RPL_LIST), "
|
||||
@ -470,7 +470,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
fail_msg="LIST response gives (at least) two channels, "
|
||||
"whereas there is only one.",
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="323", # RPL_LISTEND
|
||||
fail_msg="Third reply to LIST is not 322 (RPL_LIST) "
|
||||
@ -506,14 +506,14 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
raise runner.ImplementationChoice(
|
||||
"Channel creators are not opped by default."
|
||||
)
|
||||
self.assertMessageEqual(m, command="KICK")
|
||||
self.assertMessageMatch(m, command="KICK")
|
||||
except client_mock.NoMessageException:
|
||||
# The RFCs do not say KICK must be echoed
|
||||
pass
|
||||
m = self.getMessage(2)
|
||||
self.assertMessageEqual(m, command="KICK", params=["#chan", "bar", "bye"])
|
||||
self.assertMessageMatch(m, command="KICK", params=["#chan", "bar", "bye"])
|
||||
m = self.getMessage(3)
|
||||
self.assertMessageEqual(m, command="KICK", params=["#chan", "bar", "bye"])
|
||||
self.assertMessageMatch(m, command="KICK", params=["#chan", "bar", "bye"])
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testKickPrivileges(self):
|
||||
@ -579,7 +579,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(1, "KICK #chan nick")
|
||||
m = self.getMessage(1)
|
||||
# should return ERR_NOSUCHCHANNEL
|
||||
self.assertMessageEqual(m, command="403")
|
||||
self.assertMessageMatch(m, command="403")
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testDoubleKickMessages(self):
|
||||
@ -667,7 +667,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
fail_msg="After using “INVITE #chan bar” while #chan does "
|
||||
"not exist, “bar” received nothing.",
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
messages[0],
|
||||
command="INVITE",
|
||||
params=["#chan", "bar"],
|
||||
@ -699,7 +699,7 @@ class JoinTestCase(cases.BaseServerTestCase):
|
||||
fail_msg="After using “INVITE #chan bar” while #chan does "
|
||||
"not exist, the author received nothing.",
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
messages[0],
|
||||
command="INVITE",
|
||||
params=["#chan", "bar"],
|
||||
@ -724,7 +724,7 @@ def _testChannelsEquivalent(casemapping, name1, name2):
|
||||
self.joinClient(2, name2)
|
||||
try:
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(m, command="JOIN", nick="bar")
|
||||
self.assertMessageMatch(m, command="JOIN", nick="bar")
|
||||
except client_mock.NoMessageException:
|
||||
raise AssertionError(
|
||||
"Channel names {} and {} are not equivalent.".format(name1, name2)
|
||||
@ -752,7 +752,7 @@ def _testChannelsNotEquivalent(casemapping, name1, name2):
|
||||
except client_mock.NoMessageException:
|
||||
pass
|
||||
else:
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="JOIN", nick="bar"
|
||||
) # This should always be true
|
||||
raise AssertionError(
|
||||
@ -849,14 +849,14 @@ class NoCTCPTestCase(cases.BaseServerTestCase):
|
||||
self.getMessages(1)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(
|
||||
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.assertMessageEqual(ms[0], command=ERR_CANNOTSENDTOCHAN)
|
||||
self.assertMessageMatch(ms[0], command=ERR_CANNOTSENDTOCHAN)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(ms, [])
|
||||
|
||||
@ -878,7 +878,7 @@ class KeyTestCase(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine(2, "JOIN #chan beer")
|
||||
reply = self.getMessages(2)
|
||||
self.assertMessageEqual(reply[0], command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(reply[0], command="JOIN", params=["#chan"])
|
||||
|
||||
@cases.mark_specifications("RFC2812")
|
||||
def testKeyValidation(self):
|
||||
@ -939,7 +939,7 @@ class KeyTestCase(cases.BaseServerTestCase):
|
||||
|
||||
self.connectClient("foo")
|
||||
self.sendLine(2, f"JOIN #chan {key}")
|
||||
self.assertMessageEqual(self.getMessage(2), command="JOIN", params=["#chan"])
|
||||
self.assertMessageMatch(self.getMessage(2), command="JOIN", params=["#chan"])
|
||||
|
||||
|
||||
class AuditoriumTestCase(cases.BaseServerTestCase):
|
||||
@ -951,7 +951,7 @@ class AuditoriumTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine("bar", "MODE #auditorium +u")
|
||||
modelines = [msg for msg in self.getMessages("bar") if msg.command == "MODE"]
|
||||
self.assertEqual(len(modelines), 1)
|
||||
self.assertMessageEqual(modelines[0], params=["#auditorium", "+u"])
|
||||
self.assertMessageMatch(modelines[0], params=["#auditorium", "+u"])
|
||||
|
||||
self.connectClient("guest1", name="guest1", capabilities=MODERN_CAPS)
|
||||
self.joinChannel("guest1", "#auditorium")
|
||||
@ -959,7 +959,7 @@ class AuditoriumTestCase(cases.BaseServerTestCase):
|
||||
# chanop should get a JOIN message
|
||||
join_msgs = [msg for msg in self.getMessages("bar") if msg.command == "JOIN"]
|
||||
self.assertEqual(len(join_msgs), 1)
|
||||
self.assertMessageEqual(join_msgs[0], nick="guest1", params=["#auditorium"])
|
||||
self.assertMessageMatch(join_msgs[0], nick="guest1", params=["#auditorium"])
|
||||
|
||||
self.connectClient("guest2", name="guest2", capabilities=MODERN_CAPS)
|
||||
self.joinChannel("guest2", "#auditorium")
|
||||
@ -967,7 +967,7 @@ class AuditoriumTestCase(cases.BaseServerTestCase):
|
||||
# chanop should get a JOIN message
|
||||
join_msgs = [msg for msg in self.getMessages("bar") if msg.command == "JOIN"]
|
||||
self.assertEqual(len(join_msgs), 1)
|
||||
self.assertMessageEqual(join_msgs[0], nick="guest2", params=["#auditorium"])
|
||||
self.assertMessageMatch(join_msgs[0], nick="guest2", params=["#auditorium"])
|
||||
# fellow unvoiced participant should not
|
||||
unvoiced_join_msgs = [
|
||||
msg for msg in self.getMessages("guest1") if msg.command == "JOIN"
|
||||
@ -1088,7 +1088,7 @@ class TopicPrivileges(cases.BaseServerTestCase):
|
||||
self.sendLine("buzz", "JOIN #chan")
|
||||
replies = self.getMessages("buzz")
|
||||
rpl_topic = [msg for msg in replies if msg.command == RPL_TOPIC][0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
rpl_topic, command=RPL_TOPIC, params=["buzz", "#chan", "new topic"]
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -1104,20 +1104,20 @@ class BanMode(cases.BaseServerTestCase):
|
||||
self.joinChannel("chanop", "#chan")
|
||||
self.getMessages("chanop")
|
||||
self.sendLine("chanop", "MODE #chan +b bar!*@*")
|
||||
self.assertMessageEqual(self.getMessage("chanop"), command="MODE")
|
||||
self.assertMessageMatch(self.getMessage("chanop"), command="MODE")
|
||||
|
||||
self.connectClient(
|
||||
"Bar", name="bar", capabilities=["echo-message"], skip_if_cap_nak=True
|
||||
)
|
||||
self.getMessages("bar")
|
||||
self.sendLine("bar", "JOIN #chan")
|
||||
self.assertMessageEqual(self.getMessage("bar"), command=ERR_BANNEDFROMCHAN)
|
||||
self.assertMessageMatch(self.getMessage("bar"), command=ERR_BANNEDFROMCHAN)
|
||||
|
||||
self.sendLine("chanop", "MODE #chan -b bar!*@*")
|
||||
self.assertMessageEqual(self.getMessage("chanop"), command="MODE")
|
||||
self.assertMessageMatch(self.getMessage("chanop"), command="MODE")
|
||||
|
||||
self.sendLine("bar", "JOIN #chan")
|
||||
self.assertMessageEqual(self.getMessage("bar"), command="JOIN")
|
||||
self.assertMessageMatch(self.getMessage("bar"), command="JOIN")
|
||||
|
||||
@cases.mark_specifications("Oragono")
|
||||
def testCaseInsensitive(self):
|
||||
@ -1127,18 +1127,18 @@ class BanMode(cases.BaseServerTestCase):
|
||||
self.joinChannel("chanop", "#chan")
|
||||
self.getMessages("chanop")
|
||||
self.sendLine("chanop", "MODE #chan +b BAR!*@*")
|
||||
self.assertMessageEqual(self.getMessage("chanop"), command="MODE")
|
||||
self.assertMessageMatch(self.getMessage("chanop"), command="MODE")
|
||||
|
||||
self.connectClient("Bar", name="bar", capabilities=["echo-message"])
|
||||
self.getMessages("bar")
|
||||
self.sendLine("bar", "JOIN #chan")
|
||||
self.assertMessageEqual(self.getMessage("bar"), command=ERR_BANNEDFROMCHAN)
|
||||
self.assertMessageMatch(self.getMessage("bar"), command=ERR_BANNEDFROMCHAN)
|
||||
|
||||
self.sendLine("chanop", "MODE #chan -b bar!*@*")
|
||||
self.assertMessageEqual(self.getMessage("chanop"), command="MODE")
|
||||
self.assertMessageMatch(self.getMessage("chanop"), command="MODE")
|
||||
|
||||
self.sendLine("bar", "JOIN #chan")
|
||||
self.assertMessageEqual(self.getMessage("bar"), command="JOIN")
|
||||
self.assertMessageMatch(self.getMessage("bar"), command="JOIN")
|
||||
|
||||
|
||||
class ModeratedMode(cases.BaseServerTestCase):
|
||||
@ -1151,7 +1151,7 @@ class ModeratedMode(cases.BaseServerTestCase):
|
||||
self.sendLine("chanop", "MODE #chan +m")
|
||||
replies = self.getMessages("chanop")
|
||||
modeLines = [line for line in replies if line.command == "MODE"]
|
||||
self.assertMessageEqual(modeLines[0], command="MODE", params=["#chan", "+m"])
|
||||
self.assertMessageMatch(modeLines[0], command="MODE", params=["#chan", "+m"])
|
||||
|
||||
self.connectClient("baz", name="baz")
|
||||
self.joinChannel("baz", "#chan")
|
||||
@ -1171,7 +1171,7 @@ class ModeratedMode(cases.BaseServerTestCase):
|
||||
self.getMessages("baz")
|
||||
relays = self.getMessages("chanop")
|
||||
relay = relays[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
relay, command="PRIVMSG", params=["#chan", "hi again from baz"]
|
||||
)
|
||||
|
||||
@ -1192,7 +1192,7 @@ class OpModerated(cases.BaseServerTestCase):
|
||||
self.joinChannel("baz", "#chan")
|
||||
self.sendLine("baz", "PRIVMSG #chan :hi from baz")
|
||||
echo = self.getMessages("baz")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
echo, command="PRIVMSG", params=["#chan", "hi from baz"]
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -1204,7 +1204,7 @@ class OpModerated(cases.BaseServerTestCase):
|
||||
self.joinChannel("qux", "#chan")
|
||||
self.sendLine("qux", "PRIVMSG #chan :hi from qux")
|
||||
echo = self.getMessages("qux")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
echo, command="PRIVMSG", params=["#chan", "hi from qux"]
|
||||
)
|
||||
# message is relayed to chanop but not to unprivileged
|
||||
@ -1220,7 +1220,7 @@ class OpModerated(cases.BaseServerTestCase):
|
||||
self.getMessages("chanop")
|
||||
self.sendLine("qux", "PRIVMSG #chan :hi again from qux")
|
||||
echo = [msg for msg in self.getMessages("qux") if msg.command == "PRIVMSG"][0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
echo, command="PRIVMSG", params=["#chan", "hi again from qux"]
|
||||
)
|
||||
self.assertEqual(
|
||||
|
@ -25,7 +25,7 @@ class ChannelRename(cases.BaseServerTestCase):
|
||||
self.getMessages("baz")
|
||||
|
||||
self.sendLine("bar", "RENAME #bar #qux :no reason")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
self.getMessage("bar"),
|
||||
command="RENAME",
|
||||
params=["#bar", "#qux", "no reason"],
|
||||
|
@ -18,7 +18,7 @@ class PasswordedConnectionRegistrationTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(1, "USER username * * :Realname")
|
||||
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="001",
|
||||
fail_msg="Did not get 001 after correct PASS+NICK+USER: {msg}",
|
||||
@ -177,7 +177,7 @@ class ConnectionRegistrationTestCase(cases.BaseServerTestCase):
|
||||
self.addClient()
|
||||
self.sendLine(1, "CAP LIST")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="CAP",
|
||||
params=["*", "LIST", ""],
|
||||
|
@ -29,7 +29,7 @@ def _testEchoMessage(command, solo, server_time):
|
||||
self.getRegistrationMessage(1)
|
||||
# TODO: Remove this one the trailing space issue is fixed in Charybdis
|
||||
# and Mammon:
|
||||
# self.assertMessageEqual(m, command='CAP',
|
||||
# self.assertMessageMatch(m, command='CAP',
|
||||
# params=['*', 'ACK', 'echo-message'] +
|
||||
# (['server-time'] if server_time else []),
|
||||
# fail_msg='Did not ACK advertised capabilities: {msg}')
|
||||
@ -54,7 +54,7 @@ def _testEchoMessage(command, solo, server_time):
|
||||
|
||||
self.sendLine(1, "{} #chan :hello everyone".format(command))
|
||||
m1 = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m1,
|
||||
command=command,
|
||||
params=["#chan", "hello everyone"],
|
||||
@ -64,7 +64,7 @@ def _testEchoMessage(command, solo, server_time):
|
||||
|
||||
if not solo:
|
||||
m2 = self.getMessage(2)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m2,
|
||||
command=command,
|
||||
params=["#chan", "hello everyone"],
|
||||
|
@ -13,7 +13,7 @@ class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
assert "sasl" in capabilities
|
||||
self.sendLine(2, "AUTHENTICATE PLAIN")
|
||||
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="AUTHENTICATE",
|
||||
params=["+"],
|
||||
@ -22,7 +22,7 @@ class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(2, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=")
|
||||
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="900",
|
||||
fail_msg="Did not send 900 after correct SASL authentication.",
|
||||
@ -39,7 +39,7 @@ class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.connectClient("bar")
|
||||
self.joinChannel(2, "#chan")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="JOIN",
|
||||
params=["#chan", "*", "Realname"],
|
||||
@ -58,7 +58,7 @@ class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.joinChannel(2, "#chan")
|
||||
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="JOIN",
|
||||
params=["#chan", "jilles", "Realname"],
|
||||
|
@ -52,7 +52,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
m4 = self.getMessage(4)
|
||||
|
||||
# ensure the label isn't sent to recipients
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m2,
|
||||
command="PRIVMSG",
|
||||
fail_msg="No PRIVMSG received by target 1 after sending one out",
|
||||
@ -67,7 +67,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
"(only the sending user should): {msg}"
|
||||
),
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m3,
|
||||
command="PRIVMSG",
|
||||
fail_msg="No PRIVMSG received by target 1 after sending one out",
|
||||
@ -82,7 +82,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
"(only the sending user should): {msg}"
|
||||
),
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m4,
|
||||
command="PRIVMSG",
|
||||
fail_msg="No PRIVMSG received by target 1 after sending one out",
|
||||
@ -98,7 +98,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
),
|
||||
)
|
||||
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="BATCH", fail_msg="No BATCH echo received after sending one out"
|
||||
)
|
||||
|
||||
@ -122,7 +122,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
m2 = self.getMessage(2)
|
||||
|
||||
# ensure the label isn't sent to recipient
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m2,
|
||||
command="PRIVMSG",
|
||||
fail_msg="No PRIVMSG received by the target after sending one out",
|
||||
@ -138,7 +138,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
),
|
||||
)
|
||||
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="PRIVMSG",
|
||||
fail_msg="No PRIVMSG echo received after sending one out",
|
||||
@ -191,7 +191,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
mt = self.getMessage(2)
|
||||
|
||||
# ensure the label isn't sent to recipient
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
mt,
|
||||
command="PRIVMSG",
|
||||
fail_msg="No PRIVMSG received by the target after sending one out",
|
||||
@ -208,7 +208,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
)
|
||||
|
||||
# ensure sender correctly receives msg
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
ms, command="PRIVMSG", fail_msg="Got a message back that wasn't a PRIVMSG"
|
||||
)
|
||||
self.assertIn(
|
||||
@ -245,7 +245,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
|
||||
number_of_labels = 0
|
||||
for m in [m1, m2]:
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="PRIVMSG",
|
||||
fail_msg="Got a message back that wasn't a PRIVMSG",
|
||||
@ -293,7 +293,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
m2 = self.getMessage(2)
|
||||
|
||||
# ensure the label isn't sent to recipient
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m2,
|
||||
command="NOTICE",
|
||||
fail_msg="No NOTICE received by the target after sending one out",
|
||||
@ -309,7 +309,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
),
|
||||
)
|
||||
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="NOTICE",
|
||||
fail_msg="No NOTICE echo received after sending one out",
|
||||
@ -362,7 +362,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
mt = self.getMessage(2)
|
||||
|
||||
# ensure the label isn't sent to recipient
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
mt,
|
||||
command="NOTICE",
|
||||
fail_msg="No NOTICE received by the target after sending one out",
|
||||
@ -379,7 +379,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
)
|
||||
|
||||
# ensure sender correctly receives msg
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
ms, command="NOTICE", fail_msg="Got a message back that wasn't a NOTICE"
|
||||
)
|
||||
self.assertIn(
|
||||
@ -416,7 +416,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
|
||||
number_of_labels = 0
|
||||
for m in [m1, m2]:
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="NOTICE", fail_msg="Got a message back that wasn't a NOTICE"
|
||||
)
|
||||
if "label" in m.tags:
|
||||
@ -462,7 +462,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
m2 = self.getMessage(2)
|
||||
|
||||
# ensure the label isn't sent to recipient
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m2,
|
||||
command="TAGMSG",
|
||||
fail_msg="No TAGMSG received by the target after sending one out",
|
||||
@ -502,7 +502,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
fail_msg="React tag wasn't the same on the target user's TAGMSG: {msg}",
|
||||
)
|
||||
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="TAGMSG",
|
||||
fail_msg="No TAGMSG echo received after sending one out",
|
||||
@ -577,7 +577,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
mt = self.getMessage(2)
|
||||
|
||||
# ensure the label isn't sent to recipient
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
mt,
|
||||
command="TAGMSG",
|
||||
fail_msg="No TAGMSG received by the target after sending one out",
|
||||
@ -594,7 +594,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
)
|
||||
|
||||
# ensure sender correctly receives msg
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
ms, command="TAGMSG", fail_msg="Got a message back that wasn't a TAGMSG"
|
||||
)
|
||||
self.assertIn(
|
||||
@ -631,7 +631,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
|
||||
number_of_labels = 0
|
||||
for m in [m1, m2]:
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m, command="TAGMSG", fail_msg="Got a message back that wasn't a TAGMSG"
|
||||
)
|
||||
if "label" in m.tags:
|
||||
@ -674,7 +674,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
|
||||
# valid BATCH start line:
|
||||
batch_start = m[0]
|
||||
self.assertMessageEqual(batch_start, command="BATCH")
|
||||
self.assertMessageMatch(batch_start, command="BATCH")
|
||||
self.assertEqual(len(batch_start.params), 2)
|
||||
self.assertTrue(
|
||||
batch_start.params[0].startswith("+"),
|
||||
@ -691,7 +691,7 @@ class LabeledResponsesTestCase(cases.BaseServerTestCase, cases.OptionalityHelper
|
||||
|
||||
# valid BATCH end line
|
||||
batch_end = m[-1]
|
||||
self.assertMessageEqual(batch_end, command="BATCH", params=["-" + batch_id])
|
||||
self.assertMessageMatch(batch_end, command="BATCH", params=["-" + batch_id])
|
||||
|
||||
# messages must have the BATCH tag
|
||||
for message in m[1:-1]:
|
||||
|
@ -40,14 +40,14 @@ class MessageTagsTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.getMessages("alice")
|
||||
bob_msg = self.getMessage("bob")
|
||||
carol_line = self.getMessage("carol", raw=True)
|
||||
self.assertMessageEqual(bob_msg, command="PRIVMSG", params=["#test", "hi"])
|
||||
self.assertMessageMatch(bob_msg, command="PRIVMSG", params=["#test", "hi"])
|
||||
self.assertEqual(bob_msg.tags["+baz"], "bat")
|
||||
self.assertIn("msgid", bob_msg.tags)
|
||||
# should not relay a non-client-only tag
|
||||
self.assertNotIn("fizz", bob_msg.tags)
|
||||
# carol MUST NOT receive tags
|
||||
carol_msg = assertNoTags(carol_line)
|
||||
self.assertMessageEqual(carol_msg, command="PRIVMSG", params=["#test", "hi"])
|
||||
self.assertMessageMatch(carol_msg, command="PRIVMSG", params=["#test", "hi"])
|
||||
# dave SHOULD receive server-time tag
|
||||
dave_msg = self.getMessage("dave")
|
||||
self.assertIn("time", dave_msg.tags)
|
||||
@ -61,7 +61,7 @@ class MessageTagsTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
carol_line = self.getMessage("carol", raw=True)
|
||||
carol_msg = assertNoTags(carol_line)
|
||||
for msg in [alice_msg, bob_msg, carol_msg]:
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
msg, command="PRIVMSG", params=["#test", "hi yourself"]
|
||||
)
|
||||
for msg in [alice_msg, bob_msg]:
|
||||
@ -80,7 +80,7 @@ class MessageTagsTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
# dave MUST NOT receive TAGMSG either, despite having server-time
|
||||
self.assertEqual(self.getMessages("dave"), [])
|
||||
for msg in [alice_msg, bob_msg]:
|
||||
self.assertMessageEqual(alice_msg, command="TAGMSG", params=["#test"])
|
||||
self.assertMessageMatch(alice_msg, command="TAGMSG", params=["#test"])
|
||||
self.assertEqual(msg.tags["+buzz"], "fizz;buzz")
|
||||
self.assertEqual(msg.tags["+steel"], "wootz")
|
||||
self.assertNotIn("cat", msg.tags)
|
||||
@ -108,8 +108,8 @@ class MessageTagsTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.sendLine("alice", max_tagmsg)
|
||||
echo = self.getMessage("alice")
|
||||
relay = self.getMessage("bob")
|
||||
self.assertMessageEqual(echo, command="TAGMSG", params=["#test"])
|
||||
self.assertMessageEqual(relay, command="TAGMSG", params=["#test"])
|
||||
self.assertMessageMatch(echo, command="TAGMSG", params=["#test"])
|
||||
self.assertMessageMatch(relay, command="TAGMSG", params=["#test"])
|
||||
self.assertNotEqual(echo.tags["msgid"], "")
|
||||
self.assertEqual(echo.tags["msgid"], relay.tags["msgid"])
|
||||
self.assertEqual(echo.tags["+baz"], "a" * 4081)
|
||||
|
@ -20,7 +20,7 @@ class PrivmsgTestCase(cases.BaseServerTestCase):
|
||||
self.getMessages(1) # synchronize
|
||||
pms = [msg for msg in self.getMessages(2) if msg.command == "PRIVMSG"]
|
||||
self.assertEqual(len(pms), 1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
pms[0], command="PRIVMSG", params=["#chan", "hello there"]
|
||||
)
|
||||
|
||||
@ -47,7 +47,7 @@ class NoticeTestCase(cases.BaseServerTestCase):
|
||||
self.getMessages(1) # synchronize
|
||||
notices = [msg for msg in self.getMessages(2) if msg.command == "NOTICE"]
|
||||
self.assertEqual(len(notices), 1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
notices[0], command="NOTICE", params=["#chan", "hello there"]
|
||||
)
|
||||
|
||||
|
@ -39,7 +39,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("foo")
|
||||
self.sendLine(1, "METADATA * GET valid_key1")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="766", # ERR_NOMATCHINGKEY
|
||||
fail_msg="Did not reply with 766 (ERR_NOMATCHINGKEY) to a "
|
||||
@ -55,7 +55,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("foo")
|
||||
self.sendLine(1, "METADATA * GET valid_key1 valid_key2")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="766", # ERR_NOMATCHINGKEY
|
||||
fail_msg="Did not reply with 766 (ERR_NOMATCHINGKEY) to a "
|
||||
@ -69,7 +69,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
"did not respond to valid_key1 first: {msg}",
|
||||
)
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="766", # ERR_NOMATCHINGKEY
|
||||
fail_msg="Did not reply with two 766 (ERR_NOMATCHINGKEY) to a "
|
||||
@ -93,7 +93,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("foo")
|
||||
self.sendLine(1, "METADATA * LIST")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="762", # RPL_METADATAEND
|
||||
fail_msg="Response to “METADATA * LIST” was not "
|
||||
@ -108,7 +108,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
self.connectClient("foo")
|
||||
self.sendLine(1, "METADATA foobar LIST")
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="765", # ERR_TARGETINVALID
|
||||
fail_msg="Response to “METADATA <invalid target> LIST” was "
|
||||
@ -127,7 +127,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
displayable_value = value
|
||||
self.sendLine(1, "METADATA {} SET {} :{}".format(target, key, value))
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="761", # RPL_KEYVALUE
|
||||
fail_msg="Did not reply with 761 (RPL_KEYVALUE) to a valid "
|
||||
@ -151,7 +151,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
extra_format=(key, displayable_value),
|
||||
)
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="762", # RPL_METADATAEND
|
||||
fail_msg="Did not send RPL_METADATAEND after setting "
|
||||
@ -161,7 +161,7 @@ class MetadataTestCase(cases.BaseServerTestCase):
|
||||
def assertGetValue(self, target, key, value, displayable_value=None):
|
||||
self.sendLine(1, "METADATA * GET {}".format(key))
|
||||
m = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="761", # RPL_KEYVALUE
|
||||
fail_msg="Did not reply with 761 (RPL_KEYVALUE) to a valid "
|
||||
|
@ -21,7 +21,7 @@ class MonitorTestCase(cases.BaseServerTestCase):
|
||||
def assertMononline(self, client, nick, m=None):
|
||||
if not m:
|
||||
m = self.getMessage(client)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="730", # RPL_MONONLINE
|
||||
fail_msg="Sent non-730 (RPL_MONONLINE) message after "
|
||||
@ -45,7 +45,7 @@ class MonitorTestCase(cases.BaseServerTestCase):
|
||||
def assertMonoffline(self, client, nick, m=None):
|
||||
if not m:
|
||||
m = self.getMessage(client)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="731", # RPL_MONOFFLINE
|
||||
fail_msg="Did not reply with 731 (RPL_MONOFFLINE) to "
|
||||
|
@ -24,12 +24,12 @@ class MultiPrefixTestCase(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine(1, "NAMES #chan")
|
||||
reply = self.getMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
reply,
|
||||
command="353",
|
||||
fail_msg="Expected NAMES response (353) with @+foo, got: {msg}",
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
reply,
|
||||
command="353",
|
||||
params=["foo", reply.params[1], "#chan", "@+foo"],
|
||||
|
@ -48,7 +48,7 @@ class MultilineTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
assert time
|
||||
privmsgs = echo[1:-1]
|
||||
for msg in privmsgs:
|
||||
self.assertMessageEqual(msg, command="PRIVMSG")
|
||||
self.assertMessageMatch(msg, command="PRIVMSG")
|
||||
self.assertNotIn("msgid", msg.tags)
|
||||
self.assertNotIn("time", msg.tags)
|
||||
self.assertIn(CONCAT_TAG, echo[3].tags)
|
||||
@ -64,7 +64,7 @@ class MultilineTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.assertEqual(batchStart.tags.get("time"), time)
|
||||
privmsgs = relay[1:-1]
|
||||
for msg in privmsgs:
|
||||
self.assertMessageEqual(msg, command="PRIVMSG")
|
||||
self.assertMessageMatch(msg, command="PRIVMSG")
|
||||
self.assertNotIn("msgid", msg.tags)
|
||||
self.assertNotIn("time", msg.tags)
|
||||
self.assertEqual(msg.tags.get("batch"), batchTag)
|
||||
@ -73,7 +73,7 @@ class MultilineTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
fallback_relay = self.getMessages(3)
|
||||
relayed_fmsgids = []
|
||||
for msg in fallback_relay:
|
||||
self.assertMessageEqual(msg, command="PRIVMSG")
|
||||
self.assertMessageMatch(msg, command="PRIVMSG")
|
||||
relayed_fmsgids.append(msg.tags.get("msgid"))
|
||||
self.assertEqual(msg.tags.get("time"), time)
|
||||
self.assertNotIn(CONCAT_TAG, msg.tags)
|
||||
@ -107,11 +107,11 @@ class MultilineTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
batch_start = relay[0]
|
||||
privmsgs = relay[1:-1]
|
||||
self.assertEqual(len(privmsgs), 3)
|
||||
self.assertMessageEqual(privmsgs[0], command="PRIVMSG", params=["#test", ""])
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(privmsgs[0], command="PRIVMSG", params=["#test", ""])
|
||||
self.assertMessageMatch(
|
||||
privmsgs[1], command="PRIVMSG", params=["#test", "#how is "]
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
privmsgs[2], command="PRIVMSG", params=["#test", "everyone?"]
|
||||
)
|
||||
self.assertIn("+client-only-tag", batch_start.tags)
|
||||
@ -119,10 +119,10 @@ class MultilineTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
|
||||
fallback_relay = self.getMessages(3)
|
||||
self.assertEqual(len(fallback_relay), 2)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
fallback_relay[0], command="PRIVMSG", params=["#test", "#how is "]
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
fallback_relay[1], command="PRIVMSG", params=["#test", "everyone?"]
|
||||
)
|
||||
self.assertIn("+client-only-tag", fallback_relay[0].tags)
|
||||
|
@ -17,7 +17,7 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(2, "NICK alice")
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(ms[0], command=ERR_NICKNAMEINUSE)
|
||||
self.assertMessageMatch(ms[0], command=ERR_NICKNAMEINUSE)
|
||||
|
||||
# bob MUST still own the bob nick, and be able to receive PRIVMSG as bob
|
||||
self.sendLine(1, "PRIVMSG bob hi")
|
||||
@ -25,7 +25,7 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
self.assertEqual(len(ms), 0)
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(ms[0], command="PRIVMSG", params=["bob", "hi"])
|
||||
self.assertMessageMatch(ms[0], command="PRIVMSG", params=["bob", "hi"])
|
||||
|
||||
@cases.mark_specifications("RFC1459")
|
||||
def testCaseChanges(self):
|
||||
@ -40,10 +40,10 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(1, "NICK Alice")
|
||||
ms = self.getMessages(1)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(ms[0], command="NICK", params=["Alice"])
|
||||
self.assertMessageMatch(ms[0], command="NICK", params=["Alice"])
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(ms[0], command="NICK", params=["Alice"])
|
||||
self.assertMessageMatch(ms[0], command="NICK", params=["Alice"])
|
||||
|
||||
# no responses, either to the user or to friends, from a no-op nick change
|
||||
self.sendLine(1, "NICK Alice")
|
||||
@ -69,14 +69,14 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
)
|
||||
ms = self.getMessages(1)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
ms[0], command="PRIVMSG", params=["bob", "hey yourself"]
|
||||
)
|
||||
self.assertEqual(ms[0].tags.get("+draft/reply"), "ct95w3xemz8qj9du2h74wp8pee")
|
||||
|
||||
ms = self.getMessages(2)
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
ms[0], command="PRIVMSG", params=["bob", "hey yourself"]
|
||||
)
|
||||
self.assertEqual(ms[0].tags, {})
|
||||
@ -90,7 +90,7 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
ms = self.getMessages(2)
|
||||
# now bob has the tags cap, so he should receive the tags
|
||||
self.assertEqual(len(ms), 1)
|
||||
self.assertMessageEqual(ms[0], command="PRIVMSG", params=["bob", "hey again"])
|
||||
self.assertMessageMatch(ms[0], command="PRIVMSG", params=["bob", "hey again"])
|
||||
self.assertEqual(ms[0].tags.get("+draft/reply"), "tbxqauh9nykrtpa3n6icd9whan")
|
||||
|
||||
@cases.mark_specifications("RFC1459")
|
||||
@ -129,7 +129,7 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(1, "NICK malice")
|
||||
nick_msgs = [msg for msg in self.getMessages(1) if msg.command == "NICK"]
|
||||
self.assertEqual(len(nick_msgs), 1)
|
||||
self.assertMessageEqual(nick_msgs[0], command="NICK", params=["malice"])
|
||||
self.assertMessageMatch(nick_msgs[0], command="NICK", params=["malice"])
|
||||
|
||||
self.addClient(2)
|
||||
self.sendLine(2, "NICK alice")
|
||||
@ -172,4 +172,4 @@ class RegressionsTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(2, "NICK alice")
|
||||
self.sendLine(2, "USER u s e r")
|
||||
reply = self.getRegistrationMessage(2)
|
||||
self.assertMessageEqual(reply, command=RPL_WELCOME)
|
||||
self.assertMessageMatch(reply, command=RPL_WELCOME)
|
||||
|
@ -57,23 +57,23 @@ class RelaymsgTestCase(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine("baz", "RELAYMSG %s smt/discord hi" % (chname,))
|
||||
response = self.getMessages("baz")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
response, nick="smt/discord", command="PRIVMSG", params=[chname, "hi"]
|
||||
)
|
||||
relayed_msg = self.getMessages("qux")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
relayed_msg, nick="smt/discord", command="PRIVMSG", params=[chname, "hi"]
|
||||
)
|
||||
|
||||
# labeled-response
|
||||
self.sendLine("baz", "@label=x RELAYMSG %s smt/discord :hi again" % (chname,))
|
||||
response = self.getMessages("baz")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
response, nick="smt/discord", command="PRIVMSG", params=[chname, "hi again"]
|
||||
)
|
||||
self.assertEqual(response.tags.get("label"), "x")
|
||||
relayed_msg = self.getMessages("qux")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
relayed_msg,
|
||||
nick="smt/discord",
|
||||
command="PRIVMSG",
|
||||
@ -91,7 +91,7 @@ class RelaymsgTestCase(cases.BaseServerTestCase):
|
||||
self.getMessages("qux")
|
||||
# give baz the relaymsg cap
|
||||
self.sendLine("baz", "CAP REQ %s" % (RELAYMSG_CAP))
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
self.getMessages("baz")[0],
|
||||
command="CAP",
|
||||
params=["baz", "ACK", RELAYMSG_CAP],
|
||||
@ -99,14 +99,14 @@ class RelaymsgTestCase(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine("qux", "RELAYMSG %s smt/discord :hi a third time" % (chname,))
|
||||
response = self.getMessages("qux")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
response,
|
||||
nick="smt/discord",
|
||||
command="PRIVMSG",
|
||||
params=[chname, "hi a third time"],
|
||||
)
|
||||
relayed_msg = self.getMessages("baz")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
relayed_msg,
|
||||
nick="smt/discord",
|
||||
command="PRIVMSG",
|
||||
|
@ -55,10 +55,10 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
privmsgs = [m for m in self.getMessages(2) if m.command == "PRIVMSG"]
|
||||
self.assertEqual(len(privmsgs), 2)
|
||||
privmsgs.sort(key=lambda m: m.params[0])
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
privmsgs[0], command="PRIVMSG", params=[chname, "hello friends"]
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
privmsgs[1], command="PRIVMSG", params=["mainnick", "hello friend singular"]
|
||||
)
|
||||
channelMsgTime = privmsgs[0].tags.get("time")
|
||||
@ -110,7 +110,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
"should receive a new, strong resume token; instead got " + new_token,
|
||||
)
|
||||
# success message
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
resume_messages[1], command="RESUME", params=["SUCCESS", "mainnick"]
|
||||
)
|
||||
|
||||
@ -120,10 +120,10 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
]
|
||||
self.assertEqual(len(privmsgs), 2)
|
||||
privmsgs.sort(key=lambda m: m.params[0])
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
privmsgs[0], command="PRIVMSG", params=[chname, "hello friends"]
|
||||
)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
privmsgs[1], command="PRIVMSG", params=["mainnick", "hello friend singular"]
|
||||
)
|
||||
# should replay with the original server-time
|
||||
@ -135,7 +135,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
quit, join = [m for m in self.getMessages(1) if m.command in ("QUIT", "JOIN")]
|
||||
self.assertEqual(quit.command, "QUIT")
|
||||
self.assertTrue(quit.prefix.startswith("mainnick"))
|
||||
self.assertMessageEqual(join, command="JOIN", params=[chname])
|
||||
self.assertMessageMatch(join, command="JOIN", params=[chname])
|
||||
self.assertTrue(join.prefix.startswith("mainnick"))
|
||||
|
||||
# original client should have been disconnected
|
||||
@ -143,7 +143,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
# new client should be receiving PRIVMSG sent to mainnick
|
||||
self.sendLine(1, "PRIVMSG mainnick :hello again")
|
||||
self.getMessages(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
self.getMessage(4), command="PRIVMSG", params=["mainnick", "hello again"]
|
||||
)
|
||||
|
||||
@ -171,7 +171,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
"should receive a new, strong resume token; instead got " + new_new_token,
|
||||
)
|
||||
# success message
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
resume_messages[1], command="RESUME", params=["SUCCESS", "mainnick"]
|
||||
)
|
||||
|
||||
@ -219,7 +219,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
|
||||
self.sendLine(1, "PRIVMSG mainnick :hey there")
|
||||
# BRB message should be sent as an away message
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
self.getMessage(1),
|
||||
command=RPL_AWAY,
|
||||
params=["observer", "mainnick", "software upgrade"],
|
||||
@ -233,7 +233,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
resume_messages = [m for m in ms if m.command == "RESUME"]
|
||||
self.assertEqual(len(resume_messages), 2)
|
||||
self.assertEqual(resume_messages[0].params[0], "TOKEN")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
resume_messages[1], command="RESUME", params=["SUCCESS", "mainnick"]
|
||||
)
|
||||
|
||||
@ -241,7 +241,7 @@ class ResumeTestCase(cases.BaseServerTestCase):
|
||||
m for m in ms if m.command == "PRIVMSG" and m.prefix.startswith("observer")
|
||||
]
|
||||
self.assertEqual(len(privmsgs), 1, privmsgs)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
privmsgs[0],
|
||||
nick="observer",
|
||||
command="PRIVMSG",
|
||||
|
@ -35,7 +35,7 @@ class RoleplayTestCase(cases.BaseServerTestCase):
|
||||
self.sendLine(bar, "MODE %s +E" % (chan,))
|
||||
reply = self.getMessages(bar)[0]
|
||||
self.assertEqual(reply.command, "MODE")
|
||||
self.assertMessageEqual(reply, command="MODE", params=[chan, "+E"])
|
||||
self.assertMessageMatch(reply, command="MODE", params=[chan, "+E"])
|
||||
self.getMessages(qux)
|
||||
|
||||
self.sendLine(bar, "NPC %s bilbo too much bread" % (chan,))
|
||||
|
@ -32,7 +32,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE PLAIN")
|
||||
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="AUTHENTICATE",
|
||||
params=["+"],
|
||||
@ -41,7 +41,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=")
|
||||
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="900",
|
||||
fail_msg="Did not send 900 after correct SASL authentication.",
|
||||
@ -97,7 +97,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE PLAIN")
|
||||
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="AUTHENTICATE",
|
||||
params=["+"],
|
||||
@ -106,7 +106,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE AGppbGxlcwBzZXNhbWU=")
|
||||
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="900",
|
||||
fail_msg="Did not send 900 after correct SASL authentication.",
|
||||
@ -135,7 +135,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE FOO")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="904",
|
||||
fail_msg="Did not reply with 904 to “AUTHENTICATE FOO”: {msg}",
|
||||
@ -168,7 +168,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE PLAIN")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="AUTHENTICATE",
|
||||
params=["+"],
|
||||
@ -184,14 +184,14 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
# TODO: check username/etc in this as well, so we can apply it to other tests
|
||||
# TODO: may be in the other order
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="900",
|
||||
fail_msg="Expected 900 (RPL_LOGGEDIN) after successful "
|
||||
"login, but got: {msg}",
|
||||
)
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="903",
|
||||
fail_msg="Expected 903 (RPL_SASLSUCCESS) after successful "
|
||||
@ -230,7 +230,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
)
|
||||
self.sendLine(1, "AUTHENTICATE PLAIN")
|
||||
m = self.getRegistrationMessage(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
m,
|
||||
command="AUTHENTICATE",
|
||||
params=["+"],
|
||||
|
@ -50,7 +50,7 @@ class StatusmsgTestCase(cases.BaseServerTestCase):
|
||||
|
||||
# check the operator's messages
|
||||
statusMsg = self.getMessage(1, filter_pred=lambda m: m.command == "PRIVMSG")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
statusMsg, params=["@#chan", "this message is for operators"]
|
||||
)
|
||||
|
||||
@ -96,7 +96,7 @@ class StatusmsgTestCase(cases.BaseServerTestCase):
|
||||
|
||||
# check the operator's messages
|
||||
statusMsg = self.getMessage(1, filter_pred=lambda m: m.command == "PRIVMSG")
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
statusMsg, params=["@#chan", "this message is for operators"]
|
||||
)
|
||||
|
||||
|
@ -180,7 +180,7 @@ class TestNoCTCPMode(cases.BaseServerTestCase):
|
||||
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"])
|
||||
self.assertMessageMatch(umode_line, command="MODE", params=["bar", "+T"])
|
||||
|
||||
# CTCP is now blocked:
|
||||
self.sendLine("qux", "PRIVMSG bar :\x01VERSION\x01")
|
||||
@ -191,7 +191,7 @@ class TestNoCTCPMode(cases.BaseServerTestCase):
|
||||
self.sendLine("qux", "PRIVMSG bar :please just tell me your client version")
|
||||
self.getMessages("qux")
|
||||
relay = self.getMessages("bar")[0]
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
relay,
|
||||
command="PRIVMSG",
|
||||
nick="qux",
|
||||
|
@ -11,7 +11,7 @@ class Utf8TestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
|
||||
self.joinChannel(1, "#qux")
|
||||
self.sendLine(1, "PRIVMSG #qux hi")
|
||||
ms = self.getMessages(1)
|
||||
self.assertMessageEqual(
|
||||
self.assertMessageMatch(
|
||||
[m for m in ms if m.command == "PRIVMSG"][0], params=["#qux", "hi"]
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user