Exemplo n.º 1
0
def load_config(config_file, section):
    """
    load custom configure by section
    """
    config = Config(config_file=config_file)
    settings.CONFIG = config
    for re in config.get_config_list(section):
        setattr(settings, re[0].upper(), re[1])
Exemplo n.º 2
0
def load_config(config_file, section):
    """
    load custom configure by section
    """
    config = Config(config_file=config_file)
    settings.CONFIG = config
    for re in config.get_config_list(section):
        setattr(settings, re[0].upper(), re[1])
Exemplo n.º 3
0
class Test(unittest.TestCase):
    def setUp(self):
        self.config = Config("./config.ini")

    def tearDown(self):
        pass

    def test_config(self):
        assert self.config

    def test_set_config(self):
        assert self.config.set_config("common", "host", "127.0.0.1")

    def test_get_config(self):
        print self.config.get_config('common', 'host')

    def test_get_config_list(self):
        print self.config.get_config_list('common')
Exemplo n.º 4
0
class Test(unittest.TestCase):
    def setUp(self):
        self.config = Config("./config.ini")

    def tearDown(self):
        pass

    def test_config(self):
        assert self.config

    def test_set_config(self):
        assert self.config.set_config("common", "host", "127.0.0.1")

    def test_get_config(self):
        print self.config.get_config('common', 'host')

    def test_get_config_list(self):
        print self.config.get_config_list('common')