Clarify shared Photos session and independent source settings

This commit is contained in:
Pigway
2026-10-10 09:38:27 +08:00
parent a869f0b042
commit 9c9697dc6e
5 changed files with 88 additions and 5 deletions
+49
View File
@@ -17,3 +17,52 @@ def test_filename_does_not_determine_photo_source(client, service):
client.get("/api/v1/assets?source=uploaded").json()[0]["name"] == "weather.jpg"
)
assert client.get("/api/v1/assets?source=invalid").status_code == 422
def test_multiple_sources_keep_separate_people_and_folder_settings(
service, settings, tmp_path
):
from pigway_frame_flow.providers.photo_sources import PhotoSourceInput
root = tmp_path / "photos"
root.mkdir()
(root / "family").mkdir()
(root / "travel").mkdir()
settings.photo_root = root
service.photo_sources.save(
"family",
PhotoSourceInput(
name="Family",
kind="local",
location="family",
people_filter=True,
person_ids=[1],
orientation="portrait",
),
)
service.photo_sources.save(
"travel",
PhotoSourceInput(
name="Travel",
kind="local",
location="travel",
people_filter=True,
person_ids=[2],
orientation="landscape",
),
)
before = service.photo_sources.get("travel").model_dump()
service.photo_sources.save(
"family",
PhotoSourceInput(
name="Family",
kind="local",
location="family",
people_filter=True,
person_ids=[3],
orientation="auto",
),
)
assert service.photo_sources.get("travel").model_dump() == before
assert service.photo_sources.get("family").person_ids == [3]
assert service.photo_sources.get("travel").person_ids == [2]