mirror of https://github.com/Mikaela/Limnoria.git
Fixed tests.
This commit is contained in:
parent
781ff46653
commit
55c392fae3
|
@ -197,8 +197,7 @@ class ChannelStats(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||||
actions=actions+%s, smileys=smileys+%s,
|
actions=actions+%s, smileys=smileys+%s,
|
||||||
frowns=frowns+%s
|
frowns=frowns+%s
|
||||||
WHERE user_id=%s""",
|
WHERE user_id=%s""",
|
||||||
int(time.time()), s, chars, words, int(isAction),
|
chars, words, int(isAction), smileys, frowns, id)
|
||||||
smileys, frowns, id)
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def outFilter(self, irc, msg):
|
def outFilter(self, irc, msg):
|
||||||
|
@ -312,7 +311,9 @@ class ChannelStats(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
name = privmsgs.getArgs(args, required=0, optional=1)
|
name = privmsgs.getArgs(args, required=0, optional=1)
|
||||||
if not name:
|
if name == irc.nick:
|
||||||
|
id = 0
|
||||||
|
elif not name:
|
||||||
try:
|
try:
|
||||||
id = ircdb.users.getUserId(msg.prefix)
|
id = ircdb.users.getUserId(msg.prefix)
|
||||||
name = ircdb.users.getUser(id).name
|
name = ircdb.users.getUser(id).name
|
||||||
|
|
|
@ -71,10 +71,13 @@ if sqlite is not None:
|
||||||
u = ircdb.users.getUser(id)
|
u = ircdb.users.getUser(id)
|
||||||
u.addCapability(ircdb.makeChannelCapability(self.channel, 'op'))
|
u.addCapability(ircdb.makeChannelCapability(self.channel, 'op'))
|
||||||
ircdb.users.setUser(id, u)
|
ircdb.users.setUser(id, u)
|
||||||
self.assertNotError('channelstats config self-stats off')
|
try:
|
||||||
|
conf.supybot.plugins.ChannelStats.selfStats.setValue(False)
|
||||||
m1 = self.getMsg('channelstats stats %s' % self.irc.nick)
|
m1 = self.getMsg('channelstats stats %s' % self.irc.nick)
|
||||||
m2 = 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])
|
self.assertEqual(m1.args[1], m2.args[1])
|
||||||
|
finally:
|
||||||
|
conf.supybot.plugins.ChannelStats.selfStats.setValue(True)
|
||||||
|
|
||||||
def testNoKeyErrorStats(self):
|
def testNoKeyErrorStats(self):
|
||||||
self.assertNotRegexp('stats sweede', 'KeyError')
|
self.assertNotRegexp('stats sweede', 'KeyError')
|
||||||
|
|
Loading…
Reference in New Issue