|
1 | 1 | ### |
2 | 2 | # Copyright (c) 2002-2005, Jeremiah Fincher |
3 | 3 | # Copyright (c) 2009, James McCoy |
4 | | -# Copyright (c) 2010-2021, Valentin Lorentz |
| 4 | +# Copyright (c) 2010-2025, Valentin Lorentz |
5 | 5 | # All rights reserved. |
6 | 6 | # |
7 | 7 | # Redistribution and use in source and binary forms, with or without |
@@ -414,5 +414,39 @@ def getAfterJoinMessages(): |
414 | 414 | self.assertEqual(m.args[0], '#foo') |
415 | 415 | self.assertEqual(m.args[1], 'reason') |
416 | 416 |
|
| 417 | + def testInvite(self): |
| 418 | + self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) |
| 419 | + m = self.getMsg('invite foo') |
| 420 | + self.assertEqual(m.command, 'INVITE') |
| 421 | + self.assertEqual(m.args, ('foo', self.channel)) |
| 422 | + |
| 423 | + def testInviteNoCapability(self): |
| 424 | + self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) |
| 425 | + m = self.assertError('invite foo', |
| 426 | + frm='test!user@with__no_testcap__') |
| 427 | + |
| 428 | + def testInviteCustomCapability(self): |
| 429 | + self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) |
| 430 | + |
| 431 | + self.assertError('invite foo', |
| 432 | + frm='test!user@with__no_testcap__') |
| 433 | + |
| 434 | + with conf.supybot.plugins.Channel.invite.requireCapability.context('freeinvite'): |
| 435 | + m = self.getMsg('invite foo', |
| 436 | + frm='test!user@with__no_testcap__') |
| 437 | + self.assertEqual(m.command, 'INVITE') |
| 438 | + self.assertEqual(m.args, ('foo', self.channel)) |
| 439 | + |
| 440 | + self.assertNotError('channel capability set -freeinvite') |
| 441 | + |
| 442 | + self.assertError('invite foo', |
| 443 | + frm='test!user@with__no_testcap__') |
| 444 | + |
| 445 | + with conf.supybot.plugins.Channel.invite.requireCapability.context(''): |
| 446 | + m = self.getMsg('invite foo', |
| 447 | + frm='test!user@with__no_testcap__') |
| 448 | + self.assertEqual(m.command, 'INVITE') |
| 449 | + self.assertEqual(m.args, ('foo', self.channel)) |
| 450 | + |
417 | 451 | # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: |
418 | 452 |
|
0 commit comments