mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-09 22:14:43 +02:00
Fix linting errors
This commit is contained in:
parent
f7e0975e4c
commit
29d8f4b23d
2 changed files with 14 additions and 10 deletions
|
@ -23,8 +23,10 @@ from registrar.models import Contact, DomainApplication, Domain
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# nosec because this use of mark_safe does not introduce a cross-site scripting
|
||||||
REQUIRED_SUFFIX = mark_safe(
|
# vulnerability because there is no untrusted content inside. It is
|
||||||
|
# only being used to pass a specific HTML entity into a template.
|
||||||
|
REQUIRED_SUFFIX = mark_safe( # nosec
|
||||||
' <abbr class="usa-hint usa-hint--required" title="required">*</abbr>'
|
' <abbr class="usa-hint usa-hint--required" title="required">*</abbr>'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -176,7 +178,7 @@ class AuthorizingOfficialForm(RegistrarForm):
|
||||||
email = forms.EmailField(
|
email = forms.EmailField(
|
||||||
label="Email",
|
label="Email",
|
||||||
label_suffix=REQUIRED_SUFFIX,
|
label_suffix=REQUIRED_SUFFIX,
|
||||||
error_messages={"invalid": "Please enter a valid email address."}
|
error_messages={"invalid": "Please enter a valid email address."},
|
||||||
)
|
)
|
||||||
phone = PhoneNumberField(
|
phone = PhoneNumberField(
|
||||||
label="Phone",
|
label="Phone",
|
||||||
|
@ -306,7 +308,9 @@ class PurposeForm(RegistrarForm):
|
||||||
purpose = forms.CharField(
|
purpose = forms.CharField(
|
||||||
label="Purpose",
|
label="Purpose",
|
||||||
widget=forms.Textarea(),
|
widget=forms.Textarea(),
|
||||||
error_messages={"required": "You must enter some information about the purpose of your domain"}
|
error_messages={
|
||||||
|
"required": "Please enter some information about the purpose of your domain"
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,7 +353,7 @@ class YourContactForm(RegistrarForm):
|
||||||
email = forms.EmailField(
|
email = forms.EmailField(
|
||||||
label="Email",
|
label="Email",
|
||||||
label_suffix=REQUIRED_SUFFIX,
|
label_suffix=REQUIRED_SUFFIX,
|
||||||
error_messages={"invalid": "Please enter a valid email address."}
|
error_messages={"invalid": "Please enter a valid email address."},
|
||||||
)
|
)
|
||||||
phone = PhoneNumberField(
|
phone = PhoneNumberField(
|
||||||
label="Phone",
|
label="Phone",
|
||||||
|
@ -379,7 +383,6 @@ class OtherContactsForm(RegistrarForm):
|
||||||
if other_contacts is not None:
|
if other_contacts is not None:
|
||||||
super().from_database(other_contacts)
|
super().from_database(other_contacts)
|
||||||
|
|
||||||
|
|
||||||
first_name = forms.CharField(
|
first_name = forms.CharField(
|
||||||
label="First name/given name",
|
label="First name/given name",
|
||||||
label_suffix=REQUIRED_SUFFIX,
|
label_suffix=REQUIRED_SUFFIX,
|
||||||
|
@ -399,7 +402,7 @@ class OtherContactsForm(RegistrarForm):
|
||||||
email = forms.EmailField(
|
email = forms.EmailField(
|
||||||
label="Email",
|
label="Email",
|
||||||
label_suffix=REQUIRED_SUFFIX,
|
label_suffix=REQUIRED_SUFFIX,
|
||||||
error_messages={"invalid": "Please enter a valid email address."}
|
error_messages={"invalid": "Please enter a valid email address."},
|
||||||
)
|
)
|
||||||
phone = PhoneNumberField(
|
phone = PhoneNumberField(
|
||||||
label="Phone",
|
label="Phone",
|
||||||
|
|
|
@ -16,14 +16,15 @@ from registrar.forms.application_wizard import (
|
||||||
|
|
||||||
class TestFormValidation(TestCase):
|
class TestFormValidation(TestCase):
|
||||||
def test_org_contact_zip_invalid(self):
|
def test_org_contact_zip_invalid(self):
|
||||||
form = OrganizationContactForm (data={"zipcode": "nah"})
|
form = OrganizationContactForm(data={"zipcode": "nah"})
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
form.errors["zipcode"], ["Please enter a ZIP code in the form 12345 or 12345-6789"]
|
form.errors["zipcode"],
|
||||||
|
["Please enter a ZIP code in the form 12345 or 12345-6789"],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_org_contact_zip_valid(self):
|
def test_org_contact_zip_valid(self):
|
||||||
for zipcode in ["12345", "12345-6789"]:
|
for zipcode in ["12345", "12345-6789"]:
|
||||||
form = OrganizationContactForm (data={"zipcode": zipcode})
|
form = OrganizationContactForm(data={"zipcode": zipcode})
|
||||||
self.assertNotIn("zipcode", form.errors)
|
self.assertNotIn("zipcode", form.errors)
|
||||||
|
|
||||||
def test_current_site_invalid(self):
|
def test_current_site_invalid(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue