feat: global notification policy severity to channels (notif-22)
Singleton notification_policy table, NOTIFY_MIN_SEVERITY/CHANNELS env, central dispatch gate, Settings policy UI, migration 007. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,8 @@ def test_get_notification_settings_masks_secrets(jwt_headers, client, monkeypatc
|
||||
assert body["telegram"]["min_severity"] == "warning"
|
||||
assert body["telegram"]["source"] == "env"
|
||||
assert body["telegram"]["bot_token_hint"].endswith("ghij")
|
||||
assert "policy" in body
|
||||
assert body["policy"]["min_severity"] == "warning"
|
||||
assert "webhook" in body
|
||||
assert body["webhook"]["enabled"] is False
|
||||
assert "email" in body
|
||||
@@ -38,7 +40,6 @@ def test_put_email_settings_persists_db(jwt_headers, client, db_session, monkeyp
|
||||
headers=jwt_headers,
|
||||
json={
|
||||
"enabled": True,
|
||||
"min_severity": "warning",
|
||||
"smtp_host": "smtp.example.com",
|
||||
"smtp_port": 587,
|
||||
"smtp_user": "monitor",
|
||||
@@ -95,7 +96,6 @@ def test_put_webhook_settings_persists_db(jwt_headers, client, db_session, monke
|
||||
headers=jwt_headers,
|
||||
json={
|
||||
"enabled": True,
|
||||
"min_severity": "warning",
|
||||
"url": "https://example.com/hooks/sac",
|
||||
"secret_header": "X-SAC-Token",
|
||||
"secret": "supersecret",
|
||||
@@ -145,7 +145,6 @@ def test_put_telegram_settings_persists_db(jwt_headers, client, db_session, monk
|
||||
headers=jwt_headers,
|
||||
json={
|
||||
"enabled": True,
|
||||
"min_severity": "warning",
|
||||
"bot_token": "1234567890:TESTTOKEN",
|
||||
"chat_id": "999001",
|
||||
},
|
||||
@@ -154,7 +153,6 @@ def test_put_telegram_settings_persists_db(jwt_headers, client, db_session, monk
|
||||
body = response.json()
|
||||
assert body["source"] == "db"
|
||||
assert body["enabled"] is True
|
||||
assert body["min_severity"] == "warning"
|
||||
|
||||
row = db_session.get(NotificationChannel, "telegram")
|
||||
assert row is not None
|
||||
@@ -163,7 +161,6 @@ def test_put_telegram_settings_persists_db(jwt_headers, client, db_session, monk
|
||||
|
||||
cfg = get_effective_telegram_config(db_session)
|
||||
assert cfg.source == "db"
|
||||
assert cfg.min_severity == "warning"
|
||||
|
||||
|
||||
def test_post_telegram_test_success(jwt_headers, client, db_session, monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user