From ff0d795485ca8643189704820f46c0e163dca942 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 13 Aug 2021 22:48:11 +0200 Subject: [PATCH] Add TARGMAX test --- irctest/server_tests/isupport.py | 26 ++++++++++++++++++++++++++ irctest/specifications.py | 1 + pytest.ini | 1 + 3 files changed, 28 insertions(+) create mode 100644 irctest/server_tests/isupport.py diff --git a/irctest/server_tests/isupport.py b/irctest/server_tests/isupport.py new file mode 100644 index 0000000..4a68a1a --- /dev/null +++ b/irctest/server_tests/isupport.py @@ -0,0 +1,26 @@ +import re + +from irctest import cases, runner + + +class IsupportTestCase(cases.BaseServerTestCase): + @cases.mark_specifications("Modern", "ircdocs") + @cases.mark_isupport("TARGMAX") + def testTargmax(self): + """ + "Format: TARGMAX=[:[limit]{,:[limit]}]" + -- https://modern.ircdocs.horse/#targmax-parameter + + "TARGMAX=[cmd:[number][,cmd:[number][,...]]]" + -- https://defs.ircdocs.horse/defs/isupport.html#targmax + """ + self.connectClient("foo") + + if "TARGMAX" not in self.server_support: + raise runner.NotImplementedByController("TARGMAX") + + parts = self.server_support["TARGMAX"].split(",") + for part in parts: + self.assertTrue( + re.match("[A-Z]+:[0-9]*", part), "Invalid TARGMAX key:value: %r", part + ) diff --git a/irctest/specifications.py b/irctest/specifications.py index 6ea2d87..71a5bcf 100644 --- a/irctest/specifications.py +++ b/irctest/specifications.py @@ -52,6 +52,7 @@ class IsupportTokens(enum.Enum): BOT = "BOT" MONITOR = "MONITOR" STATUSMSG = "STATUSMSG" + TARGMAX = "TARGMAX" @classmethod def from_name(cls, name: str) -> IsupportTokens: diff --git a/pytest.ini b/pytest.ini index 1dca41c..221add7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -34,5 +34,6 @@ markers = BOT MONITOR STATUSMSG + TARGMAX python_classes = *TestCase Test*