From b902c13e36829fe4f03062ba59063202f46bef0b Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <theskumar@users.noreply.github.com> Date: Fri, 22 Jul 2022 11:58:01 +0530 Subject: [PATCH] Use wagtail 3.0.1 and use robust testing for the activation email --- hypha/apply/users/tests/test_utils.py | 13 +++++++++---- requirements.txt | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hypha/apply/users/tests/test_utils.py b/hypha/apply/users/tests/test_utils.py index 6c8533720..f84a4db15 100644 --- a/hypha/apply/users/tests/test_utils.py +++ b/hypha/apply/users/tests/test_utils.py @@ -1,6 +1,6 @@ from django.core import mail +from test.support import EnvironmentVarGuard from django.test import TestCase, override_settings -from django.conf import settings from hypha.apply.users.tests.factories import UserFactory @@ -9,7 +9,12 @@ from ..utils import send_activation_email @override_settings(ROOT_URLCONF='hypha.apply.urls') class TestActivationEmail(TestCase): + def setUp(self) -> None: + self.env = EnvironmentVarGuard() + self.env.set('PRIMARY_HOST', 'primary-domain.org') + def test_activation_email_includes_link(self): - send_activation_email(UserFactory()) - self.assertEqual(len(mail.outbox), 1) - self.assertContains(mail.outbox[0], settings.WAGTAILADMIN_BASE_URL) + with self.env: + send_activation_email(UserFactory()) + assert len(mail.outbox) == 1 + assert "password reset form at https://primary-domain.org" in mail.outbox[0] diff --git a/requirements.txt b/requirements.txt index 0231604ad..2482a2d28 100644 --- a/requirements.txt +++ b/requirements.txt @@ -48,6 +48,6 @@ social_auth_app_django==5.0.0 tomd==0.1.3 wagtail-cache==1.0.2 wagtail-purge==0.1 -wagtail==3.0.0 +wagtail==3.0.1 whitenoise==5.3.0 xmltodict==0.12.0 -- GitLab