From c217fc6f97bb5c4361aa6a5c9e149927b4a6ac75 Mon Sep 17 00:00:00 2001 From: Jonathan Tang Date: Mon, 6 Nov 2023 17:49:46 -0800 Subject: [PATCH 1/2] bug: smtp server address is not a url --- corehq/apps/email/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/corehq/apps/email/forms.py b/corehq/apps/email/forms.py index ddc3bf8ae4b3..21f8f4a1eed2 100644 --- a/corehq/apps/email/forms.py +++ b/corehq/apps/email/forms.py @@ -18,10 +18,10 @@ class EmailSMTPSettingsForm(forms.ModelForm): widget=forms.PasswordInput(render_value=True), ) - server = forms.URLField( + server = forms.CharField( label=_('Server'), required=True, - help_text=_('e.g. "https://smtp.example.com"'), + help_text=_('e.g. "smtp.example.com"'), ) port = forms.IntegerField( From 016cc1194cb4cc95acda205a7cada9e2481444b1 Mon Sep 17 00:00:00 2001 From: Jonathan Tang Date: Wed, 8 Nov 2023 10:16:57 -0800 Subject: [PATCH 2/2] test: removes irrelevant server name validation test --- corehq/apps/email/tests/test_email_form.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/corehq/apps/email/tests/test_email_form.py b/corehq/apps/email/tests/test_email_form.py index 1bf41f20ace1..3ddf1fd433cf 100644 --- a/corehq/apps/email/tests/test_email_form.py +++ b/corehq/apps/email/tests/test_email_form.py @@ -55,19 +55,6 @@ def test_clean_from_email(self): self.assertFalse(form.is_valid()) self.assertIn('from_email', form.errors) - def test_clean_server(self): - form_data = EmailSMTPSettingsFormTests._get_valid_form_data() - - # Valid server format - form = EmailSMTPSettingsForm(data=form_data) - self.assertTrue(form.is_valid()) - - # Invalid server format - form_data.update({'server': 'server'}) - form = EmailSMTPSettingsForm(data=form_data) - self.assertFalse(form.is_valid()) - self.assertIn('server', form.errors) - @staticmethod def _get_valid_form_data(): return {