47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
#!/usr/bin/env python
|
|
"""Test script to verify URL configuration"""
|
|
|
|
import os
|
|
import sys
|
|
import django
|
|
|
|
# Add the project directory to the Python path
|
|
sys.path.append('/home/ismail/projects/ats/kaauh_ats')
|
|
|
|
# Set up Django
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NorahUniversity.settings')
|
|
django.setup()
|
|
|
|
from django.urls import reverse
|
|
from django.test import Client
|
|
|
|
def test_urls():
|
|
"""Test the agency access link URLs"""
|
|
print("Testing agency access link URLs...")
|
|
|
|
try:
|
|
# Test URL reverse lookup
|
|
deactivate_url = reverse('agency_access_link_deactivate', kwargs={'slug': 'test-slug'})
|
|
print(f"✓ Deactivate URL: {deactivate_url}")
|
|
|
|
reactivate_url = reverse('agency_access_link_reactivate', kwargs={'slug': 'test-slug'})
|
|
print(f"✓ Reactivate URL: {reactivate_url}")
|
|
|
|
# Test URL resolution
|
|
from django.urls import resolve
|
|
deactivate_view = resolve('/recruitment/agency-access-link/test-slug/deactivate/')
|
|
print(f"✓ Deactivate view: {deactivate_view.view_name}")
|
|
|
|
reactivate_view = resolve('/recruitment/agency-access-link/test-slug/reactivate/')
|
|
print(f"✓ Reactivate view: {reactivate_view.view_name}")
|
|
|
|
print("\n✅ All URL tests passed!")
|
|
return True
|
|
|
|
except Exception as e:
|
|
print(f"❌ Error testing URLs: {e}")
|
|
return False
|
|
|
|
if __name__ == '__main__':
|
|
test_urls()
|