Adding simple tests for initial routes
parent
8547434c31
commit
4ff18bd8bd
@ -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
|
Loading…
Reference in New Issue