Remove some Ergo-specific assumptions.

We need to remove them before we can start running these tests
on Inspircd.
This commit is contained in:
2021-06-27 00:37:33 +02:00
committed by Val Lorentz
parent 6458586179
commit 829edddeb8
3 changed files with 26 additions and 6 deletions

View File

@ -577,7 +577,9 @@ class BaseServerTestCase(
Returns the list of all messages received after registration, Returns the list of all messages received after registration,
just like `skipToWelcome`.""" just like `skipToWelcome`."""
client = self.addClient(name, show_io=show_io) client = self.addClient(name, show_io=show_io)
if capabilities is not None and 0 < len(capabilities): if capabilities:
self.sendLine(client, "CAP LS 302")
m = self.getRegistrationMessage(client)
self.sendLine(client, "CAP REQ :{}".format(" ".join(capabilities))) self.sendLine(client, "CAP REQ :{}".format(" ".join(capabilities)))
m = self.getRegistrationMessage(client) m = self.getRegistrationMessage(client)
try: try:
@ -592,12 +594,18 @@ class BaseServerTestCase(
raise runner.CapabilityNotSupported(" or ".join(capabilities)) raise runner.CapabilityNotSupported(" or ".join(capabilities))
else: else:
raise raise
self.sendLine(client, "CAP END")
if password is not None: if password is not None:
self.sendLine(client, "AUTHENTICATE PLAIN") self.sendLine(client, "AUTHENTICATE PLAIN")
m = self.getRegistrationMessage(client)
self.assertMessageMatch(m, command="AUTHENTICATE", params=["+"])
self.sendLine(client, sasl_plain_blob(account or nick, password)) self.sendLine(client, sasl_plain_blob(account or nick, password))
m = self.getRegistrationMessage(client)
self.assertIn(m.command, ["900", "903"], str(m))
self.sendLine(client, "NICK {}".format(nick)) self.sendLine(client, "NICK {}".format(nick))
self.sendLine(client, "USER %s * * :Realname" % (ident,)) self.sendLine(client, "USER %s * * :Realname" % (ident,))
if capabilities:
self.sendLine(client, "CAP END")
welcome = self.skipToWelcome(client) welcome = self.skipToWelcome(client)
self.sendLine(client, "PING foo") self.sendLine(client, "PING foo")

View File

@ -11,8 +11,16 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
self.sendLine(2, "CAP LS 302") self.sendLine(2, "CAP LS 302")
capabilities = self.getCapLs(2) capabilities = self.getCapLs(2)
assert "sasl" in capabilities assert "sasl" in capabilities
self.sendLine(2, "USER f * * :Realname")
self.sendLine(2, "NICK {}".format(nick))
self.sendLine(2, "CAP REQ :sasl")
self.getRegistrationMessage(2)
self.sendLine(2, "AUTHENTICATE PLAIN") self.sendLine(2, "AUTHENTICATE PLAIN")
m = self.getMessage(2, filter_pred=lambda m: m.command != "NOTICE") m = self.getMessage(
2, filter_pred=lambda m: m.command != "NOTICE", synchronize=False
)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="AUTHENTICATE", command="AUTHENTICATE",
@ -21,7 +29,9 @@ 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(2, filter_pred=lambda m: m.command != "NOTICE") m = self.getMessage(
2, filter_pred=lambda m: m.command != "NOTICE", synchronize=False
)
self.assertMessageMatch( self.assertMessageMatch(
m, m,
command="900", command="900",

View File

@ -121,7 +121,9 @@ class WhoisTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
<https://defs.ircdocs.horse/defs/numerics.html#rpl-whoisaccount-330>""" <https://defs.ircdocs.horse/defs/numerics.html#rpl-whoisaccount-330>"""
self.controller.registerUser(self, "shivaram", "sesame") self.controller.registerUser(self, "shivaram", "sesame")
self.connectClient("netcat", account="shivaram", password="sesame") self.connectClient(
"netcat", account="shivaram", password="sesame", capabilities=["sasl"]
)
self.getMessages(1) self.getMessages(1)
self.connectClient("curious") self.connectClient("curious")
@ -129,7 +131,7 @@ class WhoisTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
messages = self.getMessages(2) messages = self.getMessages(2)
# 330 RPL_WHOISACCOUNT # 330 RPL_WHOISACCOUNT
whoisaccount = [message for message in messages if message.command == "330"] whoisaccount = [message for message in messages if message.command == "330"]
self.assertEqual(len(whoisaccount), 1) self.assertEqual(len(whoisaccount), 1, messages)
params = whoisaccount[0].params params = whoisaccount[0].params
# <client> <nick> <authname> :<info> # <client> <nick> <authname> :<info>
self.assertEqual(len(params), 4) self.assertEqual(len(params), 4)