feat: add optional dashboard config fields
Made-with: Cursor
This commit is contained in:
@@ -28,3 +28,27 @@ def test_settings_admin_token_required():
|
||||
import pytest
|
||||
with pytest.raises(Exception):
|
||||
Settings()
|
||||
|
||||
|
||||
def test_dashboard_config_absent(monkeypatch):
|
||||
monkeypatch.setenv("NTR_ADMIN_TOKEN", "tok")
|
||||
monkeypatch.delenv("NTR_WEB_USER", raising=False)
|
||||
monkeypatch.delenv("NTR_WEB_PASSWORD", raising=False)
|
||||
monkeypatch.delenv("NTR_SECRET_KEY", raising=False)
|
||||
s = Settings()
|
||||
assert s.web_user is None
|
||||
assert s.web_password is None
|
||||
assert s.secret_key is None
|
||||
assert s.dashboard_enabled is False
|
||||
|
||||
|
||||
def test_dashboard_config_present(monkeypatch):
|
||||
monkeypatch.setenv("NTR_ADMIN_TOKEN", "tok")
|
||||
monkeypatch.setenv("NTR_WEB_USER", "nick")
|
||||
monkeypatch.setenv("NTR_WEB_PASSWORD", "secret")
|
||||
monkeypatch.setenv("NTR_SECRET_KEY", "signme")
|
||||
s = Settings()
|
||||
assert s.web_user == "nick"
|
||||
assert s.web_password == "secret"
|
||||
assert s.secret_key == "signme"
|
||||
assert s.dashboard_enabled is True
|
||||
|
||||
Reference in New Issue
Block a user