Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion irctest/controllers/ergo.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,14 @@ class ErgoController(BaseServerController, DirectoryBasedController):

optional_behaviors = frozenset(
(
OptionalBehaviors.BAN_EXCEPTION_MODE,
OptionalBehaviors.CAP_REQ_MINUS,
OptionalBehaviors.INVITE_EXCEPTION_MODE,
OptionalBehaviors.MULTI_JOIN,
OptionalBehaviors.MULTI_PRIVMSG,
OptionalBehaviors.NO_CTCP,
OptionalBehaviors.SASL_AFTER_REGISTRATION,
OptionalBehaviors.SASL_REAUTHENTICATION,
# OptionalBehaviors.SASL_REAUTHENTICATION is NOT supported :-)
)
)

Expand Down
8 changes: 7 additions & 1 deletion irctest/controllers/inspircd.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ class InspircdController(BaseServerController, DirectoryBasedController):
supports_sts = False
extban_mute_char = "m"

optional_behaviors = frozenset([OptionalBehaviors.NO_CTCP])
optional_behaviors = frozenset(
[
OptionalBehaviors.BAN_EXCEPTION_MODE,
OptionalBehaviors.INVITE_EXCEPTION_MODE,
OptionalBehaviors.NO_CTCP,
]
)

def create_config(self) -> None:
super().create_config()
Expand Down
5 changes: 5 additions & 0 deletions irctest/runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest

from irctest.specifications import OptionalBehaviors


class NotImplementedByController(unittest.SkipTest, NotImplementedError):
def __str__(self) -> str:
Expand All @@ -15,6 +17,9 @@ def __str__(self) -> str:


class OptionalBehaviorNotSupported(unittest.SkipTest):
def __init__(self, reason: OptionalBehaviors) -> None:
super().__init__(reason.value)

def __str__(self) -> str:
return f"Optional behavior not supported: {self.args[0]}"

Expand Down
7 changes: 5 additions & 2 deletions irctest/server_tests/chathistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import functools
import secrets
import time
import unittest

import pytest

from irctest import cases, runner
from irctest import cases
from irctest.irc_utils.junkdrawer import random_name
from irctest.patma import ANYSTR, StrRe

Expand All @@ -23,7 +24,9 @@ def skip_ngircd(f):
@functools.wraps(f)
def newf(self, *args, **kwargs):
if self.controller.software_name == "ngIRCd":
raise runner.OptionalExtensionNotSupported("nicks longer 9 characters")
raise unittest.SkipTest(
"ngIRCd does not support nicks longer than 9 characters"
)
return f(self, *args, **kwargs)

return newf
Expand Down
9 changes: 6 additions & 3 deletions irctest/server_tests/chmodes/ban.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from irctest import cases, runner
from irctest.numerics import ERR_BANNEDFROMCHAN, RPL_BANLIST, RPL_ENDOFBANLIST
from irctest.patma import ANYSTR, StrRe
from irctest.specifications import OptionalBehaviors


class BanModeTestCase(cases.BaseServerTestCase):
Expand Down Expand Up @@ -105,8 +106,8 @@ def testBanException(self):
mode = "e"
if "CHANMODES" in self.server_support:
if "e" not in self.server_support["CHANMODES"]:
raise runner.OptionalExtensionNotSupported(
"Ban exception (or mode letter is not +e)"
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.BAN_EXCEPTION_MODE,
)
self.assertIn(
mode,
Expand All @@ -115,7 +116,9 @@ def testBanException(self):
"but 'e' is not in group A",
)
else:
raise runner.OptionalExtensionNotSupported("ISUPPORT CHANMODES")
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.BAN_EXCEPTION_MODE,
)

self.sendLine("chanop", "JOIN #chan")
self.getMessages("chanop")
Expand Down
9 changes: 6 additions & 3 deletions irctest/server_tests/chmodes/invite_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from irctest import cases, runner
from irctest.numerics import ERR_INVITEONLYCHAN, RPL_ENDOFINVEXLIST, RPL_INVEXLIST
from irctest.patma import ANYSTR, StrRe
from irctest.specifications import OptionalBehaviors


@cases.mark_isupport("INVEX")
Expand Down Expand Up @@ -37,8 +38,8 @@ def getInviteExceptionMode(self) -> str:
if self.server_support and "CHANMODES" in self.server_support:
chanmodes = self.server_support["CHANMODES"]
if chanmodes and "I" not in chanmodes:
raise runner.OptionalExtensionNotSupported(
"Invite exception (or mode letter is not +I)"
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.INVITE_EXCEPTION_MODE,
)
if chanmodes:
self.assertIn(
Expand All @@ -48,7 +49,9 @@ def getInviteExceptionMode(self) -> str:
"but 'I' is not in group A",
)
else:
raise runner.OptionalExtensionNotSupported("ISUPPORT CHANMODES")
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.INVITE_EXCEPTION_MODE,
)
return mode

@cases.mark_specifications("Modern")
Expand Down
9 changes: 5 additions & 4 deletions irctest/server_tests/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
RPL_NAMREPLY,
)
from irctest.patma import ANYSTR, StrRe
from irctest.specifications import OptionalBehaviors

ERR_BADCHANNAME = "479" # Hybrid only, and conflicts with others

Expand Down Expand Up @@ -113,7 +114,7 @@ def testJoinPartiallyInvalid(self):
"""TODO: specify this in Modern"""
self.connectClient("foo")
if int(self.targmax.get("JOIN") or "4") < 2:
raise runner.OptionalExtensionNotSupported("multi-channel JOIN")
raise runner.OptionalBehaviorNotSupported(OptionalBehaviors.MULTI_JOIN)

self.sendLine(1, "JOIN #valid,inv@lid")
messages = self.getMessages(1)
Expand Down Expand Up @@ -155,7 +156,7 @@ def testJoinPartiallyInvalidLabeledResponse(self):
"foo", capabilities=["batch", "labeled-response"], skip_if_cap_nak=True
)
if int(self.targmax.get("JOIN") or "4") < 2:
raise runner.OptionalExtensionNotSupported("multi-channel JOIN")
raise runner.OptionalBehaviorNotSupported(OptionalBehaviors.MULTI_JOIN)

self.sendLine(1, "@label=label1 JOIN #valid,inv@lid")
messages = self.getMessages(1)
Expand Down Expand Up @@ -222,7 +223,7 @@ def testJoinKeys(self):
"""Joins two channels, both with keys"""
self.connectClient("chanop")
if self.targmax.get("JOIN", "1000") == "1":
raise runner.OptionalExtensionNotSupported("Multi-target JOIN")
raise runner.OptionalBehaviorNotSupported(OptionalBehaviors.MULTI_JOIN)
self.joinChannel(1, "#chan1")
self.sendLine(1, "MODE #chan1 +k key1")
self.getMessages(1)
Expand Down Expand Up @@ -252,7 +253,7 @@ def testJoinManySingleKey(self):
"""Joins two channels, the first one has a key."""
self.connectClient("chanop")
if self.targmax.get("JOIN", "1000") == "1":
raise runner.OptionalExtensionNotSupported("Multi-target JOIN")
raise runner.OptionalBehaviorNotSupported(OptionalBehaviors.MULTI_JOIN)
self.joinChannel(1, "#chan1")
self.sendLine(1, "MODE #chan1 +k key1")
self.getMessages(1)
Expand Down
6 changes: 3 additions & 3 deletions irctest/server_tests/labeled_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import pytest

from irctest import cases
from irctest import cases, runner
from irctest.numerics import ERR_UNKNOWNCOMMAND
from irctest.patma import ANYDICT, ANYOPTSTR, NotStrRe, RemainingKeys, StrRe
from irctest.runner import OptionalExtensionNotSupported
from irctest.specifications import OptionalBehaviors


class LabeledResponsesTestCase(cases.BaseServerTestCase):
Expand All @@ -24,7 +24,7 @@ def testLabeledPrivmsgResponsesToMultipleClients(self):
skip_if_cap_nak=True,
)
if int(self.targmax.get("PRIVMSG", "1") or "4") < 3:
raise OptionalExtensionNotSupported("PRIVMSG to multiple targets")
raise runner.OptionalBehaviorNotSupported(OptionalBehaviors.MULTI_PRIVMSG)
self.getMessages(1)

self.connectClient(
Expand Down
4 changes: 1 addition & 3 deletions irctest/server_tests/message_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ def testRecipientCapability(self):
if clienttagdeny:
parts = clienttagdeny.split(",")
if "*" in parts and "+draft/reply" not in parts:
raise runner.OptionalExtensionNotSupported(
"CLIENTTAGDENY blocks +draft/reply"
)
raise runner.ImplementationChoice("CLIENTTAGDENY blocks +draft/reply")

self.connectClient("bob")
self.getMessages(1)
Expand Down
5 changes: 3 additions & 2 deletions irctest/server_tests/metadata_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from irctest import cases, runner
from irctest.numerics import RPL_METADATASUBOK, RPL_WHOISKEYVALUE
from irctest.patma import ANYDICT, ANYLIST, ANYSTR, Either
from irctest.specifications import OptionalBehaviors

CLIENT_NICKS = {
1: "foo",
Expand Down Expand Up @@ -563,8 +564,8 @@ def testSetGetValidBeforeConnect(self):
self.sendLine(1, "CAP LS 302")
caps = self.getCapLs(1)
if "before-connect" not in (caps.get("draft/metadata-2") or "").split(","):
raise runner.OptionalExtensionNotSupported(
"draft/metadata-2=before-connect"
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.METADATA_BEFORE_CONNECT
)

self.requestCapabilities(1, ["draft/metadata-2", "batch"], skip_if_cap_nak=True)
Expand Down
5 changes: 4 additions & 1 deletion irctest/server_tests/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from irctest import cases, runner
from irctest.numerics import RPL_ENDOFNAMES, RPL_NAMREPLY
from irctest.patma import ANYSTR, StrRe
from irctest.specifications import OptionalBehaviors


class NamesTestCase(cases.BaseServerTestCase):
Expand Down Expand Up @@ -105,7 +106,9 @@ def _testNamesMultipleChannels(self, symbol):
self.connectClient("nick1")

if self.targmax.get("NAMES", "1") == "1":
raise runner.OptionalExtensionNotSupported("Multi-target NAMES")
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.MULTI_NAMES_COMMAND
)

self.sendLine(1, "JOIN #chan1")
self.sendLine(1, "JOIN #chan2")
Expand Down
10 changes: 5 additions & 5 deletions irctest/server_tests/sasl.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def testPlainPostRegistration(self):
time.sleep(2)
m = self.getMessage(1)
if m.command == ERR_ALREADYREGISTERED:
raise runner.OptionalExtensionNotSupported(
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.SASL_AFTER_REGISTRATION
)
self.assertMessageMatch(
Expand Down Expand Up @@ -496,7 +496,7 @@ def testPlainPostRegistrationAndReAuthenticate(self):
time.sleep(2)
m = self.getMessage(1)
if m.command == ERR_ALREADYREGISTERED:
raise runner.OptionalExtensionNotSupported(
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.SASL_AFTER_REGISTRATION
)
self.assertMessageMatch(
Expand All @@ -522,7 +522,7 @@ def testPlainPostRegistrationAndReAuthenticate(self):
"replied with “AUTHENTICATE +” or 907 (ERR_SASLALREADY), "
"but instead sent: {msg}",
)
raise runner.OptionalExtensionNotSupported(
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.SASL_REAUTHENTICATION
)
self.assertMessageMatch(
Expand Down Expand Up @@ -564,7 +564,7 @@ def testPlainReAuthenticate(self):
time.sleep(2)
m = self.getMessage(1)
if m.command == ERR_ALREADYREGISTERED:
raise runner.OptionalExtensionNotSupported(
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.SASL_AFTER_REGISTRATION
)
elif m.command == ERR_SASLALREADY:
Expand All @@ -576,7 +576,7 @@ def testPlainReAuthenticate(self):
"replied with “AUTHENTICATE +” or 907 (ERR_SASLALREADY), "
"but instead sent: {msg}",
)
raise runner.OptionalExtensionNotSupported(
raise runner.OptionalBehaviorNotSupported(
OptionalBehaviors.SASL_REAUTHENTICATION
)
self.assertMessageMatch(
Expand Down
17 changes: 9 additions & 8 deletions irctest/server_tests/who.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import re
import unittest

import pytest

Expand Down Expand Up @@ -88,7 +89,7 @@ class WhoTestCase(BaseWhoTestCase, cases.BaseServerTestCase):
@cases.mark_specifications("Modern")
def testWhoStar(self):
if self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -119,7 +120,7 @@ def testWhoStar(self):
@cases.mark_specifications("Modern")
def testWhoNick(self, mask):
if "*" in mask and self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -149,7 +150,7 @@ def testWhoNick(self, mask):
)
def testWhoUsernameRealName(self, mask):
if "*" in mask and self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -202,7 +203,7 @@ def testWhoRealNameSpaces(self):
@cases.mark_specifications("Modern")
def testWhoNickAway(self, mask):
if "*" in mask and self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -236,7 +237,7 @@ def testWhoNickAway(self, mask):
@cases.mark_specifications("Modern")
def testWhoNickOper(self, mask):
if "*" in mask and self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -275,7 +276,7 @@ def testWhoNickOper(self, mask):
@cases.mark_specifications("Modern")
def testWhoNickAwayAndOper(self, mask):
if "*" in mask and self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -309,7 +310,7 @@ def testWhoNickAwayAndOper(self, mask):
@cases.mark_specifications("Modern")
def testWhoChan(self, mask):
if "*" in mask and self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self._init()

Expand Down Expand Up @@ -633,7 +634,7 @@ class WhoInvisibleTestCase(cases.BaseServerTestCase):
@cases.mark_specifications("Modern")
def testWhoInvisible(self):
if self.controller.software_name in ("Bahamut",):
raise runner.OptionalExtensionNotSupported("WHO mask")
raise unittest.SkipTest("Bahamut does not support WHO mask")

self.connectClient("evan", name="evan")
self.sendLine("evan", "MODE evan +i")
Expand Down
3 changes: 2 additions & 1 deletion irctest/server_tests/whowas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import time
import unittest

import pytest

Expand Down Expand Up @@ -275,7 +276,7 @@ def testWhowasWildcard(self):
-- https://modern.ircdocs.horse/#whowas-message
"""
if self.controller.software_name == "Bahamut":
raise runner.OptionalExtensionNotSupported("WHOWAS mask")
raise unittest.SkipTest("Bahamut does not support WHOWAS masks")

self._testWhowasMultiple(second_result=True, whowas_command="WHOWAS *ck2")

Expand Down
Loading
Loading