mirror of https://github.com/progval/irctest.git
Add tests for PING and PONG
This commit is contained in:
parent
15d21f4ee4
commit
03a401f911
|
@ -16,7 +16,7 @@ OPER_PWD = "frenchfries"
|
||||||
BASE_CONFIG = {
|
BASE_CONFIG = {
|
||||||
"network": {"name": "ErgoTest"},
|
"network": {"name": "ErgoTest"},
|
||||||
"server": {
|
"server": {
|
||||||
"name": "ergo.test",
|
"name": "My.Little.Server",
|
||||||
"listeners": {},
|
"listeners": {},
|
||||||
"max-sendq": "16k",
|
"max-sendq": "16k",
|
||||||
"connection-limits": {
|
"connection-limits": {
|
||||||
|
|
|
@ -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]
|
||||||
|
)
|
Loading…
Reference in New Issue