示例#1
0
 def setUp(self):
     self.commons = {
         'sysroot': '/',
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions(),
         'devices': {}
     }
     self.plugin = Plugin(self.commons)
     self.plugin.opt_names = ['baz', 'empty', 'test_option']
     self.plugin.opt_parms = [
         {'enabled': False}, {'enabled': None}, {'enabled': 'foobar'}
     ]
示例#2
0
class GlobalOptionTest(unittest.TestCase):

    def setUp(self):
        self.commons = {
            'sysroot': '/',
            'policy': LinuxPolicy(init=InitSystem()),
            'cmdlineopts': MockOptions(),
            'devices': {}
        }
        self.plugin = Plugin(self.commons)
        self.plugin.opt_names = ['baz', 'empty', 'test_option']
        self.plugin.opt_parms = [
            {'enabled': False}, {'enabled': None}, {'enabled': 'foobar'}
        ]

    def test_simple_lookup(self):
        self.assertEquals(self.plugin.get_option('test_option'), 'foobar')

    def test_cascade(self):
        self.assertEquals(self.plugin.get_option(('baz')), False)