68 lines
2.3 KiB
Python
68 lines
2.3 KiB
Python
#!/usr/bin/env python
|
|
import os
|
|
import sys
|
|
import django
|
|
|
|
# Add project root to Python path
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
# Set Django settings module
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NorahUniversity.settings')
|
|
|
|
# Initialize Django
|
|
django.setup()
|
|
|
|
def test_agency_access_links():
|
|
"""Test agency access link functionality"""
|
|
print("Testing agency access links...")
|
|
|
|
# Test 1: Check if URLs exist
|
|
try:
|
|
from recruitment.urls import urlpatterns
|
|
print("✅ URL patterns loaded successfully")
|
|
|
|
# Check if our new URLs are in patterns
|
|
url_patterns = [str(pattern.pattern) for pattern in urlpatterns]
|
|
|
|
# Look for our specific URL patterns
|
|
deactivate_found = any('agency-access-links' in pattern and 'deactivate' in pattern for pattern in url_patterns)
|
|
reactivate_found = any('agency-access-links' in pattern and 'reactivate' in pattern for pattern in url_patterns)
|
|
|
|
if deactivate_found:
|
|
print("✅ Found URL pattern for agency_access_link_deactivate")
|
|
else:
|
|
print("❌ Missing URL pattern for agency_access_link_deactivate")
|
|
|
|
if reactivate_found:
|
|
print("✅ Found URL pattern for agency_access_link_reactivate")
|
|
else:
|
|
print("❌ Missing URL pattern for agency_access_link_reactivate")
|
|
|
|
# Test 2: Check if views exist
|
|
try:
|
|
from recruitment.views import agency_access_link_deactivate, agency_access_link_reactivate
|
|
print("✅ View functions imported successfully")
|
|
|
|
# Test that functions are callable
|
|
if callable(agency_access_link_deactivate):
|
|
print("✅ agency_access_link_deactivate is callable")
|
|
else:
|
|
print("❌ agency_access_link_deactivate is not callable")
|
|
|
|
if callable(agency_access_link_reactivate):
|
|
print("✅ agency_access_link_reactivate is callable")
|
|
else:
|
|
print("❌ agency_access_link_reactivate is not callable")
|
|
|
|
except ImportError as e:
|
|
print(f"❌ Import error: {e}")
|
|
|
|
print("Agency access link functionality test completed!")
|
|
return True
|
|
except Exception as e:
|
|
print(f"❌ Test failed: {e}")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
test_agency_access_links()
|