3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

Test suite updates (doesn't work yet)

This commit is contained in:
James Lu 2015-12-24 18:24:42 -08:00
parent 38672ab9f5
commit 091bdc22da
5 changed files with 15 additions and 8 deletions

View File

@ -1,13 +1,14 @@
#!/usr/bin/env python
import inspircd
import unittest
import world
import coreplugin
import utils
import tests_common
world.testing = inspircd
inspircd = utils.getProtocolModule('inspircd')
world.testing = True
class CorePluginTestCase(tests_common.PluginTestCase):
@unittest.skip("Test doesn't work yet.")
@ -28,7 +29,7 @@ class CorePluginTestCase(tests_common.PluginTestCase):
# Also make sure that we're updating the irc.pseudoclient field
self.assertNotEqual(self.irc.pseudoclient.uid, spmain[0]['olduser'])
def testKickrejoin(self):
def testKickRejoin(self):
self.proto.kickClient(self.u, '#pylink', self.u, 'test')
msgs = self.irc.takeMsgs()
commands = self.irc.takeCommands(msgs)

View File

@ -4,10 +4,11 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import classes
import unittest
import conf
class TestFakeIRC(unittest.TestCase):
def setUp(self):
self.irc = classes.FakeIRC('unittest', classes.FakeProto)
self.irc = classes.FakeIRC('unittest', classes.FakeProto, conf.testconf)
def testFakeIRC(self):
self.irc.run('this should do nothing')

View File

@ -6,6 +6,7 @@ import itertools
import utils
import classes
import conf
import world
def dummyf():
@ -13,7 +14,7 @@ def dummyf():
class TestUtils(unittest.TestCase):
def setUp(self):
self.irc = classes.FakeIRC('fakeirc', classes.FakeProto)
self.irc = classes.FakeIRC('fakeirc', classes.FakeProto, conf.testconf)
def testTS6UIDGenerator(self):
uidgen = utils.TS6UIDGenerator('9PY')

View File

@ -5,12 +5,13 @@ import unittest
import world
import classes
import conf
world.started.set()
class PluginTestCase(unittest.TestCase):
def setUp(self):
self.irc = classes.FakeIRC('unittest', world.testing)
self.irc = classes.FakeIRC('unittest', world.testing_ircd, conf.testconf)
self.proto = self.irc.proto
self.irc.connect()
self.sdata = self.irc.serverdata

View File

@ -8,9 +8,12 @@ import subprocess
import os
# Global variable to indicate whether we're being ran directly, or imported
# for a testcase.
# for a testcase. This defaults to True.
testing = True
# Sets the default protocol module to use with tests.
testing_ircd = 'inspircd'
global commands, hooks
# This should be a mapping of command names to functions
commands = defaultdict(list)