First commit with entire first rendition of the project

This commit is contained in:
Your Name
2026-06-25 21:18:07 -06:00
commit 551322a94b
42 changed files with 4346 additions and 0 deletions

38
tests/test_gallery.py Normal file
View File

@@ -0,0 +1,38 @@
import io
from PIL import Image as PILImage
def _upload_image(client, filename="test_photo.jpg", color=(128, 64, 200)):
img = PILImage.new("RGB", (800, 600), color=color)
buf = io.BytesIO()
img.save(buf, format="JPEG")
buf.seek(0)
return client.post(
"/api/images",
data={"file": (buf, filename)},
content_type="multipart/form-data",
)
class TestGalleryDelete:
def test_upload_delete_flow(self, client):
resp = _upload_image(client)
assert resp.status_code == 201
data = resp.get_json()
image_id = data["id"]
resp = client.get("/api/images")
assert resp.status_code == 200
data = resp.get_json()
total_before = data["total"]
assert total_before >= 1
resp = client.delete(f"/api/images/{image_id}")
assert resp.status_code == 200
assert resp.get_json() == {"status": "deleted"}
resp = client.get("/api/images")
assert resp.status_code == 200
data = resp.get_json()
assert data["total"] == total_before - 1