diff --git a/irctest/controllers/ergo.py b/irctest/controllers/ergo.py index 7fa8f74..1b276c0 100644 --- a/irctest/controllers/ergo.py +++ b/irctest/controllers/ergo.py @@ -16,7 +16,7 @@ OPER_PWD = "frenchfries" BASE_CONFIG = { "network": {"name": "ErgoTest"}, "server": { - "name": "ergo.test", + "name": "My.Little.Server", "listeners": {}, "max-sendq": "16k", "connection-limits": { diff --git a/irctest/server_tests/pingpong.py b/irctest/server_tests/pingpong.py new file mode 100644 index 0000000..33dc4aa --- /dev/null +++ b/irctest/server_tests/pingpong.py @@ -0,0 +1,42 @@ +from irctest import cases +from irctest.numerics import ERR_NEEDMOREPARAMS, ERR_NOORIGIN +from irctest.patma import ANYSTR + + +class PingPongTestCase(cases.BaseServerTestCase): + @cases.mark_specifications("Modern") + def testPing(self): + """https://github.com/ircdocs/modern-irc/pull/99""" + self.connectClient("foo") + self.sendLine(1, "PING abcdef") + self.assertMessageMatch( + self.getMessage(1), command="PONG", params=["My.Little.Server", "abcdef"] + ) + + @cases.mark_specifications("Modern") + def testPingNoToken(self): + """https://github.com/ircdocs/modern-irc/pull/99""" + self.connectClient("foo") + self.sendLine(1, "PING") + m = self.getMessage(1) + if m.command == ERR_NOORIGIN: + self.assertMessageMatch(m, command=ERR_NOORIGIN, params=["foo", ANYSTR]) + else: + self.assertMessageMatch( + m, command=ERR_NEEDMOREPARAMS, params=["foo", "PING", ANYSTR] + ) + + @cases.mark_specifications("Modern") + def testPingEmptyToken(self): + """https://github.com/ircdocs/modern-irc/pull/99""" + self.connectClient("foo") + self.sendLine(1, "PING :") + m = self.getMessage(1) + if m.command == "PONG": + self.assertMessageMatch(m, command="PONG", params=["My.Little.Server", ""]) + elif m.command == ERR_NOORIGIN: + self.assertMessageMatch(m, command=ERR_NOORIGIN, params=["foo", ANYSTR]) + else: + self.assertMessageMatch( + m, command=ERR_NEEDMOREPARAMS, params=["foo", "PING", ANYSTR] + )