Browse Source

Added tests plugins

prieto 8 years ago
parent
commit
b963d34cf1
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      tests/plugin/test_plugin.py

+ 8
- 4
tests/plugin/test_plugin.py View File

3
 import unittest
3
 import unittest
4
 
4
 
5
 from lodel.plugin.plugins import Plugin, PluginError
5
 from lodel.plugin.plugins import Plugin, PluginError
6
+from lodel.settings.settings import Settings
7
+import tests.loader_utils
6
 
8
 
7
 class PluginTestCase(unittest.TestCase):
9
 class PluginTestCase(unittest.TestCase):
8
 
10
 
13
     # With a wrong plugin name, a NameError Exception has to be raised at line 318 of plugin.py
15
     # With a wrong plugin name, a NameError Exception has to be raised at line 318 of plugin.py
14
     def test_plugin_init_wrong_name(self):
16
     def test_plugin_init_wrong_name(self):
15
         with self.assertRaises(NameError):
17
         with self.assertRaises(NameError):
16
-            Plugin.start(['/home/helene/lodel2/plugins'],['wrong_plugin_name'])
18
+            Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins' ],['wrong_plugin_name'])
17
         Plugin.clear()
19
         Plugin.clear()
18
         
20
         
19
     # With a wrong plugin name, a NameError Exception has to be raised at line 318 of plugin.py
21
     # With a wrong plugin name, a NameError Exception has to be raised at line 318 of plugin.py
20
     def test_plugin_init_right_wrong_name(self):
22
     def test_plugin_init_right_wrong_name(self):
21
         with self.assertRaises(NameError):
23
         with self.assertRaises(NameError):
22
-            Plugin.start(['/home/helene/lodel2/plugins'],['dummy', 'wrong_plugin_name'])
24
+            Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins'],['dummy', 'wrong_plugin_name'])
23
         Plugin.clear()
25
         Plugin.clear()
24
     
26
     
25
     def test_plugin_started(self):
27
     def test_plugin_started(self):
27
             Plugin.started()
29
             Plugin.started()
28
             
30
             
29
     def test_plugin_plugin_path(self):
31
     def test_plugin_plugin_path(self):
30
-        Plugin.start(['/home/helene/lodel2/plugins'],['dummy'])
32
+        Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins'],['dummy'])
31
         self.assertEqual(Plugin.plugin_path('dummy'), '/home/helene/lodel2/plugins/dummy/')
33
         self.assertEqual(Plugin.plugin_path('dummy'), '/home/helene/lodel2/plugins/dummy/')
32
         Plugin.clear()
34
         Plugin.clear()
33
         
35
         
34
     def test_plugin_get(self):
36
     def test_plugin_get(self):
35
-        Plugin.start(['/home/helene/lodel2/plugins'],['dummy'])
37
+        Plugin.start(['/home/helene/lodel2/plugins', '/home/helene/lodel2/tests/tests_plugins'],['dummy'])
36
         with self.assertRaises(PluginError):
38
         with self.assertRaises(PluginError):
37
             Plugin.get('wrong_plugin_name')
39
             Plugin.get('wrong_plugin_name')
38
         self.assertTrue(isinstance(Plugin.get('dummy'), Plugin))
40
         self.assertTrue(isinstance(Plugin.get('dummy'), Plugin))
47
         Plugin.clear()
49
         Plugin.clear()
48
         
50
         
49
     def test_plugin_load_all(self):
51
     def test_plugin_load_all(self):
52
+        #Plugin.start(['/home/helene/lodel2/plugins'],['dummynotactivable'])
53
+        #Plugin.load_all()
50
         pass
54
         pass
51
         
55
         
52
     
56
     

Loading…
Cancel
Save