mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-06 03:05:25 +00:00
test: add first test
This commit is contained in:
parent
ec03b818f3
commit
5c850a56c1
@ -33,6 +33,11 @@ def get_db():
|
||||
db.close()
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root():
|
||||
return {"healthy": True}
|
||||
|
||||
|
||||
@app.post("/libraries", response_model=Library)
|
||||
def new_library(library_param: NewLibraryParam, db: Session = Depends(get_db)):
|
||||
library = create_library(library_param, db)
|
||||
|
11
memos/test_server.py
Normal file
11
memos/test_server.py
Normal file
@ -0,0 +1,11 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from .server import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_read_main():
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"healthy": True}
|
Loading…
x
Reference in New Issue
Block a user