mirror of
https://github.com/progval/irctest.git
synced 2025-04-06 23:39:46 +00:00
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:
@ -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)
|
||||
|
Reference in New Issue
Block a user