feat(shared): allow loading from ini config file
This commit is contained in:
parent
65dff91d47
commit
b1ecf25d6f
2 changed files with 29 additions and 0 deletions
|
@ -46,6 +46,28 @@ def test_base_config(tmp_path: Path):
|
|||
assert config.database.port == 8888
|
||||
|
||||
|
||||
FIXTURE_CONFIG_RAW_INI = """
|
||||
[database]
|
||||
host = changed
|
||||
port = 6666
|
||||
"""
|
||||
|
||||
|
||||
def test_base_config_ini(tmp_path: Path):
|
||||
config_filepath = tmp_path / "config.conf"
|
||||
config_filepath.write_text(FIXTURE_CONFIG_RAW_INI)
|
||||
|
||||
with mock.patch.dict(
|
||||
environ,
|
||||
dict(LIBRETIME_API_KEY="f3bf04fc"),
|
||||
):
|
||||
config = FixtureConfig(filepath=config_filepath)
|
||||
|
||||
assert config.api_key == "f3bf04fc"
|
||||
assert config.database.host == "changed"
|
||||
assert config.database.port == 6666
|
||||
|
||||
|
||||
FIXTURE_CONFIG_RAW_MISSING = """
|
||||
database:
|
||||
host: "localhost"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue