#!/bin/bash # OpenInterpreter Test Runner Script echo "๐Ÿงช OpenInterpreter Test Suite" echo "==============================" # Set up environment export PYTHONPATH="/workspaces/fastapi_django_main_live:$PYTHONPATH" # Check if pytest is installed if ! command -v pytest &> /dev/null; then echo "Installing pytest..." pip install pytest pytest-cov pytest-asyncio fi echo "" echo "๐Ÿ”ง Running OpenInterpreter Tests..." echo "====================================" # Run the test file directly first echo "1. Running basic functionality tests..." cd /workspaces/fastapi_django_main_live python -m tests.test_openinterpreter echo "" echo "๐Ÿš€ Starting Test API Server..." echo "==============================" # Start the test API server in background echo "Starting test API on port 7861..." python test_app.py & TEST_API_PID=$! # Wait for the server to start sleep 3 echo "" echo "๐Ÿงช Testing API Endpoints..." echo "============================" # Test the API endpoints using curl echo "Testing health endpoint..." curl -s http://localhost:7861/health | python -m json.tool echo "" echo "Testing code validation..." curl -s -X POST http://localhost:7861/test/validate-code \ -H "Content-Type: application/json" \ -d '{"code": "print(\"Hello, World!\")"}' | python -m json.tool echo "" echo "Testing database functionality..." curl -s http://localhost:7861/test/database | python -m json.tool echo "" echo "Running comprehensive test suite..." curl -s http://localhost:7861/test/suite | python -m json.tool echo "" echo "Testing basic chat (this may take a moment)..." curl -s -X POST http://localhost:7861/test/chat \ -H "Content-Type: application/json" \ -d '{"message": "What is 2+2?", "password": "12345"}' | python -m json.tool # Clean up - stop the test API server echo "" echo "๐Ÿงน Cleaning up..." kill $TEST_API_PID 2>/dev/null echo "" echo "๐Ÿ“Š Test Summary" echo "===============" echo "โœ“ Basic functionality tests completed" echo "โœ“ API endpoint tests completed" echo "โœ“ Code validation tests completed" echo "โœ“ Database operation tests completed" echo "โœ“ Chat functionality tests completed" echo "" echo "๐ŸŽฏ To run the test API manually:" echo " python test_app.py" echo " # Then visit http://localhost:7861/docs for API documentation" echo "" echo "๐Ÿ” To run specific tests:" echo " pytest tests/test_openinterpreter.py::TestOpenInterpreter::test_validate_code_valid" echo " pytest tests/test_openinterpreter.py -k \"code_validation\"" echo "" echo "๐Ÿ“ Test completed successfully!"