diff --git a/server/api/test_server.py b/server/api/test_server.py index 43b96e2..9b91eb2 100644 --- a/server/api/test_server.py +++ b/server/api/test_server.py @@ -1,23 +1,28 @@ import os +import pytest +from fastapi.testclient import TestClient + os.environ["NO_DEVICE"] = "1" -import pytest +if not os.path.exists("static"): + os.makedirs("static") + from api.ws import app -from fastapi.testclient import TestClient client = TestClient(app) -@pytest.fixture(scope="module", autouse=True) + +@pytest.fixture(scope="session", autouse=True) def ensure_static_files_exist(): - if not os.path.exists("static"): - os.makedirs("static") if not os.path.exists("static/index.html"): with open("static/index.html", "w") as f: f.write("") yield os.remove("static/index.html") + os.rmdir("static") + def test_serves_html_on_root(): response = client.get("/") assert response.status_code == 200 - assert "" in response.text \ No newline at end of file + assert "" in response.text