improved testcases
This commit is contained in:
parent
e0c327cc0c
commit
621a739198
|
@ -106,23 +106,45 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
|||
pluginConf.reviewAfterTime.setValue(1.0/84600) # one second
|
||||
cb.reviewBans()
|
||||
self.assertFalse(cb.pendingReviews)
|
||||
print 'waiting 2 secs..'
|
||||
print 'waiting 4 secs..'
|
||||
time.sleep(2)
|
||||
cb.reviewBans()
|
||||
# check is pending
|
||||
self.assertTrue(cb.pendingReviews)
|
||||
# check msg if op and only op says something
|
||||
self.feedMsg('Hi!', frm='dude!user@host.net')
|
||||
# send msg if a user with a matching host says something
|
||||
self.feedMsg('Hi!', frm='op!user@fakehost.net')
|
||||
msg = self.irc.takeMsg()
|
||||
self.assertEqual(msg, None)
|
||||
self.feedMsg('Hi!', frm='op!user@host.net')
|
||||
self.feedMsg('Hi!', frm='op_!user@host.net')
|
||||
msg = self.irc.takeMsg()
|
||||
self.assertEqual(str(msg).strip(),
|
||||
"PRIVMSG op :Hi, please review the ban 'asd!*@*' that you set on %s in #test, link: "\
|
||||
"%s/bans.cgi?log=1" %(cb.bans['#test'][-1].ascwhen, pluginConf.bansite()))
|
||||
"PRIVMSG op_ :Hi, please review the ban 'asd!*@*' that you set on %s in #test, link: "\
|
||||
"%s/bans.cgi?log=1" %(cb.bans['#test'][0].ascwhen, pluginConf.bansite()))
|
||||
# don't ask again
|
||||
cb.reviewBans()
|
||||
self.assertFalse(cb.pendingReviews)
|
||||
self.feedBan('asd2!*@*')
|
||||
self.irc.takeMsg()
|
||||
self.feedBan('qwe!*@*', prefix='otherop!user@home.net')
|
||||
self.irc.takeMsg()
|
||||
time.sleep(2)
|
||||
cb.reviewBans()
|
||||
self.assertTrue(len(cb.pendingReviews) == 2)
|
||||
self.feedMsg('Hi!', frm='op!user@fakehost.net')
|
||||
msg = self.irc.takeMsg()
|
||||
self.assertEqual(msg, None)
|
||||
self.feedMsg('Hi!', frm='mynickissocreative!user@home.net')
|
||||
msg = self.irc.takeMsg()
|
||||
self.assertEqual(str(msg).strip(),
|
||||
"PRIVMSG mynickissocreative :Hi, please review the ban 'qwe!*@*' that you set on %s in #test, link: "\
|
||||
"%s/bans.cgi?log=3" %(cb.bans['#test'][2].ascwhen, pluginConf.bansite()))
|
||||
self.feedMsg('ping', to='test', frm='op!user@host.net') # in a query
|
||||
self.irc.takeMsg() # drop pong reply
|
||||
msg = self.irc.takeMsg()
|
||||
self.assertEqual(str(msg).strip(),
|
||||
"PRIVMSG op :Hi, please review the ban 'asd2!*@*' that you set on %s in #test, link: "\
|
||||
"%s/bans.cgi?log=2" %(cb.bans['#test'][1].ascwhen, pluginConf.bansite()))
|
||||
|
||||
|
||||
def testBan(self):
|
||||
self.feedBan('asd!*@*')
|
||||
|
|
Loading…
Reference in New Issue