1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2026-03-23 19:42:02 +01:00

Added tests plugins

This commit is contained in:
prieto 2016-06-08 10:14:52 +02:00
commit b963d34cf1

View file

@ -3,6 +3,8 @@
import unittest
from lodel.plugin.plugins import Plugin, PluginError
from lodel.settings.settings import Settings
import tests.loader_utils
class PluginTestCase(unittest.TestCase):
@ -13,13 +15,13 @@ class PluginTestCase(unittest.TestCase):
# With a wrong plugin name, a NameError Exception has to be raised at line 318 of plugin.py
def test_plugin_init_wrong_name(self):
with self.assertRaises(NameError):
Plugin.start(['/home/helene/lodel2/plugins'],['wrong_plugin_name'])
Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins' ],['wrong_plugin_name'])
Plugin.clear()
# With a wrong plugin name, a NameError Exception has to be raised at line 318 of plugin.py
def test_plugin_init_right_wrong_name(self):
with self.assertRaises(NameError):
Plugin.start(['/home/helene/lodel2/plugins'],['dummy', 'wrong_plugin_name'])
Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins'],['dummy', 'wrong_plugin_name'])
Plugin.clear()
def test_plugin_started(self):
@ -27,12 +29,12 @@ class PluginTestCase(unittest.TestCase):
Plugin.started()
def test_plugin_plugin_path(self):
Plugin.start(['/home/helene/lodel2/plugins'],['dummy'])
Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins'],['dummy'])
self.assertEqual(Plugin.plugin_path('dummy'), '/home/helene/lodel2/plugins/dummy/')
Plugin.clear()
def test_plugin_get(self):
Plugin.start(['/home/helene/lodel2/plugins'],['dummy'])
Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins'],['dummy'])
with self.assertRaises(PluginError):
Plugin.get('wrong_plugin_name')
self.assertTrue(isinstance(Plugin.get('dummy'), Plugin))
@ -47,6 +49,8 @@ class PluginTestCase(unittest.TestCase):
Plugin.clear()
def test_plugin_load_all(self):
#Plugin.start(['/home/helene/lodel2/plugins'],['dummynotactivable'])
#Plugin.load_all()
pass