Add test for account tag on INVITE messages.

This will catch issues like https://github.com/solanum-ircd/solanum/issues/166
(when we have registration support for solanum)
This commit is contained in:
2021-06-26 18:44:55 +02:00
parent 6f68a0d601
commit a29e46c17a
3 changed files with 19 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
self.sendLine(2, "CAP END") self.sendLine(2, "CAP END")
self.skipToWelcome(2) self.skipToWelcome(2)
@cases.mark_specifications("IRCv3") @cases.mark_capabilities("account-tag")
@cases.OptionalityHelper.skipUnlessHasMechanism("PLAIN") @cases.OptionalityHelper.skipUnlessHasMechanism("PLAIN")
def testPrivmsg(self): def testPrivmsg(self):
self.connectClient("foo", capabilities=["account-tag"], skip_if_cap_nak=True) self.connectClient("foo", capabilities=["account-tag"], skip_if_cap_nak=True)
@ -45,3 +45,19 @@ class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
self.assertMessageMatch( self.assertMessageMatch(
m, command="PRIVMSG", params=["foo", "hi"], tags={"account": "jilles"} m, command="PRIVMSG", params=["foo", "hi"], tags={"account": "jilles"}
) )
@cases.mark_capabilities("account-tag")
@cases.OptionalityHelper.skipUnlessHasMechanism("PLAIN")
def testInvite(self):
self.connectClient("foo", capabilities=["account-tag"], skip_if_cap_nak=True)
self.getMessages(1)
self.controller.registerUser(self, "jilles", "sesame")
self.connectRegisteredClient("bar")
self.sendLine(2, "JOIN #chan")
self.getMessages(2)
self.sendLine(2, "INVITE foo #chan")
self.getMessages(2)
m = self.getMessage(1)
self.assertMessageMatch(
m, command="INVITE", params=["foo", "#chan"], tags={"account": "jilles"}
)

View File

@ -27,6 +27,7 @@ class Specifications(enum.Enum):
@enum.unique @enum.unique
class Capabilities(enum.Enum): class Capabilities(enum.Enum):
ACCOUNT_TAG = "account-tag"
AWAY_NOTIFY = "away-notify" AWAY_NOTIFY = "away-notify"
BATCH = "batch" BATCH = "batch"
ECHO_MESSAGE = "echo-message" ECHO_MESSAGE = "echo-message"

View File

@ -13,6 +13,7 @@ markers =
deprecated deprecated
# capabilities # capabilities
account-tag
away-notify away-notify
batch batch
echo-message echo-message