mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Added test for the wordstats-top-n configurable
This commit is contained in:
parent
42afa12765
commit
b6faf3602e
@ -49,6 +49,7 @@ if sqlite is not None:
|
||||
'register foo bar',
|
||||
prefix=self.prefix))
|
||||
_ = self.irc.takeMsg()
|
||||
ircdb.users.getUser(self.nick).addCapability(self.channel + '.op')
|
||||
|
||||
def test(self):
|
||||
self.assertNotError('channelstats')
|
||||
@ -174,5 +175,27 @@ if sqlite is not None:
|
||||
self.assertError('addword lol!')
|
||||
self.assertNotError('addword lolz0r')
|
||||
|
||||
def testWordStatsTopN(self):
|
||||
self.assertNotError('addword lol')
|
||||
self.assertNotError('channeldb config wordstats-top-n 5')
|
||||
# Create 10 users and have them each send a different number of
|
||||
# 'lol's to the channel
|
||||
users = []
|
||||
for i in range(10):
|
||||
users.append(('foo%s!bar@baz' % i, 'foo%s' % i))
|
||||
self.irc.feedMsg(ircmsgs.privmsg(self.irc.nick,
|
||||
'register %s bar' % \
|
||||
users[i][1],
|
||||
prefix=users[i][0]))
|
||||
_ = self.irc.takeMsg()
|
||||
for i in range(10):
|
||||
for j in range(i):
|
||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'lol',
|
||||
prefix=users[i][0]))
|
||||
# Make sure it shows the top 5
|
||||
self.assertRegexp('wordstats lol',
|
||||
'Top 5 \'lol\'ers.*foo9: 9.*foo8: 8.*'
|
||||
'foo7: 7.*foo6: 6.*foo5: 5')
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user