Admin: Actually clean up test channel from configuration

943f39745d 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
This commit is contained in:
Valentin Lorentz 2024-04-26 09:04:45 +02:00
parent 6758c00363
commit d435442b39

View File

@ -50,6 +50,7 @@ class AdminTestCase(PluginTestCase):
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')
@ -96,7 +97,7 @@ class AdminTestCase(PluginTestCase):
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:
@ -110,10 +111,13 @@ class AdminTestCase(PluginTestCase):
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:
@ -124,6 +128,7 @@ class AdminTestCase(PluginTestCase):
'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))