#!/bin/bash echo "๐Ÿš€ Starting User Service and Testing API" # Activate virtual environment source .venv/bin/activate # Set PYTHONPATH export PYTHONPATH="${PWD}:${PYTHONPATH}" # Start user service in background cd services/user_service python -m uvicorn main:app --host 0.0.0.0 --port 8001 & USER_SERVICE_PID=$! echo "โณ Waiting for service to start..." sleep 5 # Go back to project root cd ../.. # Test registration echo "๐Ÿงช Testing user registration..." RESPONSE=$(curl -s -X POST "http://localhost:8001/api/v1/register" \ -H "Content-Type: application/json" \ -d '{ "email": "test@example.com", "password": "testpassword123", "first_name": "Test", "last_name": "User", "phone": "+1234567890" }') echo "๐Ÿ“ Registration response:" echo "$RESPONSE" | jq . 2>/dev/null || echo "$RESPONSE" # Test login echo -e "\n๐Ÿงช Testing user login..." LOGIN_RESPONSE=$(curl -s -X POST "http://localhost:8001/api/v1/login" \ -H "Content-Type: application/json" \ -d '{ "email": "test@example.com", "password": "testpassword123" }') echo "๐Ÿ“ Login response:" echo "$LOGIN_RESPONSE" | jq . 2>/dev/null || echo "$LOGIN_RESPONSE" # Stop the service echo -e "\n๐Ÿ›‘ Stopping service..." kill $USER_SERVICE_PID echo "โœ… Test completed!"