Changes but with comments this time

This commit is contained in:
Rebecca Hsieh 2023-09-04 12:07:57 -07:00
parent 28a80ace36
commit a4adb5ed46
No known key found for this signature in database
GPG key ID: 644527A2F375A379
14 changed files with 56 additions and 9 deletions

View file

@ -233,6 +233,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
search_help_text = "Search by domain or submitter."
# Detail view
# TODO-446: Add "about_your_organization" + remove "type_of_work" and "more_organization_information"
fieldsets = [
(None, {"fields": ["status", "investigator", "creator"]}),
(
@ -283,6 +284,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
]
# Read only that we'll leverage for CISA Analysts
# TODO-446: Add "about_your_organization" + remove "type_of_work" and "more_organization_information"
analyst_readonly_fields = [
"creator",
"type_of_work",

View file

@ -19,6 +19,7 @@ application_urls = [
path("finished/", views.Finished.as_view(), name="finished"),
]
# TODO-446: (Step.ABOUT_YOUR_ORGANIZATION, views.AboutYourOrganization),
# dynamically generate the other application_urls
for step, view in [
# add/remove steps here

View file

@ -309,12 +309,8 @@ class OrganizationContactForm(RegistrarForm):
)
return federal_agency
# TODO-446: Update name of form + variable naming
class TypeOfWorkForm(RegistrarForm):
# TO DO:
# 1. Confirm it's required
# 2. Even if it is required, the label seems to be reading from somewhere and not hiding itself
# 3. Fix all emails to be - about your organization but we need to fix title somehow
type_of_work = forms.CharField(
required=False,
label="TypeOfWork",
@ -325,7 +321,7 @@ class TypeOfWorkForm(RegistrarForm):
message="Response must be less than 1000 characters.",
)
],
# Confirm if this error message wording is ok, prev was "Enter the type of work your organization does."
# TODO-446: Confirm if this error message wording is ok, prev was "Enter the type of work your organization does."
error_messages={
"required": ("Enter information about your organization.")
},

View file

@ -384,12 +384,21 @@ class DomainApplication(TimeStampedModel):
help_text="Type of work of the organization",
)
# TODO-446:
# about_your_organization = models.TextField(
# null=True,
# blank=True,
# help_text="Information about your organization",
# )
more_organization_information = models.TextField(
null=True,
blank=True,
help_text="More information about your organization",
)
# TODO-446: Remove above bc we don't need this textbox anymore
authorizing_official = models.ForeignKey(
"registrar.Contact",
null=True,
@ -653,6 +662,7 @@ class DomainApplication(TimeStampedModel):
]
return bool(user_choice and user_choice not in excluded)
# TODO-446: Rename to show_about_your_organization
def show_type_of_work(self) -> bool:
"""Show this step if this is a special district or interstate."""
user_choice = self.organization_type

View file

@ -140,12 +140,21 @@ class DomainInformation(TimeStampedModel):
help_text="Type of work of the organization",
)
# TODO-446:
# about_your_organization = models.TextField(
# null=True,
# blank=True,
# help_text="Information about your organization",
# )
more_organization_information = models.TextField(
null=True,
blank=True,
help_text="Further information about the government organization",
)
# TODO-446: Remove above bc we don't need this textbox anymore
authorizing_official = models.ForeignKey(
"registrar.Contact",
null=True,

View file

@ -46,6 +46,7 @@
Incomplete
{% endif %}
{% endif %}
<!-- TODO-446: {% if step == Step.ABOUT_YOUR_ORGANIZATION %} -->
{% if step == Step.TYPE_OF_WORK %}
<p>{{ application.type_of_work|default:"Incomplete" }}</p>
<p>{{ application.more_organization_information|default:"Incomplete" }}</p>

View file

@ -68,6 +68,11 @@
{% include "includes/summary_item.html" with title='Organization name and mailing address' value=domainapplication address='true' heading_level=heading_level %}
{% endif %}
<!-- TODO-446:
{% if domainapplication.about_your_organization %}
{% include "includes/summary_item.html" with title='About your organization' value=domainapplication.about_your_organization heading_level=heading_level %}
{% endif %} -->
{% if domainapplication.type_of_work %}
{% include "includes/summary_item.html" with title='Type of work' value=domainapplication.type_of_work heading_level=heading_level %}
{% endif %}
@ -76,6 +81,8 @@
{% include "includes/summary_item.html" with title='More information about your organization' value=domainapplication.more_organization_information heading_level=heading_level %}
{% endif %}
<!-- TODO-446: Remove above because won't need the textbox anymore -->
{% if domainapplication.authorizing_official %}
{% include "includes/summary_item.html" with title='Authorizing official' value=domainapplication.authorizing_official contact='true' heading_level=heading_level %}
{% endif %}

View file

@ -1,6 +1,7 @@
{% extends 'application_form.html' %}
{% load field_helpers %}
<!-- TODO-446: Change name of file to be application_about_your_organization.html -->
{% block form_instructions %}
<p>[For special districts, interstate governments]</p>
@ -19,6 +20,7 @@
{# empty this block so it doesn't show on this page #}
{% endblock %}
<!-- TODO-446: Change name form name -->
{% block form_fields %}
{% with attr_maxlength=1000 %}
{% input_with_errors forms.0.type_of_work %}

View file

@ -248,6 +248,7 @@ class AuditedAdminMockData:
creator: User = self.dummy_user(item_name, "creator"),
}
""" # noqa
# TODO-446: Update type_of_work to about_your_organization
common_args = dict(
organization_type=org_type,
federal_type=federal_type,
@ -433,7 +434,7 @@ def create_user():
password=p,
)
# TODO-446: Update has_type_of_work to has_about_your_organization
def completed_application(
has_other_contacts=True,
has_current_website=True,
@ -486,6 +487,7 @@ def completed_application(
creator=user,
status=status,
)
# TODO-446: Update has_type_of_work to has_about_your_organization
if has_type_of_work:
domain_application_kwargs["type_of_work"] = "e-Government"
if has_anything_else:

View file

@ -316,6 +316,7 @@ class TestDomainApplicationAdmin(TestCase):
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 = [
"id",
"created_at",
@ -360,6 +361,7 @@ class TestDomainApplicationAdmin(TestCase):
readonly_fields = self.admin.get_readonly_fields(request)
# TODO-446: Add about_your_organization + remove type_of_work and more_organization_information
expected_fields = [
"creator",
"type_of_work",

View file

@ -125,6 +125,7 @@ class TestEmails(TestCase):
# spacing should be right between adjacent elements
self.assertRegex(body, r"city.gov\n\nPurpose of your domain:")
# TODO-446: Update type_of_work -> about_your_organization
@boto3_mocking.patching
def test_submission_confirmation_type_of_work_spacing(self):
"""Test line spacing with type of work."""
@ -137,6 +138,7 @@ class TestEmails(TestCase):
# spacing should be right between adjacent elements
self.assertRegex(body, r"10002\n\nType of work:")
# TODO-446: Update type_of_work -> about_your_organization
@boto3_mocking.patching
def test_submission_confirmation_no_type_of_work_spacing(self):
"""Test line spacing without type of work."""

View file

@ -118,6 +118,7 @@ class TestFormValidation(TestCase):
["Response must be less than 1000 characters."],
)
# TODO-446: Update type_of_work -> about_your_organization
def test_anything_else_form_type_of_work_character_count_invalid(self):
"""Response must be less than 1000 characters."""
form = AnythingElseForm(
@ -147,6 +148,7 @@ class TestFormValidation(TestCase):
["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,
):
@ -179,6 +181,7 @@ class TestFormValidation(TestCase):
["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):
"""Response must be less than 1000 characters."""
form = TypeOfWorkForm(

View file

@ -664,7 +664,9 @@ class DomainApplicationTests(TestWithUser, WebTest):
# if it was successful.
self.assertEqual(contact_result.status_code, 302)
self.assertEqual(contact_result["Location"], "/register/type_of_work/")
# TODO-446: self.assertEqual(contact_result["Location"], "/register/about_your_organization/")
# TODO-446: Update type_of_work -> about_your_organization
def test_application_type_of_work_special(self):
"""Special districts have to answer an additional question."""
type_page = self.app.get(reverse("application:")).follow()
@ -685,6 +687,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
contact_page = type_result.follow()
self.assertContains(contact_page, self.TITLES[Step.TYPE_OF_WORK])
# TODO-446: self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
def test_application_no_other_contacts(self):
"""Applicants with no other contacts have to give a reason."""
@ -704,6 +708,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
actual_url_slug = no_contacts_page.request.path.split("/")[-2]
self.assertEqual(expected_url_slug, actual_url_slug)
# TODO-446: Update type_of_work -> about_your_organization
def test_application_type_of_work_interstate(self):
"""Special districts have to answer an additional question."""
type_page = self.app.get(reverse("application:")).follow()
@ -724,6 +729,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
contact_page = type_result.follow()
self.assertContains(contact_page, self.TITLES[Step.TYPE_OF_WORK])
# TODO-446: self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
def test_application_tribal_government(self):
"""Tribal organizations have to answer an additional question."""

View file

@ -17,6 +17,7 @@ from .utility import DomainApplicationPermissionView, ApplicationWizardPermissio
logger = logging.getLogger(__name__)
# TODO-446: ABOUT_YOUR_ORGANIZATION = "about_your_organization"
class Step(StrEnum):
"""
Names for each page of the application wizard.
@ -71,6 +72,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
EDIT_URL_NAME = "edit-application"
NEW_URL_NAME = "/register/"
# We need to pass our human-readable step titles as context to the templates.
# TODO-446: Step.ABOUT_YOUR_ORGANIZATION: _("About your organization"),
TITLES = {
Step.ORGANIZATION_TYPE: _("Type of organization"),
Step.TRIBAL_GOVERNMENT: _("Tribal government"),
@ -92,6 +94,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
# We can use a dictionary with step names and callables that return booleans
# to show or hide particular steps based on the state of the process.
# TODO-446: Step.ABOUT_YOUR_ORGANIZATION: lambda w: w.from_model("show_about_your_organization", False),
WIZARD_CONDITIONS = {
Step.ORGANIZATION_FEDERAL: lambda w: w.from_model(
"show_organization_federal", False
@ -372,7 +375,7 @@ class OrganizationContact(ApplicationWizard):
template_name = "application_org_contact.html"
forms = [forms.OrganizationContactForm]
# TODO-446: Probs step 1 after migration? Update typeofwork naming to about_your_organization
class TypeOfWork(ApplicationWizard):
template_name = "application_type_of_work.html"
forms = [forms.TypeOfWorkForm]