#!/usr/bin/env python
"""
Test script to verify audit URLs are accessible
"""
import os
import sys
import django

# Setup Django environment
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'branch_system.settings')
django.setup()

from django.urls import reverse
from django.test import Client
from django.contrib.auth import get_user_model

def test_audit_urls():
    """Test that audit URLs are properly configured"""
    
    # Test URL reversing
    audit_urls = [
        'users:audit_dashboard',
        'users:audit_trail_report', 
        'users:user_activity_analysis',
        'users:security_compliance_report',
        'users:permission_usage_analytics',
        'users:export_audit_report',
        'users:security_alerts',
    ]
    
    print("Testing audit URL configuration...")
    
    for url_name in audit_urls:
        try:
            url = reverse(url_name)
            print(f"✓ {url_name} -> {url}")
        except Exception as e:
            print(f"✗ {url_name} -> Error: {e}")
    
    print("\nAudit URLs are properly configured!")
    print("\nYou can now access:")
    print("1. Audit Dashboard: http://127.0.0.1:8000/users/audit/dashboard/")
    print("2. Audit Trail: http://127.0.0.1:8000/users/audit/trail/")
    print("3. User Activity: http://127.0.0.1:8000/users/audit/activity/")
    print("4. Security Compliance: http://127.0.0.1:8000/users/audit/security/")
    print("5. Permission Analytics: http://127.0.0.1:8000/users/audit/permissions/")

if __name__ == '__main__':
    test_audit_urls()