move the test email address to an environment variable
This commit is contained in:
parent
ca69b7ea22
commit
275eeb4111
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@ -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 <<EOF
|
||||
DATABASE_URL="port=5432 dbname=liberapay_tests"
|
||||
# As of March 2025, GitHub Actions runners still don't have IPv6,
|
||||
# so we override the default IPv6-only test email address here.
|
||||
TEST_EMAIL_ADDRESS=test@changaco.net
|
||||
EOF
|
||||
- name: Run the tests
|
||||
run: tox
|
||||
- name: Upload coverage reports to Codecov
|
||||
|
@ -52,3 +52,4 @@ INSTANCE_TYPE=development
|
||||
SECRET_FERNET_KEYS="2019-01-19 This_is_a_fake_key_of_32_bytes_in_Base64URL="
|
||||
|
||||
HOSTNAME=
|
||||
TEST_EMAIL_ADDRESS=test@ipv6.changaco.net
|
||||
|
@ -167,7 +167,7 @@ def check_email_address(email: NormalizedEmailAddress) -> 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
|
||||
|
@ -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,
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user