API - use Babel to translate emails
This commit is contained in:
@ -2,7 +2,8 @@
|
||||
|
||||
expected_en_text_body = """Hi test,
|
||||
|
||||
You have created an account on FitTrackee. Use the link below to confirm your address email.
|
||||
You have created an account on FitTrackee.
|
||||
Use the link below to confirm your address email.
|
||||
|
||||
Verify your email: http://localhost/account-confirmation?token=xxx
|
||||
|
||||
@ -18,7 +19,7 @@ expected_fr_text_body = """Bonjour test,
|
||||
Vous avez créé un compte sur FitTrackee.
|
||||
Cliquez sur le lien ci-dessous pour confirmer votre adresse email.
|
||||
|
||||
Vérifier l'adresse email : http://localhost/account-confirmation?token=xxx
|
||||
Vérifier l'adresse email: http://localhost/account-confirmation?token=xxx
|
||||
|
||||
Pour vérification, cette demande a été reçue à partir d'un appareil sous Linux, utilisant le navigateur Firefox.
|
||||
Si vous n'êtes pas à l'origine de la création de ce compte, vous pouvez ignorer cet e-mail.
|
||||
@ -70,7 +71,7 @@ expected_en_html_body = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">If you’re having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">If you're having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">http://localhost/account-confirmation?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -119,9 +120,7 @@ expected_fr_html_body = """ <body>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez créé un compte sur FitTrackee.
|
||||
Cliquez sur le lien ci-dessous pour confirmer votre adresse email.
|
||||
</p>
|
||||
<p>Vous avez créé un compte sur FitTrackee. Cliquez sur le bouton pour confirmer votre adresse email.</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
@ -144,7 +143,7 @@ expected_fr_html_body = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur</p>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur.</p>
|
||||
<p class="f-fallback sub">http://localhost/account-confirmation?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -42,7 +42,7 @@ expected_en_html_body = """ <body>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Hi test,</h1>
|
||||
<p>You recently requested to change your email address for your FitTrackee account to: </p>
|
||||
<p>You recently requested to change your email address for your FitTrackee account to:</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
@ -61,9 +61,8 @@ expected_en_html_body = """ <body>
|
||||
If this email change wasn't initiated by you, please change your password immediately or contact your administrator if your account is locked.
|
||||
</p>
|
||||
<p>Thanks,
|
||||
<br>
|
||||
The FitTrackee Team
|
||||
</p>
|
||||
<br>The FitTrackee Team</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -127,9 +126,8 @@ expected_fr_html_body = """ <body>
|
||||
Si vous n'êtes pas à l'origine de cette modification, veuillez changer votre mot de passe immédiatement ou contacter l'administrateur si votre compte est bloqué.
|
||||
</p>
|
||||
<p>Merci,
|
||||
<br>
|
||||
L'équipe FitTrackee
|
||||
</p>
|
||||
<br>L'équipe FitTrackee</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
expected_en_text_body = """Hi test,
|
||||
|
||||
You recently requested to change your email address for your FitTrackee account. Use the link below to confirm this address.
|
||||
You recently requested to change your email address for your FitTrackee account.
|
||||
Use the link below to confirm this address.
|
||||
|
||||
Verify your email: http://localhost/email-update?token=xxx
|
||||
|
||||
@ -15,7 +16,8 @@ http://localhost"""
|
||||
|
||||
expected_en_text_body_without_security = """Hi test,
|
||||
|
||||
You recently requested to change your email address for your FitTrackee account. Use the link below to confirm this address.
|
||||
You recently requested to change your email address for your FitTrackee account.
|
||||
Use the link below to confirm this address.
|
||||
|
||||
Verify your email: http://localhost/email-update?token=xxx
|
||||
|
||||
@ -30,7 +32,7 @@ expected_fr_text_body = """Bonjour test,
|
||||
Vous avez récemment demandé la modification de l'adresse email associée à votre compte sur FitTrackee.
|
||||
Cliquez sur le lien ci-dessous pour confirmer cette adresse email.
|
||||
|
||||
Vérifier l'adresse email : http://localhost/email-update?token=xxx
|
||||
Vérifier l'adresse email: http://localhost/email-update?token=xxx
|
||||
|
||||
Pour vérification, cette demande a été reçue à partir d'un appareil sous Linux, utilisant le navigateur Firefox.
|
||||
Si vous n'êtes pas à l'origine de cette modification, vous pouvez ignorer cet e-mail.
|
||||
@ -44,7 +46,7 @@ expected_fr_text_body_without_security = """Bonjour test,
|
||||
Vous avez récemment demandé la modification de l'adresse email associée à votre compte sur FitTrackee.
|
||||
Cliquez sur le lien ci-dessous pour confirmer cette adresse email.
|
||||
|
||||
Vérifier l'adresse email : http://localhost/email-update?token=xxx
|
||||
Vérifier l'adresse email: http://localhost/email-update?token=xxx
|
||||
|
||||
Si vous n'êtes pas à l'origine de cette modification, vous pouvez ignorer cet e-mail.
|
||||
|
||||
@ -95,7 +97,7 @@ expected_en_html_body = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">If you’re having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">If you're having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">http://localhost/email-update?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -166,7 +168,7 @@ expected_en_html_body_without_security = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">If you’re having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">If you're having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">http://localhost/email-update?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -196,7 +198,7 @@ expected_en_html_body_without_security = """ <body>
|
||||
</html>"""
|
||||
|
||||
expected_fr_html_body = """ <body>
|
||||
<span class="preheader">Utiliser ce lien pour confirmer cette adresse email.</span>
|
||||
<span class="preheader">Confirmer le changement d'adresse email.</span>
|
||||
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
@ -215,9 +217,7 @@ expected_fr_html_body = """ <body>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez récemment demandé la modification de l'adresse email associée à votre compte sur FitTrackee.
|
||||
Cliquez sur le bouton ci-dessous pour confirmer cette adresse email.
|
||||
</p>
|
||||
<p>Vous avez récemment demandé la modification de l'adresse email associée à votre compte sur FitTrackee. Cliquez sur le bouton ci-dessous pour confirmer cette adresse email.</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
@ -240,7 +240,7 @@ expected_fr_html_body = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur</p>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur.</p>
|
||||
<p class="f-fallback sub">http://localhost/email-update?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -270,7 +270,7 @@ expected_fr_html_body = """ <body>
|
||||
</html>"""
|
||||
|
||||
expected_fr_html_body_without_security = """ <body>
|
||||
<span class="preheader">Utiliser ce lien pour confirmer cette adresse email.</span>
|
||||
<span class="preheader">Confirmer le changement d'adresse email.</span>
|
||||
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
@ -289,9 +289,7 @@ expected_fr_html_body_without_security = """ <body>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez récemment demandé la modification de l'adresse email associée à votre compte sur FitTrackee.
|
||||
Cliquez sur le bouton ci-dessous pour confirmer cette adresse email.
|
||||
</p>
|
||||
<p>Vous avez récemment demandé la modification de l'adresse email associée à votre compte sur FitTrackee. Cliquez sur le bouton ci-dessous pour confirmer cette adresse email.</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
@ -313,7 +311,7 @@ expected_fr_html_body_without_security = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur</p>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur.</p>
|
||||
<p class="f-fallback sub">http://localhost/email-update?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -68,9 +68,8 @@ expected_en_html_body = """ <body>
|
||||
If this password change wasn't initiated by you, please change your password immediately or contact your administrator if your account is locked.
|
||||
</p>
|
||||
<p>Thanks,
|
||||
<br>
|
||||
The FitTrackee Team
|
||||
</p>
|
||||
<br>The FitTrackee Team</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -120,9 +119,8 @@ expected_en_html_body_without_security = """ <body>
|
||||
If this password change wasn't initiated by you, please change your password immediately or contact your administrator if your account is locked.
|
||||
</p>
|
||||
<p>Thanks,
|
||||
<br>
|
||||
The FitTrackee Team
|
||||
</p>
|
||||
<br>The FitTrackee Team</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -173,9 +171,8 @@ expected_fr_html_body = """ <body>
|
||||
Si vous n'êtes pas à l'origine de cette modification, veuillez changer votre mot de passe immédiatement ou contacter l'administrateur si votre compte est bloqué.
|
||||
</p>
|
||||
<p>Merci,
|
||||
<br>
|
||||
L'équipe FitTrackee
|
||||
</p>
|
||||
<br>L'équipe FitTrackee</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -225,9 +222,8 @@ expected_fr_html_body_without_security = """ <body>
|
||||
Si vous n'êtes pas à l'origine de cette modification, veuillez changer votre mot de passe immédiatement ou contacter l'administrateur si votre compte est bloqué.
|
||||
</p>
|
||||
<p>Merci,
|
||||
<br>
|
||||
L'équipe FitTrackee
|
||||
</p>
|
||||
<br>L'équipe FitTrackee</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
expected_en_text_body = """Hi test,
|
||||
|
||||
You recently requested to reset your password for your FitTrackee account. Use the link below to reset it. This password reset link is only valid for 3 seconds.
|
||||
You recently requested to reset your password for your FitTrackee account. Use the link below to reset it.
|
||||
This password reset link is only valid for 3 seconds.
|
||||
|
||||
Reset your password: http://localhost/password-reset?token=xxx
|
||||
|
||||
@ -15,7 +16,8 @@ http://localhost"""
|
||||
|
||||
expected_en_text_body_without_security = """Hi test,
|
||||
|
||||
You recently requested to reset your password for your FitTrackee account. Use the link below to reset it. This password reset link is only valid for 3 seconds.
|
||||
You recently requested to reset your password for your FitTrackee account. Use the link below to reset it.
|
||||
This password reset link is only valid for 3 seconds.
|
||||
|
||||
Reset your password: http://localhost/password-reset?token=xxx
|
||||
|
||||
@ -27,10 +29,10 @@ http://localhost"""
|
||||
|
||||
expected_fr_text_body = """Bonjour test,
|
||||
|
||||
Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee.
|
||||
Cliquez sur le lien ci-dessous pour le réinitialiser. Ce lien n'est valide que pendant 3 secondes.
|
||||
Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee. Cliquez sur le lien ci-dessous pour le réinitialiser.
|
||||
Ce lien n'est valide que pendant 3 secondes.
|
||||
|
||||
Réinitialiser le mot de passe : http://localhost/password-reset?token=xxx
|
||||
Réinitialiser le mot de passe: http://localhost/password-reset?token=xxx
|
||||
|
||||
Pour vérification, cette demande a été reçue à partir d'un appareil sous Linux, utilisant le navigateur Firefox.
|
||||
Si vous n'avez pas demandé de réinitialisation, vous pouvez ignorer cet e-mail.
|
||||
@ -41,10 +43,10 @@ http://localhost"""
|
||||
|
||||
expected_fr_text_body_without_security = """Bonjour test,
|
||||
|
||||
Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee.
|
||||
Cliquez sur le lien ci-dessous pour le réinitialiser. Ce lien n'est valide que pendant 3 secondes.
|
||||
Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee. Cliquez sur le lien ci-dessous pour le réinitialiser.
|
||||
Ce lien n'est valide que pendant 3 secondes.
|
||||
|
||||
Réinitialiser le mot de passe : http://localhost/password-reset?token=xxx
|
||||
Réinitialiser le mot de passe: http://localhost/password-reset?token=xxx
|
||||
|
||||
Si vous n'avez pas demandé de réinitialisation, vous pouvez ignorer cet e-mail.
|
||||
|
||||
@ -72,7 +74,7 @@ expected_en_html_body = """ <body>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Hi test,</h1>
|
||||
<p>You recently requested to reset your password for your account. Use the button below to reset it.
|
||||
<p>You recently requested to reset your password for your FitTrackee account. Use the button below to reset it.
|
||||
<strong>This password reset link is only valid for 3 seconds.</strong>
|
||||
</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
@ -97,7 +99,7 @@ expected_en_html_body = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">If you’re having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">If you're having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">http://localhost/password-reset?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -146,7 +148,7 @@ expected_en_html_body_without_security = """ <body>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Hi test,</h1>
|
||||
<p>You recently requested to reset your password for your account. Use the button below to reset it.
|
||||
<p>You recently requested to reset your password for your FitTrackee account. Use the button below to reset it.
|
||||
<strong>This password reset link is only valid for 3 seconds.</strong>
|
||||
</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
@ -170,7 +172,7 @@ expected_en_html_body_without_security = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">If you’re having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">If you're having trouble with the button above, copy and paste the URL below into your web browser.</p>
|
||||
<p class="f-fallback sub">http://localhost/password-reset?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -218,10 +220,9 @@ expected_fr_html_body = """ <body>
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee.
|
||||
Cliquez sur le bouton ci-dessous pour le réinitialiser.
|
||||
<strong>Cette réinitialisation n'est valide que pendant 3 secondes.</strong>
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee. Cliquez sur le bouton pour le réinitialiser.
|
||||
<strong>Ce lien n'est valide que pendant 3 secondes.</strong>
|
||||
</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
@ -245,7 +246,7 @@ expected_fr_html_body = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur</p>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur.</p>
|
||||
<p class="f-fallback sub">http://localhost/password-reset?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -294,10 +295,9 @@ expected_fr_html_body_without_security = """ <body>
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
<div class="f-fallback">
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee.
|
||||
Cliquez sur le bouton ci-dessous pour le réinitialiser.
|
||||
<strong>Cette réinitialisation n'est valide que pendant 3 secondes.</strong>
|
||||
<h1>Bonjour test,</h1>
|
||||
<p>Vous avez récemment demandé la réinitialisation du mot de passe de votre compte sur FitTrackee. Cliquez sur le bouton pour le réinitialiser.
|
||||
<strong>Ce lien n'est valide que pendant 3 secondes.</strong>
|
||||
</p>
|
||||
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
@ -320,7 +320,7 @@ expected_fr_html_body_without_security = """ <body>
|
||||
<table class="body-sub" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur</p>
|
||||
<p class="f-fallback sub">Si vous avez des problèmes avec le bouton, vous pouvez copier et coller le lien suivant dans votre navigateur.</p>
|
||||
<p class="f-fallback sub">http://localhost/password-reset?token=xxx</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -32,7 +32,11 @@ class TestEmailTemplateForAccountConfirmation:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'account_confirmation', lang, 'subject.txt', {}
|
||||
@ -50,7 +54,11 @@ class TestEmailTemplateForAccountConfirmation:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'account_confirmation', lang, 'body.txt', self.EMAIL_DATA
|
||||
@ -59,7 +67,11 @@ class TestEmailTemplateForAccountConfirmation:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'account_confirmation', 'en', 'body.html', self.EMAIL_DATA
|
||||
@ -68,7 +80,11 @@ class TestEmailTemplateForAccountConfirmation:
|
||||
assert expected_en_html_body in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'account_confirmation', 'fr', 'body.html', self.EMAIL_DATA
|
||||
|
@ -47,7 +47,11 @@ class TestEmailTemplateForEmailUpdateToCurrentEmail:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'email_update_to_current_email', lang, 'subject.txt', {}
|
||||
@ -65,7 +69,11 @@ class TestEmailTemplateForEmailUpdateToCurrentEmail:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_current_email', lang, 'body.txt', self.EMAIL_DATA
|
||||
@ -74,7 +82,11 @@ class TestEmailTemplateForEmailUpdateToCurrentEmail:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_current_email', 'en', 'body.html', self.EMAIL_DATA
|
||||
@ -83,7 +95,11 @@ class TestEmailTemplateForEmailUpdateToCurrentEmail:
|
||||
assert expected_en_current_email_html_body in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_current_email', 'fr', 'body.html', self.EMAIL_DATA
|
||||
@ -111,7 +127,11 @@ class TestEmailTemplateForEmailUpdateToNewEmail:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'email_update_to_new_email', lang, 'subject.txt', {}
|
||||
@ -129,7 +149,11 @@ class TestEmailTemplateForEmailUpdateToNewEmail:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_new_email', lang, 'body.txt', self.EMAIL_DATA
|
||||
@ -138,7 +162,11 @@ class TestEmailTemplateForEmailUpdateToNewEmail:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_new_email', 'en', 'body.html', self.EMAIL_DATA
|
||||
@ -147,7 +175,11 @@ class TestEmailTemplateForEmailUpdateToNewEmail:
|
||||
assert expected_en_new_email_html_body in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_new_email', 'fr', 'body.html', self.EMAIL_DATA
|
||||
@ -173,7 +205,11 @@ class TestEmailTemplateForEmailUpdateToNewEmailWithoutSecurityInfos:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'email_update_to_new_email', lang, 'subject.txt', {}
|
||||
@ -191,7 +227,11 @@ class TestEmailTemplateForEmailUpdateToNewEmailWithoutSecurityInfos:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_new_email', lang, 'body.txt', self.EMAIL_DATA
|
||||
@ -200,7 +240,11 @@ class TestEmailTemplateForEmailUpdateToNewEmailWithoutSecurityInfos:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_new_email', 'en', 'body.html', self.EMAIL_DATA
|
||||
@ -209,7 +253,11 @@ class TestEmailTemplateForEmailUpdateToNewEmailWithoutSecurityInfos:
|
||||
assert expected_en_new_email_html_body_without_security in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES']
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'email_update_to_new_email', 'fr', 'body.html', self.EMAIL_DATA
|
||||
|
@ -33,7 +33,11 @@ class TestEmailTemplateForPasswordChange:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'password_change', lang, 'subject.txt', {}
|
||||
@ -51,7 +55,11 @@ class TestEmailTemplateForPasswordChange:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'password_change', lang, 'body.txt', self.EMAIL_DATA
|
||||
@ -60,7 +68,11 @@ class TestEmailTemplateForPasswordChange:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'password_change', 'en', 'body.html', self.EMAIL_DATA
|
||||
@ -69,7 +81,11 @@ class TestEmailTemplateForPasswordChange:
|
||||
assert expected_en_html_body in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'password_change', 'fr', 'body.html', self.EMAIL_DATA
|
||||
@ -94,7 +110,11 @@ class TestEmailTemplateForPasswordChangeWithSecurityInfos:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'password_change', lang, 'subject.txt', {}
|
||||
@ -112,7 +132,11 @@ class TestEmailTemplateForPasswordChangeWithSecurityInfos:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'password_change', lang, 'body.txt', self.EMAIL_DATA
|
||||
@ -121,7 +145,11 @@ class TestEmailTemplateForPasswordChangeWithSecurityInfos:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'password_change', 'en', 'body.html', self.EMAIL_DATA
|
||||
@ -130,7 +158,11 @@ class TestEmailTemplateForPasswordChangeWithSecurityInfos:
|
||||
assert expected_en_html_body_without_security in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
text_body = email_template.get_content(
|
||||
'password_change', 'fr', 'body.html', self.EMAIL_DATA
|
||||
|
@ -26,7 +26,11 @@ class TestEmailTemplateForPasswordRequest:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'password_reset_request', lang, 'subject.txt', {}
|
||||
@ -41,7 +45,11 @@ class TestEmailTemplateForPasswordRequest:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
email_data = {
|
||||
'expiration_delay': '3 seconds' if lang == 'en' else '3 secondes',
|
||||
'username': 'test',
|
||||
@ -58,7 +66,11 @@ class TestEmailTemplateForPasswordRequest:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
email_data = {
|
||||
'expiration_delay': '3 seconds',
|
||||
'username': 'test',
|
||||
@ -75,7 +87,11 @@ class TestEmailTemplateForPasswordRequest:
|
||||
assert expected_en_html_body in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
email_data = {
|
||||
'expiration_delay': '3 secondes',
|
||||
'username': 'test',
|
||||
@ -103,7 +119,11 @@ class TestEmailTemplateForPasswordRequestWithoutSecurityInfos:
|
||||
def test_it_gets_subject(
|
||||
self, app: Flask, lang: str, expected_subject: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
|
||||
subject = email_template.get_content(
|
||||
'password_reset_request', lang, 'subject.txt', {}
|
||||
@ -121,7 +141,11 @@ class TestEmailTemplateForPasswordRequestWithoutSecurityInfos:
|
||||
def test_it_gets_text_body(
|
||||
self, app: Flask, lang: str, expected_text_body: str
|
||||
) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
email_data = {
|
||||
'expiration_delay': '3 seconds' if lang == 'en' else '3 secondes',
|
||||
'username': 'test',
|
||||
@ -136,7 +160,11 @@ class TestEmailTemplateForPasswordRequestWithoutSecurityInfos:
|
||||
assert text_body == expected_text_body
|
||||
|
||||
def test_it_gets_en_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
email_data = {
|
||||
'expiration_delay': '3 seconds',
|
||||
'username': 'test',
|
||||
@ -151,7 +179,11 @@ class TestEmailTemplateForPasswordRequestWithoutSecurityInfos:
|
||||
assert expected_en_html_body_without_security in text_body
|
||||
|
||||
def test_it_gets_fr_html_body(self, app: Flask) -> None:
|
||||
email_template = EmailTemplate(app.config['TEMPLATES_FOLDER'])
|
||||
email_template = EmailTemplate(
|
||||
app.config['TEMPLATES_FOLDER'],
|
||||
app.config['TRANSLATIONS_FOLDER'],
|
||||
app.config['LANGUAGES'],
|
||||
)
|
||||
email_data = {
|
||||
'expiration_delay': '3 secondes',
|
||||
'username': 'test',
|
||||
|
Reference in New Issue
Block a user