Skip to content

Commit

Permalink
add regression test for oragono #1370
Browse files Browse the repository at this point in the history
  • Loading branch information
slingamn committed Nov 1, 2020
1 parent d48cbc4 commit 512b4bd
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions irctest/server_tests/test_channel_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,3 +996,40 @@ def testMuteExtban(self):
self.assertIn('PRIVMSG', replies_cmds)
self.assertNotIn(ERR_CANNOTSENDTOCHAN, replies_cmds)
self.assertEqual(self.getMessages('chanop'), [msg for msg in replies if msg.command == 'PRIVMSG'])

@cases.SpecificationSelector.requiredBySpecification('Oragono')
def testIssue1370(self):
# regression test for oragono #1370: mutes not correctly enforced against
# users with capital letters in their NUH
clients = ('chanop', 'bar')

self.connectClient('chanop', name='chanop', capabilities=MODERN_CAPS)
self.joinChannel('chanop', '#chan')
self.getMessages('chanop')
self.sendLine('chanop', 'MODE #chan +b m:BAR!*@*')
replies = {msg.command for msg in self.getMessages('chanop')}
self.assertIn('MODE', replies)
self.assertNotIn(ERR_CHANOPRIVSNEEDED, replies)

self.connectClient('Bar', name='bar', capabilities=MODERN_CAPS)
self.joinChannel('bar', '#chan')

for client in clients:
self.getMessages(client)

self.sendLine('bar', 'PRIVMSG #chan :hi from bar')
replies = self.getMessages('bar')
replies_cmds = {msg.command for msg in replies}
self.assertNotIn('PRIVMSG', replies_cmds)
self.assertIn(ERR_CANNOTSENDTOCHAN, replies_cmds)
self.assertEqual(self.getMessages('chanop'), [])

# remove mute with -b
self.sendLine('chanop', 'MODE #chan -b m:bar!*@*')
self.getMessages('chanop')
self.sendLine('bar', 'PRIVMSG #chan :hi again from bar')
replies = self.getMessages('bar')
replies_cmds = {msg.command for msg in replies}
self.assertIn('PRIVMSG', replies_cmds)
self.assertNotIn(ERR_CANNOTSENDTOCHAN, replies_cmds)
self.assertEqual(self.getMessages('chanop'), [msg for msg in replies if msg.command == 'PRIVMSG'])

0 comments on commit 512b4bd

Please sign in to comment.