apply auto-formatting to tests
This commit is contained in:
parent
65ae10c500
commit
9ffcc53571
3 changed files with 4 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from unwind import db, models, web_models
|
from unwind import db, models, web_models
|
||||||
|
|
@ -7,7 +8,6 @@ from unwind import db, models, web_models
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_add_and_get(shared_conn: db.Database):
|
async def test_add_and_get(shared_conn: db.Database):
|
||||||
async with shared_conn.transaction(force_rollback=True):
|
async with shared_conn.transaction(force_rollback=True):
|
||||||
|
|
||||||
m1 = models.Movie(
|
m1 = models.Movie(
|
||||||
title="test movie",
|
title="test movie",
|
||||||
release_year=2013,
|
release_year=2013,
|
||||||
|
|
@ -33,7 +33,6 @@ async def test_add_and_get(shared_conn: db.Database):
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_find_ratings(shared_conn: db.Database):
|
async def test_find_ratings(shared_conn: db.Database):
|
||||||
async with shared_conn.transaction(force_rollback=True):
|
async with shared_conn.transaction(force_rollback=True):
|
||||||
|
|
||||||
m1 = models.Movie(
|
m1 = models.Movie(
|
||||||
title="test movie",
|
title="test movie",
|
||||||
release_year=2013,
|
release_year=2013,
|
||||||
|
|
@ -157,4 +156,3 @@ async def test_find_ratings(shared_conn: db.Database):
|
||||||
rows = await db.find_ratings(title="test", include_unrated=True)
|
rows = await db.find_ratings(title="test", include_unrated=True)
|
||||||
ratings = tuple(web_models.Rating(**r) for r in rows)
|
ratings = tuple(web_models.Rating(**r) for r in rows)
|
||||||
assert (web_models.Rating.from_movie(m1),) == ratings
|
assert (web_models.Rating.from_movie(m1),) == ratings
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from unwind.imdb import imdb_rating_from_score, score_from_imdb_rating
|
from unwind.imdb import imdb_rating_from_score, score_from_imdb_rating
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
from starlette.testclient import TestClient
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from starlette.testclient import TestClient
|
||||||
|
|
||||||
from unwind import create_app
|
from unwind import create_app, db, imdb, models
|
||||||
from unwind import db, models, imdb
|
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|
||||||
|
|
@ -10,7 +9,6 @@ app = create_app()
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_app(shared_conn: db.Database):
|
async def test_app(shared_conn: db.Database):
|
||||||
async with shared_conn.transaction(force_rollback=True):
|
async with shared_conn.transaction(force_rollback=True):
|
||||||
|
|
||||||
# https://www.starlette.io/testclient/
|
# https://www.starlette.io/testclient/
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
response = client.get("/api/v1/movies")
|
response = client.get("/api/v1/movies")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue