away_notify: Better errors

This commit is contained in:
2021-02-24 18:59:45 +01:00
parent 79399e5c99
commit 0cf2726f78

View File

@ -22,14 +22,12 @@ class AwayNotifyTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
self.sendLine(2, "AWAY :i'm going away") self.sendLine(2, "AWAY :i'm going away")
self.getMessages(2) self.getMessages(2)
messages = [msg for msg in self.getMessages(1) if msg.command == "AWAY"] awayNotify = self.getMessage(1)
self.assertEqual(len(messages), 1) self.assertMessageEqual(awayNotify, command="AWAY", params=["i'm going away"])
awayNotify = messages[0]
self.assertTrue( self.assertTrue(
awayNotify.prefix.startswith("bar!"), awayNotify.prefix.startswith("bar!"),
"Unexpected away-notify source: %s" % (awayNotify.prefix,), "Unexpected away-notify source: %s" % (awayNotify.prefix,),
) )
self.assertEqual(awayNotify.params, ["i'm going away"])
@cases.SpecificationSelector.requiredBySpecification("IRCv3.2") @cases.SpecificationSelector.requiredBySpecification("IRCv3.2")
def testAwayNotifyOnJoin(self): def testAwayNotifyOnJoin(self):
@ -50,10 +48,15 @@ class AwayNotifyTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
self.getMessages(2) self.getMessages(2)
messages = [msg for msg in self.getMessages(1) if msg.command == "AWAY"] messages = [msg for msg in self.getMessages(1) if msg.command == "AWAY"]
self.assertEqual(len(messages), 1) self.assertEqual(
len(messages),
1,
"Someone away joined a channel, "
"but users in the channel did not get AWAY messages.",
)
awayNotify = messages[0] awayNotify = messages[0]
self.assertMessageEqual(awayNotify, command="AWAY", params=["i'm already away"])
self.assertTrue( self.assertTrue(
awayNotify.prefix.startswith("bar!"), awayNotify.prefix.startswith("bar!"),
"Unexpected away-notify source: %s" % (awayNotify.prefix,), "Unexpected away-notify source: %s" % (awayNotify.prefix,),
) )
self.assertEqual(awayNotify.params, ["i'm already away"])