Fixed tests.

This commit is contained in:
Jeremy Fincher 2004-01-31 21:03:31 +00:00
parent 781ff46653
commit 55c392fae3
2 changed files with 11 additions and 7 deletions

View File

@ -197,8 +197,7 @@ class ChannelStats(plugins.ChannelDBHandler, callbacks.Privmsg):
actions=actions+%s, smileys=smileys+%s,
frowns=frowns+%s
WHERE user_id=%s""",
int(time.time()), s, chars, words, int(isAction),
smileys, frowns, id)
chars, words, int(isAction), smileys, frowns, id)
db.commit()
def outFilter(self, irc, msg):
@ -312,7 +311,9 @@ class ChannelStats(plugins.ChannelDBHandler, callbacks.Privmsg):
"""
channel = privmsgs.getChannel(msg, args)
name = privmsgs.getArgs(args, required=0, optional=1)
if not name:
if name == irc.nick:
id = 0
elif not name:
try:
id = ircdb.users.getUserId(msg.prefix)
name = ircdb.users.getUser(id).name

View File

@ -71,10 +71,13 @@ if sqlite is not None:
u = ircdb.users.getUser(id)
u.addCapability(ircdb.makeChannelCapability(self.channel, 'op'))
ircdb.users.setUser(id, u)
self.assertNotError('channelstats config self-stats off')
m1 = self.getMsg('channelstats stats %s' % self.irc.nick)
m2 = self.getMsg('channelstats stats %s' % self.irc.nick)
self.assertEqual(m1.args[1], m2.args[1])
try:
conf.supybot.plugins.ChannelStats.selfStats.setValue(False)
m1 = self.getMsg('channelstats stats %s' % self.irc.nick)
m2 = self.getMsg('channelstats stats %s' % self.irc.nick)
self.assertEqual(m1.args[1], m2.args[1])
finally:
conf.supybot.plugins.ChannelStats.selfStats.setValue(True)
def testNoKeyErrorStats(self):
self.assertNotRegexp('stats sweede', 'KeyError')