Пример #1
0
    def test_config_hierarchy(self):
        """Testing Config: hierarchy"""
        c = Config()
        c["value"] = "lowlevel"
        c["plugin.one.value"] = "value"
        c["plugin.one.othervalue"] = "other"
        c["plugin.two"] = "second"

        assert c.get_childs("plugin") == {"one", "two"}
        assert c.get_childs("plugin.one") == {"value", "othervalue"}
        assert c.get("plugin.one.value") == "value"
        assert c.get("plugin.two.value") == "lowlevel"
Пример #2
0
    def test_config_hierarchy(self):
        """Testing Config: hierarchy"""
        c = Config()
        c["value"] = "lowlevel"
        c["plugin.one.value"] = "value"
        c["plugin.one.othervalue"] = "other"
        c["plugin.two"] = "second"

        assert c.get_childs("plugin") == {"one", "two"}
        assert c.get_childs("plugin.one") == {"value", "othervalue"}
        assert c.get("plugin.one.value") == "value"
        assert c.get("plugin.two.value") == "lowlevel"
Пример #3
0
 def test_config_notfound(self):
     """Testing Config: value not found"""
     c = Config()
     with self.assertRaises(ConfigError):
         c.get("notfound")
Пример #4
0
 def test_config_default(self):
     """Testing Config: get with default"""
     c = Config()
     assert c.get("none", "value") == "value"
Пример #5
0
 def test_config_include(self):
     """Testing Config: include"""
     c = Config(os.devnull)
     c["include"] = self.config_file
     c.reload()
     assert c.get("plugin_dir", False)
Пример #6
0
 def test_config_notfound(self):
     """Testing Config: value not found"""
     c = Config()
     with self.assertRaises(ConfigError):
         c.get("notfound")
Пример #7
0
 def test_config_default(self):
     """Testing Config: get with default"""
     c = Config()
     assert c.get("none", "value") == "value"
Пример #8
0
 def test_config_include(self):
     """Testing Config: include"""
     c = Config(os.devnull)
     c["include"] = self.config_file
     c.reload()
     assert c.get("plugin_dir", False)