21 lines
614 B
Python
21 lines
614 B
Python
from apps.audit.models import OperationAuditLog
|
|
|
|
|
|
def test_list_operation_logs_returns_recent_logs(admin_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 = admin_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"
|