mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
Test suite updates (doesn't work yet)
This commit is contained in:
parent
38672ab9f5
commit
091bdc22da
@ -1,13 +1,14 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import inspircd
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import world
|
import world
|
||||||
import coreplugin
|
import coreplugin
|
||||||
|
import utils
|
||||||
import tests_common
|
import tests_common
|
||||||
|
|
||||||
world.testing = inspircd
|
inspircd = utils.getProtocolModule('inspircd')
|
||||||
|
world.testing = True
|
||||||
|
|
||||||
class CorePluginTestCase(tests_common.PluginTestCase):
|
class CorePluginTestCase(tests_common.PluginTestCase):
|
||||||
@unittest.skip("Test doesn't work yet.")
|
@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
|
# Also make sure that we're updating the irc.pseudoclient field
|
||||||
self.assertNotEqual(self.irc.pseudoclient.uid, spmain[0]['olduser'])
|
self.assertNotEqual(self.irc.pseudoclient.uid, spmain[0]['olduser'])
|
||||||
|
|
||||||
def testKickrejoin(self):
|
def testKickRejoin(self):
|
||||||
self.proto.kickClient(self.u, '#pylink', self.u, 'test')
|
self.proto.kickClient(self.u, '#pylink', self.u, 'test')
|
||||||
msgs = self.irc.takeMsgs()
|
msgs = self.irc.takeMsgs()
|
||||||
commands = self.irc.takeCommands(msgs)
|
commands = self.irc.takeCommands(msgs)
|
||||||
|
@ -4,10 +4,11 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|||||||
|
|
||||||
import classes
|
import classes
|
||||||
import unittest
|
import unittest
|
||||||
|
import conf
|
||||||
|
|
||||||
class TestFakeIRC(unittest.TestCase):
|
class TestFakeIRC(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.irc = classes.FakeIRC('unittest', classes.FakeProto)
|
self.irc = classes.FakeIRC('unittest', classes.FakeProto, conf.testconf)
|
||||||
|
|
||||||
def testFakeIRC(self):
|
def testFakeIRC(self):
|
||||||
self.irc.run('this should do nothing')
|
self.irc.run('this should do nothing')
|
||||||
|
@ -6,6 +6,7 @@ import itertools
|
|||||||
|
|
||||||
import utils
|
import utils
|
||||||
import classes
|
import classes
|
||||||
|
import conf
|
||||||
import world
|
import world
|
||||||
|
|
||||||
def dummyf():
|
def dummyf():
|
||||||
@ -13,7 +14,7 @@ def dummyf():
|
|||||||
|
|
||||||
class TestUtils(unittest.TestCase):
|
class TestUtils(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.irc = classes.FakeIRC('fakeirc', classes.FakeProto)
|
self.irc = classes.FakeIRC('fakeirc', classes.FakeProto, conf.testconf)
|
||||||
|
|
||||||
def testTS6UIDGenerator(self):
|
def testTS6UIDGenerator(self):
|
||||||
uidgen = utils.TS6UIDGenerator('9PY')
|
uidgen = utils.TS6UIDGenerator('9PY')
|
||||||
|
@ -5,12 +5,13 @@ import unittest
|
|||||||
|
|
||||||
import world
|
import world
|
||||||
import classes
|
import classes
|
||||||
|
import conf
|
||||||
|
|
||||||
world.started.set()
|
world.started.set()
|
||||||
|
|
||||||
class PluginTestCase(unittest.TestCase):
|
class PluginTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
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.proto = self.irc.proto
|
||||||
self.irc.connect()
|
self.irc.connect()
|
||||||
self.sdata = self.irc.serverdata
|
self.sdata = self.irc.serverdata
|
||||||
|
5
world.py
5
world.py
@ -8,9 +8,12 @@ import subprocess
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# Global variable to indicate whether we're being ran directly, or imported
|
# Global variable to indicate whether we're being ran directly, or imported
|
||||||
# for a testcase.
|
# for a testcase. This defaults to True.
|
||||||
testing = True
|
testing = True
|
||||||
|
|
||||||
|
# Sets the default protocol module to use with tests.
|
||||||
|
testing_ircd = 'inspircd'
|
||||||
|
|
||||||
global commands, hooks
|
global commands, hooks
|
||||||
# This should be a mapping of command names to functions
|
# This should be a mapping of command names to functions
|
||||||
commands = defaultdict(list)
|
commands = defaultdict(list)
|
||||||
|
Loading…
Reference in New Issue
Block a user