mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-26 04:32:51 +01:00
Anonymous: Simplify/modernize @internationalizeDocstring and var setting in test.
This commit is contained in:
parent
7861040c37
commit
544f137c64
@ -78,7 +78,6 @@ class Anonymous(callbacks.Plugin):
|
|||||||
irc.error(_('This command is disabled (supybot.plugins.Anonymous.'
|
irc.error(_('This command is disabled (supybot.plugins.Anonymous.'
|
||||||
'allowPrivateTarget is False).'), Raise=True)
|
'allowPrivateTarget is False).'), Raise=True)
|
||||||
|
|
||||||
@internationalizeDocstring
|
|
||||||
def say(self, irc, msg, args, target, text):
|
def say(self, irc, msg, args, target, text):
|
||||||
"""<channel> <text>
|
"""<channel> <text>
|
||||||
|
|
||||||
@ -104,7 +103,6 @@ class Anonymous(callbacks.Plugin):
|
|||||||
irc.noReply()
|
irc.noReply()
|
||||||
tell = wrap(tell, ['nick', 'text'])
|
tell = wrap(tell, ['nick', 'text'])
|
||||||
|
|
||||||
@internationalizeDocstring
|
|
||||||
def do(self, irc, msg, args, channel, text):
|
def do(self, irc, msg, args, channel, text):
|
||||||
"""<channel> <action>
|
"""<channel> <action>
|
||||||
|
|
||||||
|
@ -34,38 +34,27 @@ class AnonymousTestCase(ChannelPluginTestCase):
|
|||||||
plugins = ('Anonymous',)
|
plugins = ('Anonymous',)
|
||||||
def testSay(self):
|
def testSay(self):
|
||||||
self.assertError('anonymous say %s I love you!' % self.channel)
|
self.assertError('anonymous say %s I love you!' % self.channel)
|
||||||
origreg = conf.supybot.plugins.Anonymous.requireRegistration()
|
|
||||||
try:
|
with conf.supybot.plugins.Anonymous.requireRegistration.context(False):
|
||||||
conf.supybot.plugins.Anonymous.requireRegistration.setValue(False)
|
|
||||||
m = self.assertNotError('anonymous say %s foo!' % self.channel)
|
m = self.assertNotError('anonymous say %s foo!' % self.channel)
|
||||||
self.assertTrue(m.args[1] == 'foo!')
|
self.assertTrue(m.args[1] == 'foo!')
|
||||||
finally:
|
|
||||||
conf.supybot.plugins.Anonymous.requireRegistration.setValue(origreg)
|
|
||||||
|
|
||||||
def testTell(self):
|
def testTell(self):
|
||||||
self.assertError('anonymous tell %s I love you!' % self.nick)
|
self.assertError('anonymous tell %s I love you!' % self.nick)
|
||||||
origreg = conf.supybot.plugins.Anonymous.requireRegistration()
|
|
||||||
origpriv = conf.supybot.plugins.Anonymous.allowPrivateTarget()
|
with conf.supybot.plugins.Anonymous.requireRegistration.context(False):
|
||||||
try:
|
|
||||||
conf.supybot.plugins.Anonymous.requireRegistration.setValue(False)
|
|
||||||
self.assertError('anonymous tell %s foo!' % self.channel)
|
self.assertError('anonymous tell %s foo!' % self.channel)
|
||||||
conf.supybot.plugins.Anonymous.allowPrivateTarget.setValue(True)
|
with conf.supybot.plugins.Anonymous.allowPrivateTarget.context(True):
|
||||||
m = self.assertNotError('anonymous tell %s foo!' % self.nick)
|
m = self.assertNotError('anonymous tell %s foo!' % self.nick)
|
||||||
self.assertTrue(m.args[1] == 'foo!')
|
self.assertTrue(m.args[1] == 'foo!')
|
||||||
finally:
|
|
||||||
conf.supybot.plugins.Anonymous.requireRegistration.setValue(origreg)
|
|
||||||
conf.supybot.plugins.Anonymous.allowPrivateTarget.setValue(origpriv)
|
|
||||||
|
|
||||||
def testAction(self):
|
def testAction(self):
|
||||||
m = self.assertError('anonymous do %s loves you!' % self.channel)
|
m = self.assertError('anonymous do %s loves you!' % self.channel)
|
||||||
try:
|
|
||||||
orig = conf.supybot.plugins.Anonymous.requireRegistration()
|
with conf.supybot.plugins.Anonymous.requireRegistration.context(False):
|
||||||
conf.supybot.plugins.Anonymous.requireRegistration.setValue(False)
|
|
||||||
m = self.assertNotError('anonymous do %s loves you!'%self.channel)
|
m = self.assertNotError('anonymous do %s loves you!'%self.channel)
|
||||||
self.assertEqual(m.args, ircmsgs.action(self.channel,
|
self.assertEqual(m.args, ircmsgs.action(self.channel,
|
||||||
'loves you!').args)
|
'loves you!').args)
|
||||||
finally:
|
|
||||||
conf.supybot.plugins.Anonymous.requireRegistration.setValue(orig)
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
Reference in New Issue
Block a user