#!/usr/bin/env python3
import requests
import json

# Test login with non-existent email to verify IntegrityError fix
url = 'http://localhost:8002/auth/login/'
data = {
    'email': 'nonexistent@test.com',
    'password': 'wrongpassword'
}

print("Testing login with non-existent email...")
try:
    response = requests.post(url, data=data, allow_redirects=False)
    print(f"Status Code: {response.status_code}")
    print(f"Response Headers: {dict(response.headers)}")
    
    if response.status_code == 500:
        print("ERROR: Server returned 500 - IntegrityError likely still present")
    elif response.status_code in [200, 302]:
        print("SUCCESS: No IntegrityError - fix is working")
    else:
        print(f"Unexpected status code: {response.status_code}")
        
except Exception as e:
    print(f"Request failed: {e}")