Example #1
0
 def merging_can_be_deferred(self):
     c = Config()
     assert "foo" not in c._collection
     assert "foo" not in c
     c.load_collection({"foo": "bar"}, merge=False)
     assert "foo" in c._collection
     assert "foo" not in c
Example #2
0
 def performed_explicitly_and_directly(self):
     # TODO: do we want to update the other levels to allow 'direct'
     # loading like this, now that they all have explicit methods?
     c = Config()
     assert "foo" not in c
     c.load_collection({"foo": "bar"})
     assert c.foo == "bar"
Example #3
0
 def runtime_overrides_collection(self):
     c = Config(runtime_path=join(CONFIGS_PATH, "json", "raft.json"))
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     c.load_runtime()
     assert c.outer.inner.hooray == "json"
Example #4
0
 def env_vars_override_collection(self):
     os.environ["RAFT_OUTER_INNER_HOORAY"] = "env"
     c = Config()
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     c.load_shell_env()
     assert c.outer.inner.hooray == "env"
Example #5
0
 def project_overrides_collection(self):
     c = Config(project_location=join(CONFIGS_PATH, "yaml"))
     c.load_project()
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     assert c.outer.inner.hooray == "yaml"
Example #6
0
 def user_overrides_collection(self):
     c = Config(user_prefix=join(CONFIGS_PATH, "json/"))
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     assert c.outer.inner.hooray == "json"
Example #7
0
 def systemwide_overrides_collection(self):
     c = Config(system_prefix=join(CONFIGS_PATH, "yaml/"))
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     assert c.outer.inner.hooray == "yaml"
Example #8
0
 def collection_overrides_defaults(self):
     c = Config(defaults={"nested": {"setting": "default"}})
     c.load_collection({"nested": {"setting": "collection"}})
     assert c.nested.setting == "collection"