|
#!/bin/bash |
|
|
|
|
|
|
|
echo "π§ͺ OpenInterpreter Test Suite" |
|
echo "==============================" |
|
|
|
|
|
export PYTHONPATH="/workspaces/fastapi_django_main_live:$PYTHONPATH" |
|
|
|
|
|
if ! command -v pytest &> /dev/null; then |
|
echo "Installing pytest..." |
|
pip install pytest pytest-cov pytest-asyncio |
|
fi |
|
|
|
echo "" |
|
echo "π§ Running OpenInterpreter Tests..." |
|
echo "====================================" |
|
|
|
|
|
echo "1. Running basic functionality tests..." |
|
cd /workspaces/fastapi_django_main_live |
|
python -m tests.test_openinterpreter |
|
|
|
echo "" |
|
echo "π Starting Test API Server..." |
|
echo "==============================" |
|
|
|
|
|
echo "Starting test API on port 7861..." |
|
python test_app.py & |
|
TEST_API_PID=$! |
|
|
|
|
|
sleep 3 |
|
|
|
echo "" |
|
echo "π§ͺ Testing API Endpoints..." |
|
echo "============================" |
|
|
|
|
|
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 |
|
|
|
|
|
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!" |
|
|