Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add sender_address field in raising error (#8455)
L3str4nge8910e23e0944
diff --git a/saleor/plugins/email_common.py b/saleor/plugins/email_common.pyindex 70c82ff38d..f21f0db401 100644--- a/saleor/plugins/email_common.py+++ b/saleor/plugins/email_common.py@@ -15,7 +15,7 @@ from babel.numbers import format_currencyfrom django.core.exceptions import ValidationErrorfrom django.core.mail import send_mailfrom django.core.mail.backends.smtp import EmailBackend-from django.core.validators import validate_email+from django.core.validators import EmailValidatorfrom django_prices.utils.locale import get_locale_datafrom ..product.product_images import get_thumbnail_size@@ -281,7 +281,13 @@ def validate_default_email_configuration(})- validate_email(config.sender_address)+ EmailValidator(+ message={+ "sender_address": ValidationError(+ "Invalid email", code=PluginErrorCode.INVALID.value+ )+ }+ )(config.sender_address)try:validate_email_config(config)diff --git a/saleor/plugins/tests/test_email_common.py b/saleor/plugins/tests/test_email_common.pyindex bde891cb5d..d6486d6a77 100644--- a/saleor/plugins/tests/test_email_common.py+++ b/saleor/plugins/tests/test_email_common.py@@ -4,6 +4,7 @@ import pytestfrom django.core.exceptions import ValidationErrorfrom saleor.plugins.email_common import validate_default_email_configuration+from saleor.plugins.error_codes import PluginErrorCode@pytest.mark.parametrize(@@ -20,9 +21,12 @@ def test_validate_default_email_configuration_bad_email():email_configuration["sender_address"] = email- with pytest.raises(ValidationError):+ with pytest.raises(ValidationError) as e:validate_default_email_configuration(plugin_configuration, email_configuration)+ assert "sender_address" in e.value.args[0]+ assert e.value.args[0]["sender_address"].code == PluginErrorCode.INVALID.value+@patch("saleor.plugins.email_common.validate_email_config")def test_validate_default_email_configuration_correct_email(