mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Admin refactored ignore/unignore/ignores to ignore add/remove/list, and changed tests accordingly.
This commit is contained in:
parent
890d92df0e
commit
4e7a00d504
@ -291,7 +291,9 @@ class Admin(callbacks.Plugin):
|
|||||||
irc.error(s)
|
irc.error(s)
|
||||||
remove = wrap(remove, ['otherUser','lowered'])
|
remove = wrap(remove, ['otherUser','lowered'])
|
||||||
|
|
||||||
def ignore(self, irc, msg, args, hostmask, expires):
|
class ignore(callbacks.Commands):
|
||||||
|
|
||||||
|
def add(self, irc, msg, args, hostmask, expires):
|
||||||
"""<hostmask|nick> [<expires>]
|
"""<hostmask|nick> [<expires>]
|
||||||
|
|
||||||
Ignores <hostmask> or, if a nick is given, ignores whatever hostmask
|
Ignores <hostmask> or, if a nick is given, ignores whatever hostmask
|
||||||
@ -303,9 +305,9 @@ class Admin(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
ircdb.ignores.add(hostmask, expires)
|
ircdb.ignores.add(hostmask, expires)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
ignore = wrap(ignore, ['hostmask', additional('expiry', 0)])
|
add = wrap(add, ['hostmask', additional('expiry', 0)])
|
||||||
|
|
||||||
def unignore(self, irc, msg, args, hostmask):
|
def remove(self, irc, msg, args, hostmask):
|
||||||
"""<hostmask|nick>
|
"""<hostmask|nick>
|
||||||
|
|
||||||
Ignores <hostmask> or, if a nick is given, ignores whatever hostmask
|
Ignores <hostmask> or, if a nick is given, ignores whatever hostmask
|
||||||
@ -316,9 +318,9 @@ class Admin(callbacks.Plugin):
|
|||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error('%s wasn\'t in the ignores database.' % hostmask)
|
irc.error('%s wasn\'t in the ignores database.' % hostmask)
|
||||||
unignore = wrap(unignore, ['hostmask'])
|
remove = wrap(remove, ['hostmask'])
|
||||||
|
|
||||||
def ignores(self, irc, msg, args):
|
def list(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
|
|
||||||
Returns the hostmasks currently being globally ignored.
|
Returns the hostmasks currently being globally ignored.
|
||||||
@ -328,7 +330,7 @@ class Admin(callbacks.Plugin):
|
|||||||
irc.reply(format('%L', (map(repr,ircdb.ignores.hostmasks))))
|
irc.reply(format('%L', (map(repr,ircdb.ignores.hostmasks))))
|
||||||
else:
|
else:
|
||||||
irc.reply('I\'m not currently globally ignoring anyone.')
|
irc.reply('I\'m not currently globally ignoring anyone.')
|
||||||
ignores = wrap(ignores)
|
list = wrap(list)
|
||||||
|
|
||||||
|
|
||||||
Class = Admin
|
Class = Admin
|
||||||
|
@ -48,18 +48,18 @@ class AdminTestCase(PluginTestCase):
|
|||||||
getAfterJoinMessages()
|
getAfterJoinMessages()
|
||||||
self.assertRegexp('channels', '#bar, #Baz, and #foo')
|
self.assertRegexp('channels', '#bar, #Baz, and #foo')
|
||||||
|
|
||||||
def testIgnoreUnignore(self):
|
def testIgnoreAddRemove(self):
|
||||||
self.assertNotError('admin ignore foo!bar@baz')
|
self.assertNotError('admin ignore add foo!bar@baz')
|
||||||
self.assertError('admin ignore alsdkfjlasd')
|
self.assertError('admin ignore add alsdkfjlasd')
|
||||||
self.assertNotError('admin unignore foo!bar@baz')
|
self.assertNotError('admin ignore remove foo!bar@baz')
|
||||||
self.assertError('admin unignore foo!bar@baz')
|
self.assertError('admin ignore remove foo!bar@baz')
|
||||||
|
|
||||||
def testIgnores(self):
|
def testIgnoreList(self):
|
||||||
self.assertNotError('admin ignores')
|
self.assertNotError('admin ignore list')
|
||||||
self.assertNotError('admin ignore foo!bar@baz')
|
self.assertNotError('admin ignore add foo!bar@baz')
|
||||||
self.assertNotError('admin ignores')
|
self.assertNotError('admin ignore list')
|
||||||
self.assertNotError('admin ignore foo!bar@baz')
|
self.assertNotError('admin ignore add foo!bar@baz')
|
||||||
self.assertNotError('admin ignores')
|
self.assertRegexp('admin ignore list', 'foo')
|
||||||
|
|
||||||
def testCapabilityAdd(self):
|
def testCapabilityAdd(self):
|
||||||
self.assertError('capability add foo bar')
|
self.assertError('capability add foo bar')
|
||||||
|
Loading…
Reference in New Issue
Block a user