#!/usr/bin/env python3
"""
Test script to verify login functionality.
"""

import requests
import json

def test_login():
    """Test the login endpoint."""
    url = "http://localhost:8000/auth/login"
    
    # Test data
    login_data = {
        "email": "admin@vfx.com",
        "password": "admin123"
    }
    
    try:
        print("Testing login endpoint...")
        print(f"URL: {url}")
        print(f"Data: {json.dumps(login_data, indent=2)}")
        
        response = requests.post(url, json=login_data)
        
        print(f"\nResponse Status: {response.status_code}")
        print(f"Response Headers: {dict(response.headers)}")
        
        if response.status_code == 200:
            print("✅ Login successful!")
            data = response.json()
            print(f"Response: {json.dumps(data, indent=2)}")
        else:
            print("❌ Login failed!")
            print(f"Error: {response.text}")
            
    except Exception as e:
        print(f"❌ Error: {e}")

if __name__ == "__main__":
    test_login()