mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-09 22:14:43 +02:00
Fix linting and tets
This commit is contained in:
parent
696941aba7
commit
34a2f39fdf
8 changed files with 35 additions and 73 deletions
|
@ -309,6 +309,7 @@ class OrganizationContactForm(RegistrarForm):
|
||||||
)
|
)
|
||||||
return federal_agency
|
return federal_agency
|
||||||
|
|
||||||
|
|
||||||
class AboutYourOrganizationForm(RegistrarForm):
|
class AboutYourOrganizationForm(RegistrarForm):
|
||||||
about_your_organization = forms.CharField(
|
about_your_organization = forms.CharField(
|
||||||
label="About your organization",
|
label="About your organization",
|
||||||
|
@ -319,12 +320,14 @@ class AboutYourOrganizationForm(RegistrarForm):
|
||||||
message="Response must be less than 1000 characters.",
|
message="Response must be less than 1000 characters.",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
# TODO-446: Confirm if this error message wording is ok, prev was "Enter the type of work your organization does."
|
# TODO-446: Confirm if err msg wording is ok, previously
|
||||||
|
# TODO-446: "Enter the type of work your organization does."
|
||||||
error_messages={
|
error_messages={
|
||||||
"required": ("Enter information about your organization.")
|
"required": ("Enter the information about your organization.")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AuthorizingOfficialForm(RegistrarForm):
|
class AuthorizingOfficialForm(RegistrarForm):
|
||||||
def to_database(self, obj):
|
def to_database(self, obj):
|
||||||
if not self.is_valid():
|
if not self.is_valid():
|
||||||
|
|
|
@ -433,6 +433,7 @@ def create_user():
|
||||||
password=p,
|
password=p,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def completed_application(
|
def completed_application(
|
||||||
has_other_contacts=True,
|
has_other_contacts=True,
|
||||||
has_current_website=True,
|
has_current_website=True,
|
||||||
|
|
|
@ -316,7 +316,6 @@ class TestDomainApplicationAdmin(TestCase):
|
||||||
|
|
||||||
readonly_fields = self.admin.get_readonly_fields(request, application)
|
readonly_fields = self.admin.get_readonly_fields(request, application)
|
||||||
|
|
||||||
# TODO-446: Add about_your_organization + remove type_of_work and more_organization_information
|
|
||||||
expected_fields = [
|
expected_fields = [
|
||||||
"id",
|
"id",
|
||||||
"created_at",
|
"created_at",
|
||||||
|
@ -338,8 +337,7 @@ class TestDomainApplicationAdmin(TestCase):
|
||||||
"state_territory",
|
"state_territory",
|
||||||
"zipcode",
|
"zipcode",
|
||||||
"urbanization",
|
"urbanization",
|
||||||
"type_of_work",
|
"about_your_organization",
|
||||||
"more_organization_information",
|
|
||||||
"authorizing_official",
|
"authorizing_official",
|
||||||
"approved_domain",
|
"approved_domain",
|
||||||
"requested_domain",
|
"requested_domain",
|
||||||
|
@ -361,11 +359,9 @@ class TestDomainApplicationAdmin(TestCase):
|
||||||
|
|
||||||
readonly_fields = self.admin.get_readonly_fields(request)
|
readonly_fields = self.admin.get_readonly_fields(request)
|
||||||
|
|
||||||
# TODO-446: Add about_your_organization + remove type_of_work and more_organization_information
|
|
||||||
expected_fields = [
|
expected_fields = [
|
||||||
"creator",
|
"creator",
|
||||||
"type_of_work",
|
"about_your_organization",
|
||||||
"more_organization_information",
|
|
||||||
"address_line1",
|
"address_line1",
|
||||||
"address_line2",
|
"address_line2",
|
||||||
"zipcode",
|
"zipcode",
|
||||||
|
|
|
@ -125,29 +125,27 @@ class TestEmails(TestCase):
|
||||||
# spacing should be right between adjacent elements
|
# spacing should be right between adjacent elements
|
||||||
self.assertRegex(body, r"city.gov\n\nPurpose of your domain:")
|
self.assertRegex(body, r"city.gov\n\nPurpose of your domain:")
|
||||||
|
|
||||||
# TODO-446: Update type_of_work -> about_your_organization
|
|
||||||
@boto3_mocking.patching
|
@boto3_mocking.patching
|
||||||
def test_submission_confirmation_type_of_work_spacing(self):
|
def test_submission_confirmation_about_your_organization_spacing(self):
|
||||||
"""Test line spacing with type of work."""
|
"""Test line spacing with about your organization."""
|
||||||
application = completed_application(has_type_of_work=True)
|
application = completed_application(has_about_your_organization=True)
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class):
|
||||||
application.submit()
|
application.submit()
|
||||||
_, kwargs = self.mock_client.send_email.call_args
|
_, kwargs = self.mock_client.send_email.call_args
|
||||||
body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
|
body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
|
||||||
self.assertIn("Type of work:", body)
|
self.assertIn("About your organization:", body)
|
||||||
# spacing should be right between adjacent elements
|
# spacing should be right between adjacent elements
|
||||||
self.assertRegex(body, r"10002\n\nType of work:")
|
self.assertRegex(body, r"10002\n\nAbout your organization:")
|
||||||
|
|
||||||
# TODO-446: Update type_of_work -> about_your_organization
|
|
||||||
@boto3_mocking.patching
|
@boto3_mocking.patching
|
||||||
def test_submission_confirmation_no_type_of_work_spacing(self):
|
def test_submission_confirmation_no_about_your_organization_spacing(self):
|
||||||
"""Test line spacing without type of work."""
|
"""Test line spacing without type of work."""
|
||||||
application = completed_application(has_type_of_work=False)
|
application = completed_application(has_about_your_organization=False)
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class):
|
||||||
application.submit()
|
application.submit()
|
||||||
_, kwargs = self.mock_client.send_email.call_args
|
_, kwargs = self.mock_client.send_email.call_args
|
||||||
body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
|
body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"]
|
||||||
self.assertNotIn("Type of work:", body)
|
self.assertNotIn("About your organization:", body)
|
||||||
# spacing should be right between adjacent elements
|
# spacing should be right between adjacent elements
|
||||||
self.assertRegex(body, r"10002\n\nAuthorizing official:")
|
self.assertRegex(body, r"10002\n\nAuthorizing official:")
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ from registrar.forms.application_wizard import (
|
||||||
TribalGovernmentForm,
|
TribalGovernmentForm,
|
||||||
PurposeForm,
|
PurposeForm,
|
||||||
AnythingElseForm,
|
AnythingElseForm,
|
||||||
TypeOfWorkForm,
|
AboutYourOrganizationForm,
|
||||||
)
|
)
|
||||||
from registrar.forms.domain import ContactForm
|
from registrar.forms.domain import ContactForm
|
||||||
|
|
||||||
|
@ -118,8 +118,7 @@ class TestFormValidation(TestCase):
|
||||||
["Response must be less than 1000 characters."],
|
["Response must be less than 1000 characters."],
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO-446: Update type_of_work -> about_your_organization
|
def test_anything_else_form_about_your_organization_character_count_invalid(self):
|
||||||
def test_anything_else_form_type_of_work_character_count_invalid(self):
|
|
||||||
"""Response must be less than 1000 characters."""
|
"""Response must be less than 1000 characters."""
|
||||||
form = AnythingElseForm(
|
form = AnythingElseForm(
|
||||||
data={
|
data={
|
||||||
|
@ -148,45 +147,12 @@ class TestFormValidation(TestCase):
|
||||||
["Response must be less than 1000 characters."],
|
["Response must be less than 1000 characters."],
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO-446: Can remove bc don't have this textbox anymore
|
|
||||||
def test_anything_else_form_more_organization_information_character_count_invalid(
|
|
||||||
self,
|
|
||||||
):
|
|
||||||
"""Response must be less than 1000 characters."""
|
|
||||||
form = TypeOfWorkForm(
|
|
||||||
data={
|
|
||||||
"more_organization_information": "Bacon ipsum dolor amet fatback"
|
|
||||||
"shankle, drumstick doner chicken landjaeger turkey andouille."
|
|
||||||
"Buffalo biltong chuck pork chop tongue bresaola turkey. Doner"
|
|
||||||
"ground round strip steak, jowl tail chuck ribeye bacon"
|
|
||||||
"beef ribs swine filet ball tip pancetta strip steak sirloin"
|
|
||||||
"mignon ham spare ribs rump. Tail shank biltong beef ribs doner"
|
|
||||||
"buffalo swine bacon. Tongue cow picanha brisket bacon chuck"
|
|
||||||
"leberkas pork loin pork, drumstick capicola. Doner short loin"
|
|
||||||
"ground round fatback turducken chislic shoulder turducken"
|
|
||||||
"spare ribs, burgdoggen kielbasa kevin frankfurter ball tip"
|
|
||||||
"pancetta cupim. Turkey meatball andouille porchetta hamburger"
|
|
||||||
"pork chop corned beef. Brisket short ribs turducken, pork chop"
|
|
||||||
"chislic turkey ball pork chop leberkas rump, rump bacon, jowl"
|
|
||||||
"tip ham. Shankle salami tongue venison short ribs kielbasa"
|
|
||||||
"tri-tip ham hock swine hamburger. Flank meatball corned beef"
|
|
||||||
"cow sausage ball tip kielbasa ham hock. Ball tip cupim meatloaf"
|
|
||||||
"beef ribs rump jowl tenderloin swine sausage biltong"
|
|
||||||
"bacon rump tail boudin meatball boudin meatball boudin"
|
|
||||||
"strip steak pastrami."
|
|
||||||
}
|
|
||||||
)
|
|
||||||
self.assertEqual(
|
|
||||||
form.errors["more_organization_information"],
|
|
||||||
["Response must be less than 1000 characters."],
|
|
||||||
)
|
|
||||||
|
|
||||||
# TODO-446: Update type_of_work -> about_your_organization in data and assertEqual
|
|
||||||
def test_anything_else_form_character_count_invalid(self):
|
def test_anything_else_form_character_count_invalid(self):
|
||||||
"""Response must be less than 1000 characters."""
|
"""Response must be less than 1000 characters."""
|
||||||
form = TypeOfWorkForm(
|
form = AboutYourOrganizationForm(
|
||||||
data={
|
data={
|
||||||
"type_of_work": "Bacon ipsum dolor amet fatback strip steak pastrami"
|
"about_your_organization":
|
||||||
|
"Bacon ipsum dolor amet fatback strip steak pastrami"
|
||||||
"shankle, drumstick doner chicken landjaeger turkey andouille."
|
"shankle, drumstick doner chicken landjaeger turkey andouille."
|
||||||
"Buffalo biltong chuck pork chop tongue bresaola turkey. Doner"
|
"Buffalo biltong chuck pork chop tongue bresaola turkey. Doner"
|
||||||
"ground round strip steak, jowl tail chuck ribeye bacon"
|
"ground round strip steak, jowl tail chuck ribeye bacon"
|
||||||
|
@ -207,7 +173,7 @@ class TestFormValidation(TestCase):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
form.errors["type_of_work"],
|
form.errors["about_your_organization"],
|
||||||
["Response must be less than 1000 characters."],
|
["Response must be less than 1000 characters."],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -663,11 +663,12 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
# the post request should return a redirect to the type of work page
|
# the post request should return a redirect to the type of work page
|
||||||
# if it was successful.
|
# if it was successful.
|
||||||
self.assertEqual(contact_result.status_code, 302)
|
self.assertEqual(contact_result.status_code, 302)
|
||||||
self.assertEqual(contact_result["Location"], "/register/type_of_work/")
|
self.assertEqual(
|
||||||
# TODO-446: self.assertEqual(contact_result["Location"], "/register/about_your_organization/")
|
contact_result["Location"],
|
||||||
|
"/register/about_your_organization/"
|
||||||
|
)
|
||||||
|
|
||||||
# TODO-446: Update type_of_work -> about_your_organization
|
def test_application_about_your_organization_special(self):
|
||||||
def test_application_type_of_work_special(self):
|
|
||||||
"""Special districts have to answer an additional question."""
|
"""Special districts have to answer an additional question."""
|
||||||
type_page = self.app.get(reverse("application:")).follow()
|
type_page = self.app.get(reverse("application:")).follow()
|
||||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||||
|
@ -686,9 +687,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
contact_page = type_result.follow()
|
contact_page = type_result.follow()
|
||||||
|
|
||||||
self.assertContains(contact_page, self.TITLES[Step.TYPE_OF_WORK])
|
self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
|
||||||
# TODO-446: self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
|
|
||||||
|
|
||||||
|
|
||||||
def test_application_no_other_contacts(self):
|
def test_application_no_other_contacts(self):
|
||||||
"""Applicants with no other contacts have to give a reason."""
|
"""Applicants with no other contacts have to give a reason."""
|
||||||
|
@ -708,8 +707,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
actual_url_slug = no_contacts_page.request.path.split("/")[-2]
|
actual_url_slug = no_contacts_page.request.path.split("/")[-2]
|
||||||
self.assertEqual(expected_url_slug, actual_url_slug)
|
self.assertEqual(expected_url_slug, actual_url_slug)
|
||||||
|
|
||||||
# TODO-446: Update type_of_work -> about_your_organization
|
def test_application_about_your_organiztion_interstate(self):
|
||||||
def test_application_type_of_work_interstate(self):
|
|
||||||
"""Special districts have to answer an additional question."""
|
"""Special districts have to answer an additional question."""
|
||||||
type_page = self.app.get(reverse("application:")).follow()
|
type_page = self.app.get(reverse("application:")).follow()
|
||||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||||
|
@ -728,9 +726,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
contact_page = type_result.follow()
|
contact_page = type_result.follow()
|
||||||
|
|
||||||
self.assertContains(contact_page, self.TITLES[Step.TYPE_OF_WORK])
|
self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
|
||||||
# TODO-446: self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
|
|
||||||
|
|
||||||
|
|
||||||
def test_application_tribal_government(self):
|
def test_application_tribal_government(self):
|
||||||
"""Tribal organizations have to answer an additional question."""
|
"""Tribal organizations have to answer an additional question."""
|
||||||
|
|
|
@ -100,7 +100,9 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
Step.ORGANIZATION_ELECTION: lambda w: w.from_model(
|
Step.ORGANIZATION_ELECTION: lambda w: w.from_model(
|
||||||
"show_organization_election", False
|
"show_organization_election", False
|
||||||
),
|
),
|
||||||
Step.ABOUT_YOUR_ORGANIZATION: lambda w: w.from_model("show_about_your_organization", False),
|
Step.ABOUT_YOUR_ORGANIZATION: lambda w: w.from_model(
|
||||||
|
"show_about_your_organization", False
|
||||||
|
),
|
||||||
Step.NO_OTHER_CONTACTS: lambda w: w.from_model(
|
Step.NO_OTHER_CONTACTS: lambda w: w.from_model(
|
||||||
"show_no_other_contacts_rationale", False
|
"show_no_other_contacts_rationale", False
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue