mirror of
https://github.com/progval/irctest.git
synced 2025-04-08 00:09:46 +00:00
whox: Add test for individual chars (#227)
It makes it easier to debug missing params
This commit is contained in:
4
Makefile
4
Makefile
@ -35,22 +35,18 @@ INSPIRCD_SELECTORS := \
|
|||||||
and not strict \
|
and not strict \
|
||||||
$(EXTRA_SELECTORS)
|
$(EXTRA_SELECTORS)
|
||||||
|
|
||||||
# HelpTestCase fails because it returns NOTICEs instead of numerics
|
|
||||||
IRCU2_SELECTORS := \
|
IRCU2_SELECTORS := \
|
||||||
not Ergo \
|
not Ergo \
|
||||||
and not deprecated \
|
and not deprecated \
|
||||||
and not strict \
|
and not strict \
|
||||||
$(EXTRA_SELECTORS)
|
$(EXTRA_SELECTORS)
|
||||||
|
|
||||||
# same justification as ircu2
|
|
||||||
# lusers "unregistered" tests fail because
|
|
||||||
NEFARIOUS_SELECTORS := \
|
NEFARIOUS_SELECTORS := \
|
||||||
not Ergo \
|
not Ergo \
|
||||||
and not deprecated \
|
and not deprecated \
|
||||||
and not strict \
|
and not strict \
|
||||||
$(EXTRA_SELECTORS)
|
$(EXTRA_SELECTORS)
|
||||||
|
|
||||||
# same justification as ircu2
|
|
||||||
SNIRCD_SELECTORS := \
|
SNIRCD_SELECTORS := \
|
||||||
not Ergo \
|
not Ergo \
|
||||||
and not deprecated \
|
and not deprecated \
|
||||||
|
@ -802,7 +802,7 @@ def xfailIf(
|
|||||||
def decorator(f: Callable[..., _TReturn]) -> Callable[..., _TReturn]:
|
def decorator(f: Callable[..., _TReturn]) -> Callable[..., _TReturn]:
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def newf(self: _TSelf, *args: Any, **kwargs: Any) -> _TReturn:
|
def newf(self: _TSelf, *args: Any, **kwargs: Any) -> _TReturn:
|
||||||
if condition(self):
|
if condition(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
return f(self, *args, **kwargs)
|
return f(self, *args, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -819,7 +819,10 @@ def xfailIf(
|
|||||||
def xfailIfSoftware(
|
def xfailIfSoftware(
|
||||||
names: List[str], reason: str
|
names: List[str], reason: str
|
||||||
) -> Callable[[Callable[..., _TReturn]], Callable[..., _TReturn]]:
|
) -> Callable[[Callable[..., _TReturn]], Callable[..., _TReturn]]:
|
||||||
return xfailIf(lambda testcase: testcase.controller.software_name in names, reason)
|
def pred(testcase: _IrcTestCase, *args: Any, **kwargs: Any) -> bool:
|
||||||
|
return testcase.controller.software_name in names
|
||||||
|
|
||||||
|
return xfailIf(pred, reason)
|
||||||
|
|
||||||
|
|
||||||
def mark_services(cls: TClass) -> TClass:
|
def mark_services(cls: TClass) -> TClass:
|
||||||
|
@ -496,6 +496,46 @@ class WhoTestCase(BaseWhoTestCase, cases.BaseServerTestCase):
|
|||||||
params=["otherNick", InsensitiveStr("coolNick"), ANYSTR],
|
params=["otherNick", InsensitiveStr("coolNick"), ANYSTR],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("char", "cuihsnfdlaor")
|
||||||
|
@cases.xfailIf(
|
||||||
|
lambda self, char: bool(
|
||||||
|
char == "l" and self.controller.software_name == "ircu2"
|
||||||
|
),
|
||||||
|
"https://github.com/UndernetIRC/ircu2/commit/17c539103abbd0055b2297e17854cd0756c85d62",
|
||||||
|
)
|
||||||
|
@cases.xfailIf(
|
||||||
|
lambda self, char: bool(
|
||||||
|
char == "l" and self.controller.software_name == "Nefarious"
|
||||||
|
),
|
||||||
|
"https://github.com/evilnet/nefarious2/pull/73",
|
||||||
|
)
|
||||||
|
def testWhoxOneChar(self, char):
|
||||||
|
self._init()
|
||||||
|
if "WHOX" not in self.server_support:
|
||||||
|
raise runner.IsupportTokenNotSupported("WHOX")
|
||||||
|
|
||||||
|
self.sendLine(2, f"WHO coolNick %{char}")
|
||||||
|
messages = self.getMessages(2)
|
||||||
|
|
||||||
|
self.assertEqual(len(messages), 2, "Unexpected number of messages")
|
||||||
|
|
||||||
|
(reply, end) = messages
|
||||||
|
|
||||||
|
self.assertMessageMatch(
|
||||||
|
reply,
|
||||||
|
command=RPL_WHOSPCRPL,
|
||||||
|
params=[
|
||||||
|
"otherNick",
|
||||||
|
StrRe(".+"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertMessageMatch(
|
||||||
|
end,
|
||||||
|
command=RPL_ENDOFWHO,
|
||||||
|
params=["otherNick", InsensitiveStr("coolNick"), ANYSTR],
|
||||||
|
)
|
||||||
|
|
||||||
def testWhoxToken(self):
|
def testWhoxToken(self):
|
||||||
"""https://github.com/ircv3/ircv3-specifications/pull/482"""
|
"""https://github.com/ircv3/ircv3-specifications/pull/482"""
|
||||||
self._init()
|
self._init()
|
||||||
|
Reference in New Issue
Block a user