From 55c392fae3ea517a92cf24a0d391e2a657671ba0 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 31 Jan 2004 21:03:31 +0000 Subject: [PATCH] Fixed tests. --- plugins/ChannelStats.py | 7 ++++--- test/test_ChannelStats.py | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/ChannelStats.py b/plugins/ChannelStats.py index 721b018d0..a9e0f3e00 100644 --- a/plugins/ChannelStats.py +++ b/plugins/ChannelStats.py @@ -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 diff --git a/test/test_ChannelStats.py b/test/test_ChannelStats.py index 27ccabb10..cc6f13024 100644 --- a/test/test_ChannelStats.py +++ b/test/test_ChannelStats.py @@ -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')