""" Quick test to verify audit logging is working Run this after creating/updating/deleting a task """ import asyncio from src.database import get_session_dep from src.routers.audit import router as audit_router from src.models.audit_log import AuditLog from sqlmodel import Session, select async def verify_audit_logging(): """Verify that audit logs are being saved""" # This would need proper database setup, but serves as a reference # In production, use: curl -X GET http://localhost:8000/api/health pass # Manual curl commands to test: # 1. Check backend health ''' curl -X GET https://tahasaif3-taskflow-app.hf.space/api/health Expected: {"status": "healthy"} ''' # 2. Create a test task ''' curl -X POST https://tahasaif3-taskflow-app.hf.space/api/{user_id}/tasks/ \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "title": "Test Task", "description": "Testing audit logging", "completed": false }' ''' # 3. Fetch audit logs ''' curl -X GET "https://tahasaif3-taskflow-app.hf.space/api/audit/events/{user_id}?offset=0&limit=50" \ -H "Authorization: Bearer {token}" ''' # 4. Check database directly (if you have SQL access) ''' SELECT * FROM audit_log ORDER BY timestamp DESC LIMIT 10; '''