mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Spread out some tests, made action error on the empty string.
This commit is contained in:
parent
f9894798e3
commit
091be1311d
@ -402,11 +402,15 @@ class Misc(callbacks.Privmsg):
|
|||||||
irc.reply(msg, text, private=True)
|
irc.reply(msg, text, private=True)
|
||||||
|
|
||||||
def action(self, irc, msg, args):
|
def action(self, irc, msg, args):
|
||||||
"""takes any number of arguments
|
"""<text>
|
||||||
|
|
||||||
Returns the arguments given it, but as an action.
|
Returns the arguments given it, but as an action.
|
||||||
"""
|
"""
|
||||||
|
text = privmsgs.getArgs(args)
|
||||||
|
if text:
|
||||||
irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), ' '.join(args)))
|
irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), ' '.join(args)))
|
||||||
|
else:
|
||||||
|
raise callbacks.Error
|
||||||
|
|
||||||
def notice(self, irc, msg, args):
|
def notice(self, irc, msg, args):
|
||||||
"""<text>
|
"""<text>
|
||||||
|
@ -35,7 +35,10 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
plugins = ('Misc', 'Utilities', 'Gameknot', 'Ctcp', 'Dict')
|
plugins = ('Misc', 'Utilities', 'Gameknot', 'Ctcp', 'Dict')
|
||||||
def testAction(self):
|
def testAction(self):
|
||||||
self.assertAction('action moos', 'moos')
|
self.assertAction('action moos', 'moos')
|
||||||
self.assertAction('action','')
|
|
||||||
|
def testActionDoesNotAllowEmptyString(self):
|
||||||
|
self.assertError('action')
|
||||||
|
self.assertError('action ""')
|
||||||
|
|
||||||
def testReplyWhenNotCommand(self):
|
def testReplyWhenNotCommand(self):
|
||||||
try:
|
try:
|
||||||
@ -64,21 +67,29 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
|
|
||||||
def testHelp(self):
|
def testHelp(self):
|
||||||
self.assertHelp('help list')
|
self.assertHelp('help list')
|
||||||
|
self.assertRegexp('help help', r'^\(\x02help')
|
||||||
|
self.assertRegexp('help misc help', r'^\(\x02misc help')
|
||||||
|
self.assertError('help nonExistentCommand')
|
||||||
|
|
||||||
|
def testHelpStripsPrefixChars(self):
|
||||||
try:
|
try:
|
||||||
original = conf.prefixChars
|
original = conf.prefixChars
|
||||||
conf.prefixChars = '@'
|
conf.prefixChars = '@'
|
||||||
self.assertHelp('help @list')
|
self.assertHelp('help @list')
|
||||||
finally:
|
finally:
|
||||||
conf.prefixChars = original
|
conf.prefixChars = original
|
||||||
self.assertHelp('help list')
|
|
||||||
self.assertRegexp('help help', r'^\(\x02help')
|
def testHelpIsCaseInsensitive(self):
|
||||||
self.assertRegexp('help misc help', r'^\(\x02misc help')
|
self.assertHelp('help LIST')
|
||||||
self.assertError('help morehelp')
|
|
||||||
|
|
||||||
def testList(self):
|
def testList(self):
|
||||||
self.assertNotError('list Misc')
|
|
||||||
self.assertNotError('list misc')
|
|
||||||
self.assertNotError('list')
|
self.assertNotError('list')
|
||||||
|
self.assertNotError('list Misc')
|
||||||
|
|
||||||
|
def testListIsCaseInsensitive(self):
|
||||||
|
self.assertNotError('list misc')
|
||||||
|
|
||||||
|
def testListPrivate(self):
|
||||||
# If Ctcp changes to public, these tests will break. So if
|
# If Ctcp changes to public, these tests will break. So if
|
||||||
# the next assert fails, change the plugin we test for public/private
|
# the next assert fails, change the plugin we test for public/private
|
||||||
# to some other non-public plugin.
|
# to some other non-public plugin.
|
||||||
@ -159,9 +170,11 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
|
|
||||||
def testRevision(self):
|
def testRevision(self):
|
||||||
self.assertNotError('revision Misc')
|
self.assertNotError('revision Misc')
|
||||||
self.assertNotError('revision misc')
|
|
||||||
self.assertNotError('revision')
|
self.assertNotError('revision')
|
||||||
|
|
||||||
|
def testRevisionIsCaseInsensitive(self):
|
||||||
|
self.assertNotError('revision misc')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user