Add various validation tests (#221)

* Add various validation tests

* skip UTF8ONLY tests on servers that don't support it

* Fixes for Ergo

* Fixes for Nefarious and ircu2

* xfail for irc2 and workaround for ngIRCd

* Bump ngIRCd to the ERR_NOTEXTTOSEND fix
This commit is contained in:
2023-09-18 20:31:50 +02:00
committed by GitHub
parent 04d0c8000f
commit 3692f2d79d
6 changed files with 121 additions and 5 deletions

View File

@ -46,3 +46,38 @@ class Utf8TestCase(cases.BaseServerTestCase):
if m.command in ("FAIL", "WARN"):
self.assertMessageMatch(m, params=["PRIVMSG", "INVALID_UTF8", ANYSTR])
def testNonutf8Realname(self):
self.connectClient("foo")
if "UTF8ONLY" not in self.server_support:
raise runner.IsupportTokenNotSupported("UTF8ONLY")
self.addClient()
self.sendLine(2, "NICK foo")
self.clients[2].conn.sendall(b"USER username * * :i\xe8rc\xe9\r\n")
d = self.clients[2].conn.recv(1024)
if b" FAIL " in d or b" 468 " in d: # ERR_INVALIDUSERNAME
return # nothing more to test
self.assertIn(b" 001 ", d)
self.sendLine(2, "WHOIS foo")
self.getMessages(2)
def testNonutf8Username(self):
self.connectClient("foo")
if "UTF8ONLY" not in self.server_support:
raise runner.IsupportTokenNotSupported("UTF8ONLY")
self.addClient()
self.sendLine(2, "NICK foo")
self.sendLine(2, "USER 😊😊😊😊😊😊😊😊😊😊 * * :realname")
m = self.getRegistrationMessage(2)
if m.command in ("FAIL", "468"): # ERR_INVALIDUSERNAME
return # nothing more to test
self.assertMessageMatch(
m,
command="001",
)
self.sendLine(2, "WHOIS foo")
self.getMessages(2)