Ejemplo n.º 1
0
def test_get():  # type: ignore
    cfg = ConfigurationSet(
        config_from_dict(DICT2_1, lowercase_keys=True),
        config_from_dict(DICT2_2, lowercase_keys=True),
        config_from_env(prefix=PREFIX, lowercase_keys=True),
    )

    assert cfg.get("a2.b2") == config_from_dict(
        {"c1": 10, "c2": "YWJjZGVmZ2g=", "c3": "abcdefgh"}
    )
    assert cfg.get("a2.b5", "1") == "1"
def test_get():  # type: ignore
    cfg = ConfigurationSet(config_from_dict(DICT2_1),
                           config_from_dict(DICT2_2),
                           config_from_env(prefix=PREFIX))

    assert cfg.get("a2.b2") == config_from_dict({
        'c1': 10,
        'c2': 'YWJjZGVmZ2g=',
        'c3': 'abcdefgh'
    })
    assert cfg.get("a2.b5", "1") == "1"
Ejemplo n.º 3
0
def test_issue_49():  # type: ignore
    d = {"path": {"to": {"value-a": "A", "value-b": "B"}}}
    base_cfg = config_from_dict(d)

    d = {"path": {"to": {"value-a": "C"}}}

    cfg = config_from_dict(d)
    cfg_set = ConfigurationSet(cfg, base_cfg)

    path_config = cfg_set.get("path")

    assert path_config == {"to.value-a": "C", "to.value-b": "B"}