add more nickname tests

This commit is contained in:
Shivaram Lingamneni 2020-08-30 16:22:25 -04:00
parent ed2b6148e5
commit f09ec7d9aa

View File

@ -96,6 +96,14 @@ class RegressionsTestCase(cases.BaseServerTestCase):
self.assertNotIn(ERR_ERRONEUSNICKNAME, replies) self.assertNotIn(ERR_ERRONEUSNICKNAME, replies)
self.assertIn(RPL_WELCOME, replies) self.assertIn(RPL_WELCOME, replies)
@cases.SpecificationSelector.requiredBySpecification('RFC1459')
def testEmptyNick(self):
self.addClient(1)
self.sendLine(1, 'NICK :')
self.sendLine(1, 'USER u s e r')
replies = set(msg.command for msg in self.getMessages(1))
self.assertNotIn(RPL_WELCOME, replies)
@cases.SpecificationSelector.requiredBySpecification('RFC1459') @cases.SpecificationSelector.requiredBySpecification('RFC1459')
def testNickRelease(self): def testNickRelease(self):
# regression test for oragono #1252 # regression test for oragono #1252
@ -112,3 +120,40 @@ class RegressionsTestCase(cases.BaseServerTestCase):
replies = set(msg.command for msg in self.getMessages(2)) replies = set(msg.command for msg in self.getMessages(2))
self.assertNotIn(ERR_NICKNAMEINUSE, replies) self.assertNotIn(ERR_NICKNAMEINUSE, replies)
self.assertIn(RPL_WELCOME, replies) self.assertIn(RPL_WELCOME, replies)
@cases.SpecificationSelector.requiredBySpecification('RFC1459')
def testNickReleaseQuit(self):
self.connectClient('alice')
self.getMessages(1)
self.sendLine(1, 'QUIT')
self.assertDisconnected(1)
self.addClient(2)
self.sendLine(2, 'NICK alice')
self.sendLine(2, 'USER u s e r')
replies = set(msg.command for msg in self.getMessages(2))
self.assertNotIn(ERR_NICKNAMEINUSE, replies)
self.assertIn(RPL_WELCOME, replies)
self.sendLine(2, 'QUIT')
self.assertDisconnected(2)
self.addClient(3)
self.sendLine(3, 'NICK ALICE')
self.sendLine(3, 'USER u s e r')
replies = set(msg.command for msg in self.getMessages(3))
self.assertNotIn(ERR_NICKNAMEINUSE, replies)
self.assertIn(RPL_WELCOME, replies)
@cases.SpecificationSelector.requiredBySpecification('RFC1459')
def testNickReleaseUnregistered(self):
self.addClient(1)
self.sendLine(1, 'NICK alice')
self.sendLine(1, 'QUIT')
self.assertDisconnected(1)
self.addClient(2)
self.sendLine(2, 'NICK alice')
self.sendLine(2, 'USER u s e r')
replies = set(msg.command for msg in self.getMessages(2))
self.assertNotIn(ERR_NICKNAMEINUSE, replies)
self.assertIn(RPL_WELCOME, replies)