cabd73287a
Removing the create_app import left 2 blank lines before pytestmark in 9 files where ruff isort wants 1. Also stripped two pre-existing whitespace-only blank lines surfaced by the file change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
import pytest
|
|
|
|
pytestmark = pytest.mark.integration
|
|
|
|
|
|
async def _series(client, name="Vol"):
|
|
r = await client.post("/api/tags", json={"name": name, "kind": "series"})
|
|
return (await r.get_json())["id"]
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_pages_404_for_non_series(client):
|
|
r = await client.post("/api/tags", json={"name": "g", "kind": "general"})
|
|
gid = (await r.get_json())["id"]
|
|
resp = await client.get(f"/api/series/{gid}/pages")
|
|
assert resp.status_code == 404
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_pages_empty_shape(client):
|
|
sid = await _series(client, "Empty")
|
|
resp = await client.get(f"/api/series/{sid}/pages")
|
|
assert resp.status_code == 200
|
|
body = await resp.get_json()
|
|
assert body["series"]["id"] == sid
|
|
assert body["pages"] == []
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_add_requires_ids(client):
|
|
sid = await _series(client, "NoIds")
|
|
resp = await client.post(f"/api/series/{sid}/pages", json={})
|
|
assert resp.status_code == 400
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_add_over_cap_400(client):
|
|
sid = await _series(client, "Cap")
|
|
resp = await client.post(
|
|
f"/api/series/{sid}/pages",
|
|
json={"image_ids": list(range(1, 502))},
|
|
)
|
|
assert resp.status_code == 400
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_reorder_mismatch_400(client):
|
|
sid = await _series(client, "Re")
|
|
resp = await client.post(
|
|
f"/api/series/{sid}/reorder", json={"image_ids": [1, 2, 3]}
|
|
)
|
|
assert resp.status_code == 400
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_cover_requires_image_id(client):
|
|
sid = await _series(client, "Cov")
|
|
resp = await client.post(f"/api/series/{sid}/cover", json={})
|
|
assert resp.status_code == 400
|