-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathtest_module.py
37 lines (31 loc) · 1.33 KB
/
test_module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""Module entity tests.
"""
from __utils__ import *
class TestModule(TestCase):
def test_module_attributes(self):
for m in Module.subclasses:
m.console = CONSOLE # use the main console ; should normally be a ModuleConsole
self.assertIsNotNone(m.base)
for a in ["files", "logger", "store", "workspace"]:
self.assertIsNotNone(getattr(m(), a))
def test_module_help(self):
for c in [None, "uncategorized", "does_not_exist"]:
self.assertIsNotNone(Module.get_help(c))
M = Module.subclasses[0]
self.assertIsNone(M()._feedback(None, ""))
self.assertIsNone(M()._feedback(True, "test"))
self.assertIsNone(M()._feedback(False, "test"))
def test_module_registry(self):
self.assertIsNotNone(Module.get_list())
self.assertIsNotNone(Module.get_modules())
class FakeModule(Module):
path = "fake_module"
name = "fake_module"
self.assertIsNone(Module.unregister_module(FakeModule))
class OrphanModule(Module):
path = None
name = "orphan_module"
self.assertIsNone(Module.register_module(OrphanModule))
self.assertNotIn(OrphanModule, Module.subclasses)