feat: SAC Telegram settings view, notify_problem severity gate, exclusive docs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""GET /api/v1/settings/notifications"""
|
||||
|
||||
from app.services.telegram_notify import get_settings
|
||||
|
||||
|
||||
def test_get_notification_settings_masks_secrets(jwt_headers, client, monkeypatch):
|
||||
monkeypatch.setenv("TELEGRAM_ENABLED", "true")
|
||||
monkeypatch.setenv("TELEGRAM_BOT_TOKEN", "1234567890:ABCDEFghij")
|
||||
monkeypatch.setenv("TELEGRAM_CHAT_ID", "2843230")
|
||||
monkeypatch.setenv("TELEGRAM_MIN_SEVERITY", "warning")
|
||||
get_settings.cache_clear()
|
||||
|
||||
response = client.get("/api/v1/settings/notifications", headers=jwt_headers)
|
||||
assert response.status_code == 200
|
||||
body = response.json()
|
||||
assert body["telegram"]["enabled"] is True
|
||||
assert body["telegram"]["configured"] is True
|
||||
assert body["telegram"]["min_severity"] == "warning"
|
||||
assert body["telegram"]["source"] == "env"
|
||||
assert body["telegram"]["bot_token_hint"].endswith("ghij")
|
||||
assert "1234567890" not in body["telegram"]["bot_token_hint"]
|
||||
Reference in New Issue
Block a user