Beispiel #1
0
    def test_string_opts(self):
        conf = Config()
        value = conf.string('section1', 'string', 'default')
        self.assertEquals(value, 'default')

        conf = Config({'section1': {'string': 'value'}})
        value = conf.string('section1', 'string', 'default')
        self.assertEquals(value, 'value')
Beispiel #2
0
 def test_string_opt_casts(self):
     conf = Config({'section1': {'int': 1, 'bool': True}})
     value = conf.string('section1', 'bool', 'False')
     self.assertEquals(value, 'True')
     value = conf.string('section1', 'int', '2')
     self.assertEquals(value, '1')
Beispiel #3
0
    def test_environment_variables(self):
        conf = Config()

        os.environ['DEFAULT_TEST_LUNR_DIR'] = '/home/foo'
        value = conf.string('default', 'test_lunr_dir', '/home/lunr')
        self.assertEquals(value, '/home/foo')