Initialize git, add Apache-2.0 LICENSE, .gitattributes (LF line endings), AGENTS.md (entry points, stack, discovery order, baseline checks), RUNBOOK.md (dev boot, prod deploy with overlay, ingestion, failures, rollback, scaling notes), .env.prod.example with rotated credential placeholders, and dev-only warnings on .env.example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23 lines
623 B
Python
23 lines
623 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from app.utils.hashing import sha256_file
|
|
|
|
|
|
def test_two_files_with_same_content_share_sha(tmp_path: Path):
|
|
a = tmp_path / "a.pdf"
|
|
b = tmp_path / "b.pdf"
|
|
payload = b"%PDF-1.4\n" + b"x" * 4096
|
|
a.write_bytes(payload)
|
|
b.write_bytes(payload)
|
|
assert sha256_file(a) == sha256_file(b)
|
|
|
|
|
|
def test_one_byte_difference_changes_sha(tmp_path: Path):
|
|
a = tmp_path / "a.pdf"
|
|
b = tmp_path / "b.pdf"
|
|
a.write_bytes(b"%PDF-1.4\n" + b"x" * 4096)
|
|
b.write_bytes(b"%PDF-1.4\n" + b"x" * 4095 + b"y")
|
|
assert sha256_file(a) != sha256_file(b)
|