-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7f24e3
commit 3130d0a
Showing
1 changed file
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
from runner_manager.models.settings import Settings | ||
Check failure on line 1 in tests/unit/models/test_settings.py GitHub Actions / Trunk Checkblack
|
||
from runner_manager.models.settings import yaml_config_settings_source | ||
from pytest import fixture | ||
import tempfile | ||
import os | ||
import yaml | ||
from pathlib import Path | ||
|
||
|
||
@fixture | ||
def test_settings_default_values(): | ||
settings = Settings() | ||
assert settings.name == "runner-manager" | ||
assert settings.redis_om_url is None | ||
assert settings.github_base_url is None | ||
assert settings.redis_om_url == "redis://localhost:6379/0" | ||
assert settings.github_base_url == "http://localhost:4010" | ||
|
||
@fixture | ||
def test_env_settings(): | ||
env_settings = { | ||
"NAME": "name-test", | ||
"REDIS_OM_URL": "redis://localhost:6379/1", | ||
"GITHUB_BASE_URL": "http://localhost:4999", | ||
} | ||
settings = Settings() | ||
settings.Config.customise_sources(env_settings=env_settings, init_settings={}, file_secret_settings={}) | ||
assert settings.name == "name-test" | ||
assert settings.redis_om_url == "redis://localhost:6379/1" | ||
assert settings.github_base_url == "http://localhost:4999" |