2016-11-05 07:54:16 +01:00
|
|
|
import unittest
|
|
|
|
|
2016-12-03 20:38:54 +01:00
|
|
|
from bumblebee.config import Config
|
2016-11-05 07:54:16 +01:00
|
|
|
|
2016-12-03 20:38:54 +01:00
|
|
|
class TestConfig(unittest.TestCase):
|
2016-11-05 07:54:16 +01:00
|
|
|
def setUp(self):
|
2016-12-03 20:38:54 +01:00
|
|
|
self.defaultConfig = Config()
|
|
|
|
self.someSimpleModules = [ "foo", "bar", "baz" ]
|
2016-12-03 20:54:57 +01:00
|
|
|
self.someAliasModules = [ "foo:a", "bar:b", "baz:c" ]
|
|
|
|
|
2016-11-05 07:54:16 +01:00
|
|
|
|
2016-12-03 20:38:54 +01:00
|
|
|
def test_no_modules_by_default(self):
|
|
|
|
self.assertEquals(self.defaultConfig.modules(), [])
|
|
|
|
|
|
|
|
def test_load_simple_modules(self):
|
|
|
|
cfg = Config([ "-m" ] + self.someSimpleModules)
|
2016-12-03 20:54:57 +01:00
|
|
|
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)))
|
2016-11-05 07:54:16 +01:00
|
|
|
|
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|