Skip to content

Commit

Permalink
Admin: Actually clean up test channel from configuration
Browse files Browse the repository at this point in the history
943f397 did not actually because:

1. the 'part' command is not available (it's in the Channel plugin)
   so it just didn't do anything
2. one of the tests was missing the cleanup
  • Loading branch information
progval committed Apr 26, 2024
1 parent 6758c00 commit d435442
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions plugins/Admin/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def getAfterJoinMessages():
self.irc.feedMsg(ircmsgs.join('#Baz', prefix=self.prefix))
getAfterJoinMessages()
self.assertRegexp('channels', '#bar, #Baz, and #foo')
self.assertNotRegexp('config networks.test.channels', '.*#foo.*')

def testIgnoreAddRemove(self):
self.assertNotError('admin ignore add foo!bar@baz')
Expand Down Expand Up @@ -96,7 +97,7 @@ def testJoin(self):
self.assertEqual(m.args[0], '#foo')
self.assertEqual(m.args[1], 'key')
finally:
self.getMsg('part #foo')
conf.supybot.networks.test.channels.setValue('')

def testNick(self):
try:
Expand All @@ -110,10 +111,13 @@ def testAddCapabilityOwner(self):
self.assertError('admin capability add %s owner' % self.nick)

def testJoinOnOwnerInvite(self):
self.irc.feedMsg(ircmsgs.invite(conf.supybot.nick(), '#foo', prefix=self.prefix))
m = self.getMsg(' ')
self.assertEqual(m.command, 'JOIN')
self.assertEqual(m.args[0], '#foo')
try:
self.irc.feedMsg(ircmsgs.invite(conf.supybot.nick(), '#foo', prefix=self.prefix))
m = self.getMsg(' ')
self.assertEqual(m.command, 'JOIN')
self.assertEqual(m.args[0], '#foo')
finally:
conf.supybot.networks.test.channels.setValue('')

def testNoJoinOnUnprivilegedInvite(self):
try:
Expand All @@ -124,6 +128,7 @@ def testNoJoinOnUnprivilegedInvite(self):
'Error: "somecommand" is not a valid command.')
finally:
world.testing = True
self.assertNotRegexp('config networks.test.channels', '.*#foo.*')

def testAcmd(self):
self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix))
Expand Down

0 comments on commit d435442

Please sign in to comment.