From 7e756eec798e79a8759d2a88677352156e149e5f Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 4 May 2017 21:53:56 +0200 Subject: [PATCH] Admin: Add tests for joining-on-invite. --- plugins/Admin/test.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugins/Admin/test.py b/plugins/Admin/test.py index 6c090daef..cd6cb65be 100644 --- a/plugins/Admin/test.py +++ b/plugins/Admin/test.py @@ -106,5 +106,29 @@ class AdminTestCase(PluginTestCase): 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') + + def testNoJoinOnUnprivilegedInvite(self): + try: + world.testing = False + self.irc.feedMsg(ircmsgs.invite(conf.supybot.nick(), '#foo', prefix='foo!bar@baz')) + self.assertResponse('somecommand', + 'Error: "somecommand" is not a valid command.') + finally: + world.testing = True + + def testNoJoinOnUnprivilegedInvite(self): + try: + world.testing = False + self.irc.feedMsg(ircmsgs.invite(conf.supybot.nick(), '#foo\u0009', prefix='foo!bar@baz')) + self.assertResponse('somecommand', + 'Error: "somecommand" is not a valid command.') + finally: + world.testing = True + # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: