pupilometer/test/test_curl.sh

32 lines
701 B
Bash

#!/bin/bash
# test_curl.sh
# Activate virtual environment and install dependencies
source .venv/bin/activate
pip3 install -r requirements.txt
# Start the application in the background with camera debug mode
export CAMERA_DEBUG_MODE=True
python3 src/pupilometerApp/app.py > app.log 2>&1 &
APP_PID=$!
# Give the server a moment to start
sleep 5
# Test the main page
if curl -s "http://localhost:5000" | grep -q "Pupilometer Control"; then
echo "Curl test PASSED: Found title in the main page."
RESULT=0
else
echo "Curl test FAILED: Did not find title in the main page."
RESULT=1
fi
# Stop the application
kill $APP_PID
# Deactivate the virtual environment
deactivate
exit $RESULT