""" Quick test script to verify Claude's response behavior ⚠️ MANUAL INTEGRATION TEST - Not run by default in CI/CD This script tests that Claude responds directly without asking for permission when using custom tools. Requires Claude API key or claude-code login. REQUIREMENTS: - Claude API key or claude-code login - Backend API running on localhost:8001 (for real tool execution) USAGE: # Run as script python test_claude_response.py # Run via pytest (requires -m integration) pytest test_claude_response.py -m integration NOTE: Test function marked with @pytest.mark.integration """ import pytest import asyncio import sys import os # Add parent directory to path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from app.main import ClaudeAgentWrapper @pytest.mark.integration async def test_claude(): """Test Claude's response to a simple query""" print("="*60) print("Testing Claude Agent Response") print("="*60) # Initialize Claude Agent agent = ClaudeAgentWrapper() # Test message messages = [ {"role": "user", "content": "Care sunt companiile mele?"} ] # Mock JWT token (you'll need to replace this with a real one for actual API calls) jwt_token = "mock_token" telegram_user_id = 999999 print("\nSending query: 'Care sunt companiile mele?'") print("="*60) try: response = await agent.process_message( messages=messages, jwt_token=jwt_token, telegram_user_id=telegram_user_id ) print("\n📥 CLAUDE RESPONSE:") print("="*60) print(response) print("="*60) # Check if response asks for permission permission_keywords = [ "permisiune", "permission", "autorizare", "authorization", "pot accesa", "can I access", "să accesez" ] asks_permission = any(keyword.lower() in response.lower() for keyword in permission_keywords) if asks_permission: print("\n❌ FAIL: Claude is still asking for permission!") else: print("\n✅ PASS: Claude responds directly without asking permission") except Exception as e: print(f"\n❌ ERROR: {e}") import traceback traceback.print_exc() if __name__ == "__main__": asyncio.run(test_claude())