Added tests for globbing ability.

This commit is contained in:
Jeremy Fincher 2003-12-01 21:17:29 +00:00
parent 8ff34725c2
commit 9788815bdd

View File

@ -54,8 +54,7 @@ class User(callbacks.Privmsg):
if password and ircutils.isChannel(msg.args[0]): if password and ircutils.isChannel(msg.args[0]):
irc.error(msg, conf.replyRequiresPrivacy) irc.error(msg, conf.replyRequiresPrivacy)
return False return False
else: else: return True
return True
def list(self, irc, msg, args): def list(self, irc, msg, args):
"""[<glob>] """[<glob>]
@ -72,15 +71,14 @@ class User(callbacks.Privmsg):
else: else:
def p(s): def p(s):
return True return True
users = ifilter(p, ifilter(None, ircdb.users.users)) users = [u.name for u in ircdb.users.users[1:] if u is not None]
users = [u.name for u in users] users = filter(p, users)
assert users, 'There should be a bot user first.'
if users[0] != irc.nick:
self.log.warning('First user isn\'t the bot nick: %s' % users[0])
del users[0] # The bot user. Implementation detail.
if users: if users:
utils.sortBy(str.lower, users) utils.sortBy(str.lower, users)
irc.reply(msg, utils.commaAndify(users)) irc.reply(msg, utils.commaAndify(users))
else:
if glob:
irc.reply(msg, 'There are no matching registered users.')
else: else:
irc.reply(msg, 'There are no registered users.') irc.reply(msg, 'There are no registered users.')