2015-08-29 23:06:07 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import unittest
|
2015-12-25 03:24:42 +01:00
|
|
|
|
2015-08-29 23:06:07 +02:00
|
|
|
import world
|
|
|
|
import coreplugin
|
2015-12-25 03:24:42 +01:00
|
|
|
import utils
|
2015-08-29 23:06:07 +02:00
|
|
|
import tests_common
|
|
|
|
|
2015-12-25 03:24:42 +01:00
|
|
|
inspircd = utils.getProtocolModule('inspircd')
|
|
|
|
world.testing = True
|
2015-08-29 23:06:07 +02:00
|
|
|
|
|
|
|
class CorePluginTestCase(tests_common.PluginTestCase):
|
|
|
|
@unittest.skip("Test doesn't work yet.")
|
|
|
|
def testKillRespawn(self):
|
|
|
|
self.irc.run(':9PY KILL {u} :test'.format(u=self.u))
|
|
|
|
hooks = self.irc.takeHooks()
|
|
|
|
|
|
|
|
# Make sure we're respawning our PseudoClient when its killed
|
|
|
|
print(hooks)
|
|
|
|
spmain = [h for h in hooks if h[1] == 'PYLINK_SPAWNMAIN']
|
|
|
|
self.assertTrue(spmain, 'PYLINK_SPAWNMAIN hook was never sent!')
|
|
|
|
|
|
|
|
msgs = self.irc.takeMsgs()
|
|
|
|
commands = self.irc.takeCommands(msgs)
|
|
|
|
self.assertIn('UID', commands)
|
|
|
|
self.assertIn('FJOIN', commands)
|
|
|
|
|
|
|
|
# Also make sure that we're updating the irc.pseudoclient field
|
|
|
|
self.assertNotEqual(self.irc.pseudoclient.uid, spmain[0]['olduser'])
|
|
|
|
|
2015-12-25 03:24:42 +01:00
|
|
|
def testKickRejoin(self):
|
2016-01-17 01:59:01 +01:00
|
|
|
self.proto.kick(self.u, '#pylink', self.u, 'test')
|
2015-08-29 23:06:07 +02:00
|
|
|
msgs = self.irc.takeMsgs()
|
|
|
|
commands = self.irc.takeCommands(msgs)
|
|
|
|
self.assertIn('FJOIN', commands)
|