bumblebee-status/tests/test_config.py
Tobi-wan Kenobi 9a5a6d354a [core/config] Add module aliases
Allow the user to provide aliases when loading a module multiple times
so that the modules can be differentiated (e.g. for passing parameters
to a module).

see #23
2016-12-03 20:54:57 +01:00

28 lines
927 B
Python

import unittest
from bumblebee.config import Config
class TestConfig(unittest.TestCase):
def setUp(self):
self.defaultConfig = Config()
self.someSimpleModules = [ "foo", "bar", "baz" ]
self.someAliasModules = [ "foo:a", "bar:b", "baz:c" ]
def test_no_modules_by_default(self):
self.assertEquals(self.defaultConfig.modules(), [])
def test_load_simple_modules(self):
cfg = Config([ "-m" ] + self.someSimpleModules)
self.assertEquals(cfg.modules(), list(map(lambda x: {
"name": x, "module": x
}, self.someSimpleModules)))
def test_load_alias_modules(self):
cfg = Config([ "-m" ] + self.someAliasModules)
self.assertEquals(cfg.modules(), list(map(lambda x: {
"module": x.split(":")[0],
"name": x.split(":")[1]
}, self.someAliasModules)))
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4