#!/usr/bin/env python3
"""
Quick verification that the fixes are working
"""

import os
import sys
import django

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

from django.test import RequestFactory, Client
from django.contrib.auth import get_user_model
from users.models import CustomUser

def test_views():
    print("=== TESTING VIEWS ===")
    
    # Create a test client
    client = Client()
    
    # Get a test user
    try:
        user = CustomUser.objects.filter(is_staff=True).first()
        if not user:
            user = CustomUser.objects.first()
        
        if user:
            # Login the user
            client.force_login(user)
            
            # Test documents page
            print("Testing documents page...")
            response = client.get('/utils/documents/')
            print(f"Documents page status: {response.status_code}")
            
            # Test notifications page
            print("Testing notifications page...")
            response = client.get('/utils/notifications/')
            print(f"Notifications page status: {response.status_code}")
            
            # Test customer documents page
            print("Testing customer documents page...")
            response = client.get('/utils/documents/all-customers/')
            print(f"Customer documents page status: {response.status_code}")
            
            print("✅ All pages loading successfully!")
            
        else:
            print("❌ No users found in database")
            
    except Exception as e:
        print(f"❌ Error testing views: {e}")

if __name__ == '__main__':
    test_views()