mirror of
https://git.hiabuto.net/C3MA/CCMA.git
synced 2026-09-06 03:20:49 +02:00
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:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user