From 785fb15f2be1bac52af54a894f2184d35c54d7d1 Mon Sep 17 00:00:00 2001 From: Melyns <60199831+Melyns@users.noreply.github.com> Date: Thu, 12 Sep 2024 21:30:55 +0100 Subject: [PATCH] Create test_app.py --- .github/test_app.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/test_app.py diff --git a/.github/test_app.py b/.github/test_app.py new file mode 100644 index 0000000..13e5f0e --- /dev/null +++ b/.github/test_app.py @@ -0,0 +1,23 @@ +from fastapi.testclient import TestClient +from app import app + +client = TestClient(app) + +def test_index(): + response = client.get("/") + assert response.status_code == 200 + assert "Welcome" in response.text + +def test_new_chat(): + response = client.post("/new-chat") + assert response.status_code == 200 + assert response.json() == {"status": "new chat started"} + +def test_pause(): + response = client.post("/pause") + assert response.status_code == 200 + assert response.json()["paused"] is True + + response = client.post("/pause") + assert response.status_code == 200 + assert response.json()["paused"] is False