mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-12 20:49:41 +02:00
linter fixes
This commit is contained in:
parent
48d025019f
commit
44da71b007
4 changed files with 32 additions and 38 deletions
|
@ -616,7 +616,8 @@ class PurposeDetailsForm(BaseDeletableRegistrarForm):
|
||||||
label="Purpose",
|
label="Purpose",
|
||||||
widget=forms.Textarea(
|
widget=forms.Textarea(
|
||||||
attrs={
|
attrs={
|
||||||
"aria-label": "What is the purpose of your requested domain? Describe how you’ll use your .gov domain. \
|
"aria-label": "What is the purpose of your requested domain? \
|
||||||
|
Describe how you’ll use your .gov domain. \
|
||||||
Will it be used for a website, email, or something else?"
|
Will it be used for a website, email, or something else?"
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
@ -873,28 +874,6 @@ class CisaRepresentativeYesNoForm(BaseYesNoForm):
|
||||||
field_name = "has_cisa_representative"
|
field_name = "has_cisa_representative"
|
||||||
|
|
||||||
|
|
||||||
class PurposeDetailsForm(BaseDeletableRegistrarForm):
|
|
||||||
|
|
||||||
field_name = "purpose"
|
|
||||||
|
|
||||||
purpose = forms.CharField(
|
|
||||||
label="Purpose",
|
|
||||||
widget=forms.Textarea(
|
|
||||||
attrs={
|
|
||||||
"aria-label": "What is the purpose of your requested domain? Describe how you’ll use your .gov domain. \
|
|
||||||
Will it be used for a website, email, or something else?"
|
|
||||||
}
|
|
||||||
),
|
|
||||||
validators=[
|
|
||||||
MaxLengthValidator(
|
|
||||||
2000,
|
|
||||||
message="Response must be less than 2000 characters.",
|
|
||||||
)
|
|
||||||
],
|
|
||||||
error_messages={"required": "Describe how you’ll use the .gov domain you’re requesting."},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class AnythingElseForm(BaseDeletableRegistrarForm):
|
class AnythingElseForm(BaseDeletableRegistrarForm):
|
||||||
anything_else = forms.CharField(
|
anything_else = forms.CharField(
|
||||||
required=True,
|
required=True,
|
||||||
|
|
|
@ -3,6 +3,7 @@ from django.core.validators import MaxLengthValidator
|
||||||
from registrar.forms.utility.wizard_form_helper import BaseDeletableRegistrarForm, BaseYesNoForm
|
from registrar.forms.utility.wizard_form_helper import BaseDeletableRegistrarForm, BaseYesNoForm
|
||||||
from registrar.models.contact import Contact
|
from registrar.models.contact import Contact
|
||||||
|
|
||||||
|
|
||||||
class ExecutiveNamingRequirementsYesNoForm(BaseYesNoForm, BaseDeletableRegistrarForm):
|
class ExecutiveNamingRequirementsYesNoForm(BaseYesNoForm, BaseDeletableRegistrarForm):
|
||||||
"""
|
"""
|
||||||
Form for verifying if the domain request meets the Federal Executive Branch domain naming requirements.
|
Form for verifying if the domain request meets the Federal Executive Branch domain naming requirements.
|
||||||
|
@ -206,4 +207,4 @@ class FEBAnythingElseYesNoForm(BaseYesNoForm, BaseDeletableRegistrarForm):
|
||||||
"""Yes/no toggle for the anything else question on additional details"""
|
"""Yes/no toggle for the anything else question on additional details"""
|
||||||
|
|
||||||
form_is_checked = property(lambda self: self.domain_request.has_anything_else_text) # type: ignore
|
form_is_checked = property(lambda self: self.domain_request.has_anything_else_text) # type: ignore
|
||||||
field_name = "has_anything_else_text"
|
field_name = "has_anything_else_text"
|
||||||
|
|
|
@ -2718,12 +2718,20 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
|
|
||||||
def feb_requirements_page_tests(self, requirements_page):
|
def feb_requirements_page_tests(self, requirements_page):
|
||||||
# Check for the 21st Century IDEA Act links
|
# Check for the 21st Century IDEA Act links
|
||||||
self.assertContains(requirements_page, "https://digital.gov/resources/delivering-digital-first-public-experience-act/")
|
self.assertContains(
|
||||||
self.assertContains(requirements_page, "https://bidenwhitehouse.gov/wp-content/uploads/2023/09/M-23-22-Delivering-a-Digital-First-Public-Experience.pdf")
|
requirements_page, "https://digital.gov/resources/delivering-digital-first-public-experience-act/"
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
requirements_page,
|
||||||
|
"https://bidenwhitehouse.gov/wp-content/uploads/2023/09/M-23-22-Delivering-a-Digital-First-Public-Experience.pdf", # noqa
|
||||||
|
)
|
||||||
|
|
||||||
# Check for the policy acknowledgement form
|
# Check for the policy acknowledgement form
|
||||||
self.assertContains(requirements_page, "is_policy_acknowledged")
|
self.assertContains(requirements_page, "is_policy_acknowledged")
|
||||||
self.assertContains(requirements_page, "I read and understand the guidance outlined in the DOTGOV Act for operating a .gov domain.")
|
self.assertContains(
|
||||||
|
requirements_page,
|
||||||
|
"I read and understand the guidance outlined in the DOTGOV Act for operating a .gov domain.",
|
||||||
|
)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_domain_request_formsets(self):
|
def test_domain_request_formsets(self):
|
||||||
|
|
|
@ -631,21 +631,23 @@ class PortfolioAdditionalDetails(DomainRequestWizard):
|
||||||
if not forms[0].is_valid():
|
if not forms[0].is_valid():
|
||||||
# If the user isn't working with EOP, don't validate the EOP contact form
|
# If the user isn't working with EOP, don't validate the EOP contact form
|
||||||
forms[1].mark_form_for_deletion()
|
forms[1].mark_form_for_deletion()
|
||||||
eop_forms_valid = False
|
eop_forms_valid = False
|
||||||
if forms[0].cleaned_data.get("working_with_eop"):
|
if forms[0].cleaned_data.get("working_with_eop"):
|
||||||
eop_forms_valid = forms[1].is_valid()
|
eop_forms_valid = forms[1].is_valid()
|
||||||
else:
|
else:
|
||||||
forms[1].mark_form_for_deletion()
|
forms[1].mark_form_for_deletion()
|
||||||
anything_else_forms_valid = True
|
anything_else_forms_valid = True
|
||||||
if not forms[2].is_valid():
|
if not forms[2].is_valid():
|
||||||
forms[3].mark_form_for_deletion()
|
forms[3].mark_form_for_deletion()
|
||||||
anything_else_forms_valid = False
|
anything_else_forms_valid = False
|
||||||
if forms[2].cleaned_data.get("has_anything_else_text"):
|
if forms[2].cleaned_data.get("has_anything_else_text"):
|
||||||
forms[3].fields["anything_else"].required = True
|
forms[3].fields["anything_else"].required = True
|
||||||
forms[3].fields["anything_else"].error_messages["required"] = "Please provide additional details you'd like us to know. \
|
forms[3].fields["anything_else"].error_messages[
|
||||||
|
"required"
|
||||||
|
] = "Please provide additional details you'd like us to know. \
|
||||||
If you have nothing to add, select 'No'."
|
If you have nothing to add, select 'No'."
|
||||||
anything_else_forms_valid = forms[3].is_valid()
|
anything_else_forms_valid = forms[3].is_valid()
|
||||||
return (eop_forms_valid and anything_else_forms_valid)
|
return eop_forms_valid and anything_else_forms_valid
|
||||||
|
|
||||||
|
|
||||||
# Non-portfolio pages
|
# Non-portfolio pages
|
||||||
|
@ -937,15 +939,19 @@ class Requirements(DomainRequestWizard):
|
||||||
# Override the get_forms method to set the policy acknowledgement label conditionally based on feb status
|
# Override the get_forms method to set the policy acknowledgement label conditionally based on feb status
|
||||||
def get_forms(self, step=None, use_post=False, use_db=False, files=None):
|
def get_forms(self, step=None, use_post=False, use_db=False, files=None):
|
||||||
forms_list = super().get_forms(step, use_post, use_db, files)
|
forms_list = super().get_forms(step, use_post, use_db, files)
|
||||||
|
|
||||||
# Pass the is_federal context to the form
|
# Pass the is_federal context to the form
|
||||||
for form in forms_list:
|
for form in forms_list:
|
||||||
if isinstance(form, forms.RequirementsForm):
|
if isinstance(form, forms.RequirementsForm):
|
||||||
if self.requires_feb_questions():
|
if self.requires_feb_questions():
|
||||||
form.fields['is_policy_acknowledged'].label = "I read and understand the guidance outlined in the DOTGOV Act for operating a .gov domain." # noqa: E501
|
form.fields["is_policy_acknowledged"].label = (
|
||||||
|
"I read and understand the guidance outlined in the DOTGOV Act for operating a .gov domain." # noqa: E501
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
form.fields['is_policy_acknowledged'].label = "I read and agree to the requirements for operating a .gov domain." # noqa: E501
|
form.fields["is_policy_acknowledged"].label = (
|
||||||
|
"I read and agree to the requirements for operating a .gov domain." # noqa: E501
|
||||||
|
)
|
||||||
|
|
||||||
return forms_list
|
return forms_list
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue