feat: add stage 0 foundation
This commit is contained in:
1
backend/apps/audit/tests/__init__.py
Normal file
1
backend/apps/audit/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
20
backend/apps/audit/tests/test_audit_api.py
Normal file
20
backend/apps/audit/tests/test_audit_api.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from apps.audit.models import OperationAuditLog
|
||||
|
||||
|
||||
def test_list_operation_logs_returns_recent_logs(client, db):
|
||||
OperationAuditLog.objects.create(
|
||||
module="system",
|
||||
action="health_check",
|
||||
target_type="system",
|
||||
target_id="health",
|
||||
result="success",
|
||||
request_snapshot={"path": "/api/system/health"},
|
||||
)
|
||||
|
||||
response = client.get("/api/audit/operation-logs")
|
||||
|
||||
assert response.status_code == 200
|
||||
payload = response.json()
|
||||
assert len(payload) == 1
|
||||
assert payload[0]["module"] == "system"
|
||||
assert payload[0]["action"] == "health_check"
|
||||
Reference in New Issue
Block a user