28 lines
867 B
Python
28 lines
867 B
Python
"""Sanity checks for admin audit router registration (no DB required)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
|
|
class AdminAuditRouterSmokeTests(unittest.TestCase):
|
|
def test_audit_router_registers_list_and_detail(self) -> None:
|
|
from src.admin_audit_routes import router
|
|
|
|
paths = [getattr(r, "path", "") for r in router.routes]
|
|
self.assertIn("/admin/audit", paths)
|
|
self.assertTrue(
|
|
any(isinstance(p, str) and p.startswith("/admin/audit/") for p in paths),
|
|
msg=f"detail route missing under router, paths={paths}",
|
|
)
|
|
|
|
def test_parse_sort_behavior(self) -> None:
|
|
from src.admin_audit_routes import _parse_sort
|
|
|
|
self.assertFalse(_parse_sort("occurred_at:desc"))
|
|
self.assertTrue(_parse_sort("occurred_at:asc"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|