Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
tests: contenu de l'e-mail de modération des structures
Browse files Browse the repository at this point in the history
  • Loading branch information
ikarius committed Oct 18, 2024
1 parent b88aa33 commit 74ae30d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dora/users/tests/test_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from django.templatetags.l10n import localize
from django.utils import timezone

from dora.core.models import ModerationStatus
from dora.core.test_utils import make_structure, make_user
from dora.users.emails import (
send_account_deletion_notification,
send_invitation_reminder,
send_structure_awaiting_moderation,
send_user_without_structure_notification,
)

Expand Down Expand Up @@ -71,3 +73,23 @@ def test_send_user_without_structure_notification(deletion, subject):
assert "MailsTransactionnels" in mail.outbox[0].body
assert "InscritSansStructure" in mail.outbox[0].body
assert "Nous avons accès à vos données à caractère personnel" in mail.outbox[0].body


@pytest.mark.parametrize(
"moderation_status",
(ModerationStatus.NEED_NEW_MODERATION, ModerationStatus.NEED_INITIAL_MODERATION),
)
def test_send_structure_awaiting_moderation(moderation_status):
manager = make_user(is_manager=True, departments=["37"])
structure = make_structure(department="37", moderation_status=moderation_status)

send_structure_awaiting_moderation(manager)

assert len(mail.outbox) == 1
assert mail.outbox[0].to == [manager.email]
assert (
mail.outbox[0].subject
== "DORA - Vous avez des structures à modérer cette semaine"
)
assert structure.name in mail.outbox[0].body
assert "/admin/structures" in mail.outbox[0].body

0 comments on commit 74ae30d

Please sign in to comment.