예제 #1
0
    def test_collapse_config_env_vars_empty_env(self):
        # empty env
        config = ConfigFactory.from_dict({
            "facade": {
                "base_url": "http://base.url",
                "base_url~qa": "http://base-qa.url"
            }
        })

        config = configs.collapse_environment(config, env="")

        config.get("facade.base_url").should.be.equal("http://base.url")
        config.get("facade.base_url~qa").should.be.equal("http://base-qa.url")

        config = configs.collapse_environment(config, env=None)

        config.get("facade.base_url").should.be.equal("http://base.url")
        config.get("facade.base_url~qa").should.be.equal("http://base-qa.url")
예제 #2
0
    def test_collapse_config_env_vars_nested_vars(self):
        config = ConfigFactory.from_dict({
            "kafka": {
                "topics": {
                    "user_commands": "base",
                    "user_commands~qa": "qa"
                }
            }
        })

        config = configs.collapse_environment(config, env="qa")

        config.get("kafka.topics.user_commands").should.be.equal("qa")
예제 #3
0
    def test_collapse_config_env_vars_unexist_env(self):
        # un-exist env
        config = ConfigFactory.from_dict({
            "facade": {
                "base_url": "http://base.url",
                "base_url~qa": "http://base-qa.url"
            }
        })

        config = configs.collapse_environment(config, env="prod")

        config.get("facade.base_url").should.be.equal("http://base.url")
        expect(config.get).when.called_with(
            "facade.base_url~qa").should.have.raised(ConfigMissingException)