Add TLS reports capabilities
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from app.main import app
|
||||
import json
|
||||
|
||||
from app.main import _alert_view, app
|
||||
from app.models import Alert
|
||||
|
||||
|
||||
def test_generated_api_documentation_is_disabled():
|
||||
@@ -7,3 +10,37 @@ def test_generated_api_documentation_is_disabled():
|
||||
assert "/docs" not in paths
|
||||
assert "/redoc" not in paths
|
||||
assert "/openapi.json" not in paths
|
||||
|
||||
|
||||
def test_tls_report_detail_route_exists():
|
||||
paths = {route.path for route in app.routes}
|
||||
|
||||
assert "/tls-reports/{report_id}" in paths
|
||||
|
||||
|
||||
def test_tls_alert_links_to_tls_report_detail():
|
||||
alert = Alert(
|
||||
fingerprint="anamaka.net:tls_delivery_failures:anamaka.net:sts",
|
||||
inbox_id="anamaka",
|
||||
domain="anamaka.net",
|
||||
severity="warning",
|
||||
type="tls_delivery_failures",
|
||||
title="TLS delivery failures reported for anamaka.net",
|
||||
summary="summary",
|
||||
details_json=json.dumps(
|
||||
{
|
||||
"report_type": "tlsrpt",
|
||||
"report_db_id": 42,
|
||||
"date_range": {
|
||||
"begin": "2026-06-17T00:00:00+00:00",
|
||||
"end": "2026-06-17T23:59:59+00:00",
|
||||
},
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
view = _alert_view(alert)
|
||||
|
||||
assert view.report_db_id is None
|
||||
assert view.tls_report_db_id == 42
|
||||
assert view.source_report_url == "/tls-reports/42"
|
||||
|
||||
Reference in New Issue
Block a user