Use getRegistrationMessage() when relevant

It's an alias for
`filter_pred=lambda m: m.command != "NOTICE", synchronize=False`
This commit is contained in:
2021-06-27 09:37:22 +02:00
committed by Val Lorentz
parent b3d775f0d6
commit 7ac4d7f80f
4 changed files with 10 additions and 15 deletions

View File

@ -18,9 +18,7 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
self.getRegistrationMessage(2) self.getRegistrationMessage(2)
self.sendLine(2, "AUTHENTICATE PLAIN") self.sendLine(2, "AUTHENTICATE PLAIN")
m = self.getMessage( m = self.getRegistrationMessage(2)
2, filter_pred=lambda m: m.command != "NOTICE", synchronize=False
)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="AUTHENTICATE", command="AUTHENTICATE",
@ -29,9 +27,7 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
"replied with “AUTHENTICATE +”, but instead sent: {msg}", "replied with “AUTHENTICATE +”, but instead sent: {msg}",
) )
self.sendLine(2, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=") self.sendLine(2, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=")
m = self.getMessage( m = self.getRegistrationMessage(2)
2, filter_pred=lambda m: m.command != "NOTICE", synchronize=False
)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="900", command="900",

View File

@ -12,7 +12,7 @@ class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
capabilities = self.getCapLs(2) capabilities = self.getCapLs(2)
assert "sasl" in capabilities assert "sasl" in capabilities
self.sendLine(2, "AUTHENTICATE PLAIN") self.sendLine(2, "AUTHENTICATE PLAIN")
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE") m = self.getRegistrationMessage(2)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="AUTHENTICATE", command="AUTHENTICATE",
@ -21,7 +21,7 @@ class MetadataTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
"replied with “AUTHENTICATE +”, but instead sent: {msg}", "replied with “AUTHENTICATE +”, but instead sent: {msg}",
) )
self.sendLine(2, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=") self.sendLine(2, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=")
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE") m = self.getRegistrationMessage(2)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="900", command="900",

View File

@ -137,9 +137,8 @@ class RegressionsTestCase(cases.BaseServerTestCase):
self.addClient(2) self.addClient(2)
self.sendLine(2, "NICK alice") self.sendLine(2, "NICK alice")
self.sendLine(2, "USER u s e r") self.sendLine(2, "USER u s e r")
replies = set(msg.command for msg in self.getMessages(2)) m = self.getRegistrationMessage(2)
self.assertNotIn(ERR_NICKNAMEINUSE, replies) self.assertMessageMatch(m, command=RPL_WELCOME)
self.assertIn(RPL_WELCOME, replies)
@cases.mark_specifications("RFC1459") @cases.mark_specifications("RFC1459")
def testNickReleaseQuit(self): def testNickReleaseQuit(self):

View File

@ -32,7 +32,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
fail_msg="Does not have PLAIN mechanism as the controller " "claims", fail_msg="Does not have PLAIN mechanism as the controller " "claims",
) )
self.sendLine(1, "AUTHENTICATE PLAIN") self.sendLine(1, "AUTHENTICATE PLAIN")
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE") m = self.getRegistrationMessage(1)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="AUTHENTICATE", command="AUTHENTICATE",
@ -41,7 +41,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
"replied with “AUTHENTICATE +”, but instead sent: {msg}", "replied with “AUTHENTICATE +”, but instead sent: {msg}",
) )
self.sendLine(1, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=") self.sendLine(1, "AUTHENTICATE amlsbGVzAGppbGxlcwBzZXNhbWU=")
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE") m = self.getRegistrationMessage(1)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="900", command="900",
@ -91,7 +91,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
fail_msg="Does not have PLAIN mechanism as the controller " "claims", fail_msg="Does not have PLAIN mechanism as the controller " "claims",
) )
self.sendLine(1, "AUTHENTICATE PLAIN") self.sendLine(1, "AUTHENTICATE PLAIN")
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE") m = self.getRegistrationMessage(1)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="AUTHENTICATE", command="AUTHENTICATE",
@ -100,7 +100,7 @@ class SaslTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
"replied with “AUTHENTICATE +”, but instead sent: {msg}", "replied with “AUTHENTICATE +”, but instead sent: {msg}",
) )
self.sendLine(1, "AUTHENTICATE AGppbGxlcwBzZXNhbWU=") self.sendLine(1, "AUTHENTICATE AGppbGxlcwBzZXNhbWU=")
m = self.getMessage(1, filter_pred=lambda m: m.command != "NOTICE") m = self.getRegistrationMessage(1)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="900", command="900",