test(review): compare original XLSX bytes to identical immutable snapshot
davoodmehraban89 committed
Oct 31, 2026 at 00:27 UTC
79f242460a90ec49892f79e455bea0211fd9d451
1 file changed
+6
-4
backend/tests/test_reconciliation_review_cli.py
+6
-4
@@ -36,7 +36,8 @@ def run(tmp_path, capsys, *, expected="126.00", company="001", data=None):
36
37
38
def test_cli_matched_is_still_unapproved(tmp_path, capsys):
39
- code, captured, xlsx, controls = run(tmp_path, capsys)
39
+ source_bytes = workbook()
40
+ code, captured, xlsx, controls = run(tmp_path, capsys, data=source_bytes)
41
assert code == 0
42
result = json.loads(captured.out)
43
assert result["matched_for_analyst_review"]
@@ -44,7 +45,7 @@ def test_cli_matched_is_still_unapproved(tmp_path, capsys):
45
assert not result["releasable"]
46
assert len(result["reference_sha256"]) == 64
47
assert captured.err == ""
47
- assert xlsx.read_bytes() == workbook()
48
+ assert xlsx.read_bytes() == source_bytes
49
assert json.loads(controls.read_text()) == manifest()
50
51
@@ -132,10 +133,11 @@ def test_manifest_size_checked_before_read(tmp_path):
133
134
135
def test_no_snapshot_written_or_input_edited_on_mismatch(tmp_path, capsys):
135
- code, _, xlsx, controls = run(tmp_path, capsys, expected="-100.00")
136
+ source_bytes = workbook()
137
+ code, _, xlsx, controls = run(tmp_path, capsys, expected="-100.00", data=source_bytes)
138
assert code == 3
139
assert sorted(path.name for path in tmp_path.iterdir()) == [
140
"synthetic.json", "synthetic.xlsx",
141
]
140
- assert xlsx.read_bytes() == workbook()
142
+ assert xlsx.read_bytes() == source_bytes
143
assert json.loads(controls.read_text()) == manifest(expected="-100.00")