Prevent 433 response for Nonutf8{User/Real}name (#244)

Sending `NICK foo` after connectClient() causes an ERR_NICKNAMEINUSE
response instead of the expected RPL_WELCOME.
This commit is contained in:
Mitchell Riley 2023-12-31 13:47:18 -05:00 committed by GitHub
parent 6425e707ac
commit 18d04e8f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,15 +54,15 @@ class Utf8TestCase(cases.BaseServerTestCase):
raise runner.IsupportTokenNotSupported("UTF8ONLY")
self.addClient()
self.sendLine(2, "NICK foo")
self.sendLine(2, "NICK bar")
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
if b"FAIL " in d or b"468 " in d: # ERR_INVALIDUSERNAME
return # nothing more to test
self.assertIn(b" 001 ", d)
self.assertIn(b"001 ", d)
self.sendLine(2, "WHOIS foo")
self.sendLine(2, "WHOIS bar")
self.getMessages(2)
def testNonutf8Username(self):
@ -71,7 +71,7 @@ class Utf8TestCase(cases.BaseServerTestCase):
raise runner.IsupportTokenNotSupported("UTF8ONLY")
self.addClient()
self.sendLine(2, "NICK foo")
self.sendLine(2, "NICK bar")
self.sendLine(2, "USER 😊😊😊😊😊😊😊😊😊😊 * * :realname")
m = self.getRegistrationMessage(2)
if m.command in ("FAIL", "468"): # ERR_INVALIDUSERNAME
@ -80,7 +80,7 @@ class Utf8TestCase(cases.BaseServerTestCase):
m,
command="001",
)
self.sendLine(2, "WHOIS foo")
self.sendLine(2, "WHOIS bar")
self.getMessages(2)