Skip to content

Commit

Permalink
Merge pull request #33716 from dimagi/jt/custom-gateway-host-setting-…
Browse files Browse the repository at this point in the history
…validation

Custom Gateway Form Validation for "Host"
  • Loading branch information
Jtang-1 authored Nov 9, 2023
2 parents e335dcf + 016cc11 commit 79eda90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions corehq/apps/email/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 0 additions & 13 deletions corehq/apps/email/tests/test_email_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 79eda90

Please sign in to comment.