"""How one bulk-upload-check result is read (US05-04). Only a duplicate rejection proves Immich holds the bytes. Every other answer — a rejection for another reason, an action this adapter does not know — must stay uncertain, because "the server did not say yes" is not "the file is not there". """ from photo_pipeline.integrations.immich_go import _holds_bytes, bulk_upload_check def test_a_duplicate_rejection_is_the_only_proof_of_possession(): assert _holds_bytes({"action": "reject", "reason": "duplicate"}) is True assert _holds_bytes({"action": "accept"}) is False def test_any_other_answer_is_uncertain_never_absent(): assert _holds_bytes({"action": "reject", "reason": "unsupported-format"}) is None assert _holds_bytes({"action": "quarantine"}) is None assert _holds_bytes({}) is None def test_missing_credentials_are_reported_not_silently_treated_as_absence(): result = bulk_upload_check("", None, {"asset": "abc"}) assert result["reachable"] is False assert result["present"] == {} assert "credentials" in result["detail"]