Merge branch 'dev' into feature/read-only-store

dev gained the editable mail templates, which live in the store like everything
else -- so they follow the same read-only rules: the options dialog skips saving
them, save_mail_template() reports the store instead of a raw PermissionError,
and a store that cannot keep its own copy simply renders from the shipped
default.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Marcel Peterkau
2026-08-28 21:26:40 +02:00
co-authored by Claude Opus 5
24 changed files with 2276 additions and 168 deletions
+17
View File
@@ -169,3 +169,20 @@ def test_startup_sequence_completes_without_the_housekeeper(read_only_store):
assert [item.member_id for item in members] == [member.member_id]
assert findings == []
assert repository.member_count() == 1
def test_mail_templates_fall_back_to_the_shipped_defaults(read_only_store):
"""A store that predates mail templates has no templates/mail/ directory, and a
read-only one cannot get it -- the shipped default has to carry the session."""
from ccma.domain.mail_templates import default_mail_template
repository, _member = read_only_store
_set_writable(repository.root, True)
for path in repository.mail_templates_root.glob("*.txt"):
path.unlink()
_set_writable(repository.root, False)
assert repository.get_mail_template("welcome") == default_mail_template("welcome")
assert not list(repository.mail_templates_root.glob("*.txt")), "nothing was written"
with pytest.raises(ReadOnlyStoreError, match="schreibgeschützt"):
repository.save_mail_template("welcome", subject="Moin", body="Kurz.")