From 4ff18bd8bd3527d571a65b553c62aa70f5dfecb1 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Thu, 30 Nov 2023 14:04:56 -0500 Subject: [PATCH] Adding simple tests for initial routes --- tests/test_app.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_app.py b/tests/test_app.py index e69de29..96cb7b5 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -0,0 +1,21 @@ +import pytest +from litestar.testing import TestClient + +from speech_collect.app import app + + +@pytest.fixture +def client(): + return TestClient(app=app) + + +def test_index_route(client): + resp = client.get("/") + assert resp.status_code == 200 + assert resp.text == "Hello, world!" + + +def test_get_book(client): + resp = client.get("/books/1337") + assert resp.status_code == 200 + assert resp.json()["book_id"] == 1337