From 1ca41269cdeb04bd97c35c05fd6edc40112cd654 Mon Sep 17 00:00:00 2001 From: Lukas Bockstaller Date: Thu, 22 Oct 2026 12:03:57 +0200 Subject: [PATCH] test: unset EMAIL_HOST_USER and EMAIL_HOST_PASSWORD for smtp tests (#6688) Harden tests so that they don't fail locally when the config values are set in pretix.cfg --- src/tests/base/test_mail.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tests/base/test_mail.py b/src/tests/base/test_mail.py index e685fdedc..b5d03eb55 100644 --- a/src/tests/base/test_mail.py +++ b/src/tests/base/test_mail.py @@ -642,6 +642,8 @@ def assert_mail_connection(res, should_connect, use_ssl): True, False ]) def test_private_smtp_ip(res, use_ssl, settings): + settings.EMAIL_HOST_USER = '' + settings.EMAIL_HOST_PASSWORD = '' settings.EMAIL_CUSTOM_SMTP_BACKEND = 'pretix.base.email.CheckPrivateNetworkSmtpBackend' settings.MAIL_CUSTOM_SMTP_ALLOW_PRIVATE_NETWORKS = False with assert_mail_connection(res=res, should_connect=False, use_ssl=use_ssl), pytest.raises(match="Request to .* blocked"): @@ -665,6 +667,8 @@ def test_private_smtp_ip(res, use_ssl, settings): True, False ]) def test_public_smtp_ip(use_ssl, allow_private, settings): + settings.EMAIL_HOST_USER = '' + settings.EMAIL_HOST_PASSWORD = '' settings.EMAIL_CUSTOM_SMTP_BACKEND = 'pretix.base.email.CheckPrivateNetworkSmtpBackend' settings.MAIL_CUSTOM_SMTP_ALLOW_PRIVATE_NETWORKS = allow_private