32 lines
978 B
Python
32 lines
978 B
Python
from openpyxl import load_workbook
|
|
|
|
from orc_renaming.ledger import Ledger
|
|
from orc_renaming.models import ProcessingRecord
|
|
|
|
|
|
def test_ledger_records_and_exports(tmp_path) -> None:
|
|
ledger = Ledger(tmp_path / "state.sqlite3")
|
|
ledger.add(
|
|
ProcessingRecord(
|
|
remote_path="/Eingang/scan.pdf",
|
|
original_name="scan.pdf",
|
|
new_name="260718_RE_Firma-priv.pdf",
|
|
checksum="abc",
|
|
model="qwen3.5:4B",
|
|
status="success",
|
|
evidence=["Rechnungsdatum: 18.07.2026"],
|
|
)
|
|
)
|
|
assert ledger.is_completed("abc")
|
|
|
|
destination = tmp_path / "protokoll.xlsx"
|
|
ledger.export_xlsx(destination)
|
|
ledger.close()
|
|
|
|
workbook = load_workbook(destination)
|
|
sheet = workbook["Verarbeitung"]
|
|
assert sheet["C2"].value == "scan.pdf"
|
|
assert sheet["D2"].value == "260718_RE_Firma-priv.pdf"
|
|
assert sheet["N2"].value == "qwen3.5:4B"
|
|
assert "Rechnungsdatum" in sheet["Q2"].value
|