Support analog photo dates and correct gallery years
This commit is contained in:
@@ -195,6 +195,28 @@ def test_photo_dates_can_come_from_photos_library_metadata(service):
|
||||
assert "capture date is missing" in missing.json["error"]
|
||||
|
||||
|
||||
def test_batch_date_taken_overrides_metadata_for_analog_photos(service):
|
||||
_, client, data = service
|
||||
response = client.post("/api/photos", headers=AUTH, data={
|
||||
"photos": [
|
||||
(io.BytesIO(photo(exif=Image.Exif())), "first.jpg"),
|
||||
(io.BytesIO(photo(exif=Image.Exif())), "second.jpg"),
|
||||
],
|
||||
"photo_dates": "2026-01-02T03:04:05+00:00\n2026-01-03T03:04:05+00:00",
|
||||
"date_taken": "2025",
|
||||
})
|
||||
assert response.status_code == 202
|
||||
manifest = json.loads((data / "submissions" / response.json["id"] / "manifest.json").read_text())
|
||||
assert all(value.startswith("2025-01-01T") for value in manifest["capture_dates"])
|
||||
|
||||
invalid = client.post("/api/photos", headers=AUTH, data={
|
||||
"photos": [(io.BytesIO(photo()), "photo.jpg")],
|
||||
"date_taken": "last summer",
|
||||
})
|
||||
assert invalid.status_code == 400
|
||||
assert "year, ISO date, or ISO timestamp" in invalid.json["error"]
|
||||
|
||||
|
||||
def test_dated_retry_replaces_the_same_undated_upload(service):
|
||||
_, client, data = service
|
||||
raw = photo()
|
||||
|
||||
Reference in New Issue
Block a user