import requests BASE_URL = "http://localhost:8000" def test_profile(): print("\n--- Testing Profile ---") data = {"fitness_goals": "Run a sub-4 marathon", "dietary_preferences": "No dairy"} res = requests.post(f"{BASE_URL}/settings/profile", json=data) print(f"Save Profile: {res.status_code}") res = requests.get(f"{BASE_URL}/settings/profile") profile = res.json() print(f"Load Profile: {profile} - {'PASS' if profile.get('fitness_goals') == 'Run a sub-4 marathon' else 'FAIL'}") def test_agent_chat(): print("\n--- Testing Agent Chat ---") # This might fail if no API key is set, but we want to test the endpoint connectivity payload = { "message": "Overview of my last week?", "history": [] } res = requests.post(f"{BASE_URL}/analyze/chat", json=payload) if res.status_code == 200: print(f"Agent Response: {res.json()['message']}") else: print(f"Agent Error: {res.text}") if __name__ == "__main__": try: test_profile() test_agent_chat() except Exception as e: print(f"Test failed: {e}")