diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d3117330..2722e8ed7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,7 +49,13 @@ jobs: - name: Install tox run: pip install tox - name: Write liberapay environment file for tests - run: echo 'DATABASE_URL="port=5432 dbname=liberapay_tests"' >tests/local.env + run: | + cat >tests/local.env < None: if port_25_is_open is None: try: test_email_address(normalize_email_address( - 'support@liberapay.com' + website.env.test_email_address )) except BrokenEmailDomain: port_25_is_open = False diff --git a/liberapay/website.py b/liberapay/website.py index 9b16b44b8..acd9a425f 100644 --- a/liberapay/website.py +++ b/liberapay/website.py @@ -89,6 +89,7 @@ env = Environment( COMPRESS_ASSETS=is_yesish, CSP_EXTRA=str, HOSTNAME=str, + TEST_EMAIL_ADDRESS=str, SENTRY_DEBUG=is_yesish, SENTRY_DSN=str, SENTRY_RERAISE=is_yesish, diff --git a/tests/py/test_email.py b/tests/py/test_email.py index 370e42f86..faa7ec585 100644 --- a/tests/py/test_email.py +++ b/tests/py/test_email.py @@ -66,9 +66,10 @@ class TestEmail(EmailHarness): msg = json.loads(response.body)['msg'] assert msg == "A verification email has been sent to alice@example.com." with patch.object(self.website.app_conf, 'check_email_domains', True): - response = self.hit_email_spt('add-email', 'test@ipv6.changaco.net') + email = self.website.env.test_email_address + response = self.hit_email_spt('add-email', email) msg = json.loads(response.body)['msg'] - assert msg == "A verification email has been sent to test@ipv6.changaco.net." + assert msg == f"A verification email has been sent to {email}." def test_participant_can_add_email_with_unicode_domain_name(self): punycode_email = 'alice@' + 'accentué.com'.encode('idna').decode()