[tests/engine] Add test for module aliasing

This commit is contained in:
Tobi-wan Kenobi 2017-03-04 18:53:31 +01:00
parent 6a14681a65
commit 90dd636b43
2 changed files with 10 additions and 1 deletions

View file

@ -5,6 +5,8 @@
import bumblebee.engine
ALIASES = [ "test-alias" ]
class Module(bumblebee.engine.Module):
def __init__(self, engine, config):
super(Module, self).__init__(engine, config,

View file

@ -13,8 +13,10 @@ from mocks import MockOutput, MockInput
class TestEngine(unittest.TestCase):
def setUp(self):
self.engine = Engine(config=Config(), output=MockOutput(), inp=MockInput())
self.singleWidgetModule = [{"module": "test", "name": "a"}]
self.testModule = "test"
self.testAlias = "test-alias"
self.singleWidgetModule = [{"module": self.testModule, "name": "a"}]
self.singleWidgetAlias = [{"module": self.testAlias, "name": "a" }]
self.invalidModule = "no-such-module"
self.testModuleSpec = "bumblebee.modules.{}".format(self.testModule)
self.testModules = [
@ -54,6 +56,11 @@ class TestEngine(unittest.TestCase):
except Exception as e:
self.fail(e)
def test_aliases(self):
modules = self.engine.load_modules(self.singleWidgetAlias)
self.assertEquals(len(modules), 1)
self.assertEquals(modules[0].__module__, self.testModuleSpec)
def test_custom_cmd(self):
testmodules = [
{ "name": "test", "button": "test.left-click", "action": "echo" },