create dataclasses for output data
This commit is contained in:
parent
146e6ff6b8
commit
e49ea603ee
3 changed files with 96 additions and 36 deletions
|
|
@ -4,6 +4,7 @@ import pytest
|
|||
from unwind import create_app
|
||||
from unwind import db, models, imdb
|
||||
|
||||
# https://pypi.org/project/pytest-asyncio/
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
app = create_app()
|
||||
|
|
@ -15,6 +16,7 @@ async def test_app():
|
|||
|
||||
async with conn.transaction(force_rollback=True):
|
||||
|
||||
# https://www.starlette.io/testclient/
|
||||
client = TestClient(app)
|
||||
response = client.get("/api/v1/movies")
|
||||
assert response.status_code == 403
|
||||
|
|
@ -36,10 +38,9 @@ async def test_app():
|
|||
|
||||
response = client.get("/api/v1/movies", params={"include_unrated": 1})
|
||||
assert response.status_code == 200
|
||||
assert response.json() == [{**db.asplain(m), "user_scores": []}]
|
||||
assert response.json() == [{**models.asplain(m), "user_scores": []}]
|
||||
|
||||
m_plain = {
|
||||
"unwind_id": m.id,
|
||||
"canonical_title": m.title,
|
||||
"imdb_score": m.imdb_score,
|
||||
"imdb_votes": m.imdb_votes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue