mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Fixed an error in hostmask.list when there are no hostmasks.
This commit is contained in:
parent
5c8677cf22
commit
766dad2f70
@ -246,8 +246,11 @@ class User(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
def getHostmasks(user):
|
def getHostmasks(user):
|
||||||
hostmasks = map(repr, user.hostmasks)
|
hostmasks = map(repr, user.hostmasks)
|
||||||
hostmasks.sort()
|
if hostmasks:
|
||||||
return format('%L', hostmasks)
|
hostmasks.sort()
|
||||||
|
return format('%L', hostmasks)
|
||||||
|
else:
|
||||||
|
irc.reply(format('%s has no registered hostmasks.', user))
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(msg.prefix)
|
user = ircdb.users.getUser(msg.prefix)
|
||||||
if name:
|
if name:
|
||||||
|
@ -47,6 +47,15 @@ class UserTestCase(PluginTestCase):
|
|||||||
self.assertNotError('hostmask add foo')
|
self.assertNotError('hostmask add foo')
|
||||||
self.assertNotRegexp('hostmask add foo', 'IrcSet')
|
self.assertNotRegexp('hostmask add foo', 'IrcSet')
|
||||||
|
|
||||||
|
def testHostmaskListHandlesEmptyListGracefully(self):
|
||||||
|
self.assertError('hostmask list')
|
||||||
|
self.prefix = self.prefix1
|
||||||
|
self.assertNotError('register foo bar')
|
||||||
|
self.assertNotError('hostmask remove foo %s' % self.prefix1)
|
||||||
|
self.assertNotError('identify foo bar')
|
||||||
|
self.assertRegexp('hostmask list', 'no registered hostmasks')
|
||||||
|
|
||||||
|
|
||||||
def testHostmask(self):
|
def testHostmask(self):
|
||||||
self.assertResponse('hostmask', self.prefix)
|
self.assertResponse('hostmask', self.prefix)
|
||||||
self.assertError('@hostmask asdf')
|
self.assertError('@hostmask asdf')
|
||||||
|
Loading…
Reference in New Issue
Block a user