talk2map-prod / tests /e2e /test_e2e_app.py
Noel-Teens's picture
testing workflow
622b3c4
Raw History Blame Contribute Delete
686 Bytes
import subprocess
import time
import requests
BBOX = {
"north_east": {"lat": 40.0, "lon": -73.0},
"south_west": {"lat": 39.0, "lon": -74.0},
}
def start_server():
proc = subprocess.Popen(
["uvicorn", "api.app:app", "--port", "8001", "--host", "127.0.0.1"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
# give uvicorn a moment to boot
time.sleep(2)
return proc
def test_e2e_health_and_chat():
proc = start_server()
try:
# health check
r = requests.get("http://127.0.0.1:8001/health")
assert r.status_code == 200
assert r.json()["status"] == "ok"
finally:
proc.terminate()