mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-29 22:16:33 +02:00
Add email validation by using EmailField in Contact
This commit is contained in:
parent
b5706c3829
commit
4623a5dfb2
3 changed files with 38 additions and 1 deletions
|
@ -15,6 +15,7 @@ from registrar.forms.application_wizard import (
|
|||
AnythingElseForm,
|
||||
TypeOfWorkForm,
|
||||
)
|
||||
from registrar.forms.domain import ContactForm
|
||||
|
||||
|
||||
class TestFormValidation(TestCase):
|
||||
|
@ -277,3 +278,20 @@ class TestFormValidation(TestCase):
|
|||
for error in form.non_field_errors()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class TestContactForm(TestCase):
|
||||
|
||||
def test_contact_form_email_invalid(self):
|
||||
form = ContactForm(data={"email": "example.net"})
|
||||
self.assertEqual(
|
||||
form.errors["email"],
|
||||
["Enter a valid email address."]
|
||||
)
|
||||
|
||||
def test_contact_form_email_invalid2(self):
|
||||
form = ContactForm(data={"email": "@"})
|
||||
self.assertEqual(
|
||||
form.errors["email"],
|
||||
["Enter a valid email address."]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue