From 0cf2726f78dbfd3a5c1de5280eaef8191386986d Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 24 Feb 2021 18:59:45 +0100 Subject: [PATCH] away_notify: Better errors --- irctest/server_tests/test_away_notify.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/irctest/server_tests/test_away_notify.py b/irctest/server_tests/test_away_notify.py index 06ea5f7..bf42344 100644 --- a/irctest/server_tests/test_away_notify.py +++ b/irctest/server_tests/test_away_notify.py @@ -22,14 +22,12 @@ class AwayNotifyTestCase(cases.BaseServerTestCase, cases.OptionalityHelper): self.sendLine(2, "AWAY :i'm going away") self.getMessages(2) - messages = [msg for msg in self.getMessages(1) if msg.command == "AWAY"] - self.assertEqual(len(messages), 1) - awayNotify = messages[0] + awayNotify = self.getMessage(1) + self.assertMessageEqual(awayNotify, command="AWAY", params=["i'm going away"]) self.assertTrue( awayNotify.prefix.startswith("bar!"), "Unexpected away-notify source: %s" % (awayNotify.prefix,), ) - self.assertEqual(awayNotify.params, ["i'm going away"]) @cases.SpecificationSelector.requiredBySpecification("IRCv3.2") def testAwayNotifyOnJoin(self): @@ -50,10 +48,15 @@ class AwayNotifyTestCase(cases.BaseServerTestCase, cases.OptionalityHelper): self.getMessages(2) 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] + self.assertMessageEqual(awayNotify, command="AWAY", params=["i'm already away"]) self.assertTrue( awayNotify.prefix.startswith("bar!"), "Unexpected away-notify source: %s" % (awayNotify.prefix,), ) - self.assertEqual(awayNotify.params, ["i'm already away"])