feat(fc2c-i): artist overview + paged images endpoints
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import pytest
|
||||
|
||||
from backend.app import create_app
|
||||
from backend.app.models import Artist
|
||||
|
||||
pytestmark = pytest.mark.integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def client():
|
||||
app = create_app()
|
||||
async with app.test_client() as c:
|
||||
yield c
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_artist_404(client):
|
||||
resp = await client.get("/api/artist/nope")
|
||||
assert resp.status_code == 404
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_artist_overview_ok(client, db):
|
||||
db.add(Artist(name="Mira", slug="mira"))
|
||||
await db.flush()
|
||||
await db.commit()
|
||||
resp = await client.get("/api/artist/mira")
|
||||
assert resp.status_code == 200
|
||||
body = await resp.get_json()
|
||||
assert body["name"] == "Mira"
|
||||
assert body["image_count"] == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_artist_images_404(client):
|
||||
resp = await client.get("/api/artist/nope/images")
|
||||
assert resp.status_code == 404
|
||||
Reference in New Issue
Block a user