Package runtime migrations and branding assets

This commit is contained in:
rob
2026-08-30 07:21:37 +01:00
parent 97a75d0243
commit af4aa713b9
51 changed files with 72 additions and 29 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
from datetime import date
from pathlib import Path
from roborto_accounting.config import default_logo_path
import pytest
@@ -16,7 +16,7 @@ def test_letter_render_is_deterministic_and_finalization_is_stable(tmp_path):
engine=make_engine("sqlite://");Base.metadata.create_all(engine);session=make_session_factory(engine)()
settings=BusinessSettings(trading_name="roborto",business_descriptor="Software Development",general_email="hello@roborto.net")
letter=create_letter(session,letter_date=date(2026,8,29),recipient_name="Client",recipient_address="Address\nDublin",recipient_email="client@example.invalid",reference="REF-1",subject="Project follow-up",body_text="Hello,\n\n"+("A long representative paragraph for wrapping and pagination. "*180))
theme=DocumentTheme(Path("assets/branding/logo-light.svg"));first=render_letter_pdf(tmp_path/"first.pdf",letter=letter,settings=settings,theme=theme);second=render_letter_pdf(tmp_path/"second.pdf",letter=letter,settings=settings,theme=theme)
theme=DocumentTheme(default_logo_path());first=render_letter_pdf(tmp_path/"first.pdf",letter=letter,settings=settings,theme=theme);second=render_letter_pdf(tmp_path/"second.pdf",letter=letter,settings=settings,theme=theme)
assert first.read_bytes()==second.read_bytes() and first.stat().st_size>2000
attachment=finalize_letter(session,letter=letter,settings=settings,archive_root=tmp_path/"archive",theme=theme)
assert letter.status=="FINALIZED" and (tmp_path/"archive"/attachment.stored_relative_path).is_file()