Refine runtime config and redirect settings
This commit is contained in:
@@ -5,6 +5,7 @@ def test_settings_support_two_independent_database_urls(monkeypatch) -> None:
|
||||
monkeypatch.setenv("APP_DATABASE_URL", "sqlite:///./data/app.db")
|
||||
monkeypatch.setenv("LOCATION_DATABASE_URL", "sqlite:///./data/locationRecorder.db")
|
||||
monkeypatch.setenv("POO_DATABASE_URL", "sqlite:///./data/pooRecorder.db")
|
||||
monkeypatch.setenv("APP_HOSTNAME", "home.example.com")
|
||||
monkeypatch.setenv("POO_WEBHOOK_ID", "poo-hook")
|
||||
monkeypatch.setenv("POO_SENSOR_ENTITY_NAME", "sensor.test_poo_status")
|
||||
monkeypatch.setenv("POO_SENSOR_FRIENDLY_NAME", "Poo Status")
|
||||
@@ -28,6 +29,9 @@ def test_settings_support_two_independent_database_urls(monkeypatch) -> None:
|
||||
assert settings.home_assistant_base_url == "http://ha.local:8123"
|
||||
assert settings.home_assistant_auth_token == "token"
|
||||
assert settings.home_assistant_timeout_seconds == 2.5
|
||||
assert settings.app_hostname == "home.example.com"
|
||||
assert settings.app_base_url == "https://home.example.com"
|
||||
assert settings.ticktick_redirect_uri == "https://home.example.com/ticktick/auth/code"
|
||||
assert settings.auth_bootstrap_username == "admin"
|
||||
assert settings.auth_bootstrap_password == "secret"
|
||||
assert settings.auth_session_cookie_name == "auth_cookie"
|
||||
@@ -39,3 +43,13 @@ def test_settings_support_two_independent_database_urls(monkeypatch) -> None:
|
||||
assert settings.poo_sqlite_path is not None
|
||||
assert settings.poo_sqlite_path.name == "pooRecorder.db"
|
||||
assert settings.auth_cookie_secure is True
|
||||
|
||||
|
||||
def test_settings_derive_development_ticktick_redirect_uri(monkeypatch) -> None:
|
||||
monkeypatch.setenv("APP_ENV", "development")
|
||||
monkeypatch.setenv("APP_HOSTNAME", "localhost:11001")
|
||||
|
||||
settings = Settings(_env_file=None)
|
||||
|
||||
assert settings.app_base_url == "http://localhost:11001"
|
||||
assert settings.ticktick_redirect_uri == "http://localhost:11001/ticktick/auth/code"
|
||||
|
||||
Reference in New Issue
Block a user