def test_efc_normal_get_second_arg_deprecated(caplog, default): # This test ensures that calling `ExtFlaskConfig.get()` with an # undefined value emits a warning. This is because we don't want # people to scatter random default values all over the code. For # the time being we don't raise an actual exception but we might # get to that in the future. efc = ExtFlaskConfig("/") caplog.clear() # with pytest.raises(s.LinOTPConfigKeyError) as ex: # efc.get("FOO", default) assert efc.get("FOO", default) == default assert len(caplog.messages) == 1 assert "violates the DRY principle" in caplog.messages[0]
def test_efc_relative_file_hack_get(): efc = ExtFlaskConfig("/") efc["FOO_DIR"] = "bar" assert efc.get("FOO_DIR") == "/ROOT_DIR_UNSET/./bar" efc["FOO_DIR"] = "/bar" assert efc.get("FOO_DIR") == "/bar"
def test_efc_normal_get(): efc = ExtFlaskConfig("/") efc["FOO"] = "bar" assert efc["FOO"] == efc.get("FOO")