From 1e44b2069060010c6fce4c1469f80c67cbf52b03 Mon Sep 17 00:00:00 2001 From: CocoByte Date: Tue, 12 Mar 2024 12:37:49 -0600 Subject: [PATCH] Revert "Merge remote-tracking branch 'origin/main' into nl/1798-update-email-signature" This reverts commit ef5358e7e207bce8ea1b9c10bb4afddfa42e868a, reversing changes made to 5746dbe0a15ea6a9e4c5ee838e9b40f9c296b808. --- .github/ISSUE_TEMPLATE/bug.yml | 6 +- .github/ISSUE_TEMPLATE/story.yml | 8 +- .github/workflows/test-deploy.yaml | 41 -- .../decisions/0015-use-django-fsm.md | 8 +- .../decisions/0016-django-form-wizard.md | 8 +- docs/architecture/decisions/0017-ses-email.md | 2 +- .../decisions/0021-django-admin.md | 3 +- .../0022-submit-domain-request-user-flow.md | 6 +- .../get.gov registrar deployment.puml | 4 +- docs/architecture/diagrams/model_timeline.md | 28 +- docs/architecture/diagrams/model_timeline.svg | 2 +- docs/architecture/diagrams/models_diagram.md | 26 +- docs/architecture/diagrams/models_diagram.svg | 2 +- docs/developer/README.md | 8 +- docs/developer/generating-emails-guide.md | 8 +- docs/operations/README.md | 2 +- ops/manifests/manifest-ab.yaml | 2 +- ops/manifests/manifest-development.yaml | 2 +- src/registrar/admin.py | 86 +-- src/registrar/assets/sass/_theme/_admin.scss | 2 - src/registrar/config/urls.py | 44 +- ...n_requests.py => fixtures_applications.py} | 46 +- src/registrar/forms/__init__.py | 2 +- ...equest_wizard.py => application_wizard.py} | 66 +- src/registrar/management/commands/load.py | 4 +- .../transfer_transition_domains_to_domains.py | 8 +- .../migrations/0073_domainrequest_and_more.py | 685 ------------------ .../migrations/0074_create_groups_v08.py | 37 - src/registrar/models/__init__.py | 6 +- src/registrar/models/domain.py | 4 +- ...omain_request.py => domain_application.py} | 166 ++--- src/registrar/models/domain_information.py | 66 +- src/registrar/models/user_group.py | 4 +- src/registrar/models/utility/domain_helper.py | 2 +- src/registrar/models/website.py | 2 +- ... application_about_your_organization.html} | 2 +- ...se.html => application_anything_else.html} | 2 +- ... => application_authorizing_official.html} | 2 +- ...es.html => application_current_sites.html} | 2 +- ...equest_done.html => application_done.html} | 0 ...in.html => application_dotgov_domain.html} | 2 +- ...equest_form.html => application_form.html} | 4 +- ...uest_intro.html => application_intro.html} | 0 ...tact.html => application_org_contact.html} | 2 +- ...ion.html => application_org_election.html} | 2 +- ...eral.html => application_org_federal.html} | 2 +- ...rg_type.html => application_org_type.html} | 2 +- ...s.html => application_other_contacts.html} | 2 +- ..._purpose.html => application_purpose.html} | 2 +- ...nts.html => application_requirements.html} | 2 +- ...st_review.html => application_review.html} | 120 +-- ..._sidebar.html => application_sidebar.html} | 2 +- .../templates/application_status.html | 126 ++++ ...tml => application_tribal_government.html} | 2 +- .../application_withdraw_confirmation.html | 21 + ...act.html => application_your_contact.html} | 2 +- .../templates/domain_request_status.html | 126 ---- .../domain_request_withdraw_confirmation.html | 21 - .../emails/domain_request_withdrawn.txt | 6 +- .../domain_request_withdrawn_subject.txt | 2 +- .../emails/includes/application_summary.txt | 55 ++ .../includes/domain_request_summary.txt | 55 -- .../emails/status_change_approved.txt | 6 +- .../emails/status_change_approved_subject.txt | 2 +- .../emails/status_change_rejected.txt | 28 +- .../emails/status_change_rejected_subject.txt | 2 +- .../emails/submission_confirmation.txt | 8 +- .../submission_confirmation_subject.txt | 2 +- src/registrar/templates/home.html | 58 +- ...n_request.html => domain_application.html} | 0 src/registrar/templatetags/custom_filters.py | 4 +- src/registrar/tests/common.py | 112 +-- src/registrar/tests/test_admin.py | 572 +++++++-------- src/registrar/tests/test_emails.py | 46 +- src/registrar/tests/test_forms.py | 2 +- src/registrar/tests/test_migrations.py | 2 +- src/registrar/tests/test_models.py | 454 ++++++------ src/registrar/tests/test_models_domain.py | 18 +- .../test_transition_domain_migrations.py | 2 +- src/registrar/tests/test_views.py | 10 +- src/registrar/tests/test_views_application.py | 676 ++++++++--------- src/registrar/tests/test_views_domain.py | 8 +- src/registrar/views/__init__.py | 2 +- .../{domain_request.py => application.py} | 321 ++++---- src/registrar/views/index.py | 42 +- src/registrar/views/utility/__init__.py | 6 +- src/registrar/views/utility/mixins.py | 50 +- .../views/utility/permission_views.py | 36 +- 88 files changed, 1834 insertions(+), 2597 deletions(-) delete mode 100644 .github/workflows/test-deploy.yaml rename src/registrar/{fixtures_domain_requests.py => fixtures_applications.py} (83%) rename src/registrar/forms/{domain_request_wizard.py => application_wizard.py} (94%) delete mode 100644 src/registrar/migrations/0073_domainrequest_and_more.py delete mode 100644 src/registrar/migrations/0074_create_groups_v08.py rename src/registrar/models/{domain_request.py => domain_application.py} (86%) rename src/registrar/templates/{domain_request_about_your_organization.html => application_about_your_organization.html} (95%) rename src/registrar/templates/{domain_request_anything_else.html => application_anything_else.html} (92%) rename src/registrar/templates/{domain_request_authorizing_official.html => application_authorizing_official.html} (96%) rename src/registrar/templates/{domain_request_current_sites.html => application_current_sites.html} (96%) rename src/registrar/templates/{domain_request_done.html => application_done.html} (100%) rename src/registrar/templates/{domain_request_dotgov_domain.html => application_dotgov_domain.html} (98%) rename src/registrar/templates/{domain_request_form.html => application_form.html} (96%) rename src/registrar/templates/{domain_request_intro.html => application_intro.html} (100%) rename src/registrar/templates/{domain_request_org_contact.html => application_org_contact.html} (96%) rename src/registrar/templates/{domain_request_org_election.html => application_org_election.html} (94%) rename src/registrar/templates/{domain_request_org_federal.html => application_org_federal.html} (91%) rename src/registrar/templates/{domain_request_org_type.html => application_org_type.html} (92%) rename src/registrar/templates/{domain_request_other_contacts.html => application_other_contacts.html} (99%) rename src/registrar/templates/{domain_request_purpose.html => application_purpose.html} (95%) rename src/registrar/templates/{domain_request_requirements.html => application_requirements.html} (98%) rename src/registrar/templates/{domain_request_review.html => application_review.html} (57%) rename src/registrar/templates/{domain_request_sidebar.html => application_sidebar.html} (95%) create mode 100644 src/registrar/templates/application_status.html rename src/registrar/templates/{domain_request_tribal_government.html => application_tribal_government.html} (96%) create mode 100644 src/registrar/templates/application_withdraw_confirmation.html rename src/registrar/templates/{domain_request_your_contact.html => application_your_contact.html} (95%) delete mode 100644 src/registrar/templates/domain_request_status.html delete mode 100644 src/registrar/templates/domain_request_withdraw_confirmation.html create mode 100644 src/registrar/templates/emails/includes/application_summary.txt delete mode 100644 src/registrar/templates/emails/includes/domain_request_summary.txt rename src/registrar/templates/includes/{domain_request.html => domain_application.html} (100%) rename src/registrar/views/{domain_request.py => application.py} (68%) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 559be3fca..7cd332156 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -22,7 +22,7 @@ body: attributes: label: Expected Behavior description: "Please add a concise description of the behavior you would expect if this issue were not occurring" - placeholder: "Example: When submitting a new domain request, the request should be successful, OR if there is a problem with the user's application preventing submission, errors should be enumerated to the user" + placeholder: "Example: When submitting a new domain application, the request should be successful, OR if there is a problem with the user's application preventing submission, errors should be enumerated to the user" validations: required: true - type: textarea @@ -33,8 +33,8 @@ body: How can the issue be reliably reproduced? Feel free to include screenshots or other supporting artifacts Example: - 1. In the test environment, fill out the domain request for a new domain - 2. Click the button to trigger a save/submit on the final page and complete the domain request + 1. In the test environment, fill out the application for a new domain + 2. Click the button to trigger a save/submit on the final page and complete the application 3. See the error value: | 1. diff --git a/.github/ISSUE_TEMPLATE/story.yml b/.github/ISSUE_TEMPLATE/story.yml index e7d81ad3a..41516cc29 100644 --- a/.github/ISSUE_TEMPLATE/story.yml +++ b/.github/ISSUE_TEMPLATE/story.yml @@ -19,7 +19,7 @@ body: Example: As an analyst - I want the ability to approve a domain request + I want the ability to approve a domain application so that a request can be fulfilled and a new .gov domain can be provisioned value: | As a @@ -36,11 +36,11 @@ body: Example: - Application sends an email when analysts approve domain requests - - Domain request status is "approved" + - Domain application status is "approved" Example ("given, when, then" format): - Given that I am an analyst who has finished reviewing a domain request - When I click to approve a domain request + Given that I am an analyst who has finished reviewing a domain application + When I click to approve a domain application Then the domain provisioning process should be initiated, and the applicant should receive an email update. validations: required: true diff --git a/.github/workflows/test-deploy.yaml b/.github/workflows/test-deploy.yaml deleted file mode 100644 index af429738f..000000000 --- a/.github/workflows/test-deploy.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow is to for testing a change to our deploy structure and will be deleted when testing finishes - -name: Deploy Main -run-name: Run deploy for ${{ github.event.inputs.environment }} - -on: - workflow_dispatch: - inputs: - environment: - type: choice - description: Which environment should we run deploy for? - options: - - development - - backup - - ky - - es - - nl - - rh - - za - - gd - - rb - - ko - - ab - - rjm - - dk - -jobs: - deploy: - runs-on: ubuntu-latest - env: - CF_USERNAME: CF_${{ github.event.inputs.environment }}_USERNAME - CF_PASSWORD: CF_${{ github.event.inputs.environment }}_PASSWORD - steps: - - name: Deploy to cloud.gov sandbox - uses: cloud-gov/cg-cli-tools@main - with: - cf_username: ${{ secrets[env.CF_USERNAME] }} - cf_password: ${{ secrets[env.CF_PASSWORD] }} - cf_org: cisa-dotgov - cf_space: ${{ github.event.inputs.environment }} - cf_command: "push -f ops/manifests/manifest-${{ github.event.inputs.environment }}.yaml --strategy rolling" \ No newline at end of file diff --git a/docs/architecture/decisions/0015-use-django-fsm.md b/docs/architecture/decisions/0015-use-django-fsm.md index 4c4aa7e36..60f4cf902 100644 --- a/docs/architecture/decisions/0015-use-django-fsm.md +++ b/docs/architecture/decisions/0015-use-django-fsm.md @@ -1,4 +1,4 @@ -# 15. Use Django-FSM library for domain request state +# 15. Use Django-FSM library for domain application state Date: 2022-11-03 @@ -10,12 +10,12 @@ Accepted The applications that registrants submit for domains move through a variety of different states or stages as they are processed by CISA staff. Traditionally, -there would be a “domain request” data model with a “status” field. The +there would be a “domain application” data model with a “status” field. The rules in the application code that control what changes are permitted to the statuses are called “domain logic”. In a large piece of software, domain logic often spreads around the code base -because while handling a single request like “mark this domain request as +because while handling a single request like “mark this application as approved”, requirements can be enforced at many different points during the process. @@ -28,7 +28,7 @@ states and can change states (or “transition”) according to fixed rules. We will use the django-fsm library to represent the status of our domain registration applications as a finite state machine. The library allows us to list what statuses are possible and describe which state transitions are -possible (e.g. Can an approved domain request ever be marked as “in-process”?). +possible (e.g. Can an approved application ever be marked as “in-process”?). ## Consequences diff --git a/docs/architecture/decisions/0016-django-form-wizard.md b/docs/architecture/decisions/0016-django-form-wizard.md index afbfb7edf..8e785a196 100644 --- a/docs/architecture/decisions/0016-django-form-wizard.md +++ b/docs/architecture/decisions/0016-django-form-wizard.md @@ -8,17 +8,17 @@ Accepted ## Context -The domain request form by which registrants apply for a .gov domain is presented over many pages. +The application form by which registrants apply for a .gov domain is presented over many pages. -Because we use server-side rendering, each page of the domain request is a unique HTML page with form fields surrounded by a form tag. +Because we use server-side rendering, each page of the application is a unique HTML page with form fields surrounded by a form tag. -Needing a way to coordinate state between the pages as a user fills in their domain request, we initially used the Form wizard from [django-formtools](https://django-formtools.readthedocs.io/en/latest/wizard.html). This eventually proved unworkable due to the lack of native ability to have more than one Django form object displayed on a single HTML page. +Needing a way to coordinate state between the pages as a user fills in their application, we initially used the Form wizard from [django-formtools](https://django-formtools.readthedocs.io/en/latest/wizard.html). This eventually proved unworkable due to the lack of native ability to have more than one Django form object displayed on a single HTML page. However, a significant portion of the user workflow had already been coded, so it seemed prudent to port some of the formtools logic into our codebase. ## Decision -To maintain each page of the domain request as its own Django view class, inheriting common code from a parent class. +To maintain each page of the domain application as its own Django view class, inheriting common code from a parent class. To maintain Django form and formset class in accordance with the Django models whose data they collect, independently of the pages on which they appear. diff --git a/docs/architecture/decisions/0017-ses-email.md b/docs/architecture/decisions/0017-ses-email.md index d39a4aa68..6559cbb4e 100644 --- a/docs/architecture/decisions/0017-ses-email.md +++ b/docs/architecture/decisions/0017-ses-email.md @@ -9,7 +9,7 @@ Approved ## Context Our application needs to be able to send email to applicants for various -purposes including notifying them that their domain request has been submitted. +purposes including notifying them that their application has been submitted. We need infrastructure for programmatically sending email. Amazon Web Services (AWS) provides the Simple Email Service (SES) that can do that. CISA can provide access to AWS SES for our application. diff --git a/docs/architecture/decisions/0021-django-admin.md b/docs/architecture/decisions/0021-django-admin.md index 31715a9cf..add6992cd 100644 --- a/docs/architecture/decisions/0021-django-admin.md +++ b/docs/architecture/decisions/0021-django-admin.md @@ -8,7 +8,8 @@ Accepted ## Context -CISA needs a way to perform administrative actions to manage the new get.gov application as well as the .gov domain requests submitted. Analysts need to be able to view, review, and approve domain requests. Other +CISA needs a way to perform administrative actions to manage the new get.gov application as well as the .gov domain +application requests submitted. Analysts need to be able to view, review, and approve domain applications. Other dashboard views, reports, searches (with filters and sorting) are also highly desired. ## Decision diff --git a/docs/architecture/decisions/0022-submit-domain-request-user-flow.md b/docs/architecture/decisions/0022-submit-domain-request-user-flow.md index c28579113..cc0ca83b8 100644 --- a/docs/architecture/decisions/0022-submit-domain-request-user-flow.md +++ b/docs/architecture/decisions/0022-submit-domain-request-user-flow.md @@ -8,13 +8,13 @@ Accepted ## Context -Historically, the .gov vendor managed initial identity verification and organizational affiliation for users that request a .gov domain. With the new registrar, _any user with a valid Login.gov account_ will be able to make a request. As a primary layer of abuse prevention (i.e., DDoSing the registry program with illegitimate requests), we need a way to stop new users from submitting multiple domain requests before they are known to the .gov registry. In this case, "known" means they have at least one approved domain request or existing domain. +Historically, the .gov vendor managed initial identity verification and organizational affiliation for users that request a .gov domain. With the new registrar, _any user with a valid Login.gov account_ will be able to make a request. As a primary layer of abuse prevention (i.e., DDoSing the registry program with illegitimate requests), we need a way to stop new users from submitting multiple domain requests before they are known to the .gov registry. In this case, "known" means they have at least one approved domain application or existing domain. ## Considered Options -**Option 1:** Users will not be able to submit any new applications if they have 0 prior approved applications OR prior registered .gov domains. We would add a page alert informing the user that they cannot submit their application because they have a domain request in one of these "3" statuses (Submitted, In Review or Action Needed). They would still be able to create and edit new applications, just not submit them. The benefits of this option are that it would allow users to have multiple applications essentially in "draft mode" that are queued up and ready for submission after they are permitted to submit. +**Option 1:** Users will not be able to submit any new applications if they have 0 prior approved applications OR prior registered .gov domains. We would add a page alert informing the user that they cannot submit their application because they have an application in one of these "3" statuses (Submitted, In Review or Action Needed). They would still be able to create and edit new applications, just not submit them. The benefits of this option are that it would allow users to have multiple applications essentially in "draft mode" that are queued up and ready for submission after they are permitted to submit. -**Option 2:** Users will not be able to submit any new applications if they have 0 prior approved applications OR prior registered .gov domains. Additionally, we would remove the ability to edit any application with the started/withdrawn/rejected status, or start a new application. The benefit of this option is that a user would not be able to begin an action (submitting a domain request) that they are not allowed to complete. +**Option 2:** Users will not be able to submit any new applications if they have 0 prior approved applications OR prior registered .gov domains. Additionally, we would remove the ability to edit any application with the started/withdrawn/rejected status, or start a new application. The benefit of this option is that a user would not be able to begin an action (submitting an application) that they are not allowed to complete. ## Decision diff --git a/docs/architecture/diagrams/get.gov registrar deployment.puml b/docs/architecture/diagrams/get.gov registrar deployment.puml index 3e832995a..9ea8c099a 100644 --- a/docs/architecture/diagrams/get.gov registrar deployment.puml +++ b/docs/architecture/diagrams/get.gov registrar deployment.puml @@ -18,13 +18,13 @@ Deployment_Node(aws, "AWS GovCloud", "Amazon Web Services Region") { Deployment_Node(organization, "get.gov organization") { Deployment_Node(sandbox, "sandbox space") { System_Boundary(dashboard_sandbox, "get.gov registrar") { - Container(getgov_app_sandbox, "Registrar Domain Request", "Python, Django", "Delivers static HTML/CSS and forms") + Container(getgov_app_sandbox, "Registrar Application", "Python, Django", "Delivers static HTML/CSS and forms") ContainerDb(dashboard_db_sandbox, "sandbox PostgreSQL Database", "AWS RDS", "Stores agency information and reports") } } Deployment_Node(stable, "stable space") { System_Boundary(dashboard_stable, "get.gov registrar") { - Container(getgov_app_stable, "Registrar Domain Request", "Python, Django", "Delivers static HTML/CSS and forms") + Container(getgov_app_stable, "Registrar Application", "Python, Django", "Delivers static HTML/CSS and forms") ContainerDb(dashboard_db_stable, "stable PostgreSQL Database", "AWS RDS", "Stores agency information and reports") } } diff --git a/docs/architecture/diagrams/model_timeline.md b/docs/architecture/diagrams/model_timeline.md index 7baf611ad..967c63eb2 100644 --- a/docs/architecture/diagrams/model_timeline.md +++ b/docs/architecture/diagrams/model_timeline.md @@ -3,9 +3,9 @@ This diagram connects the data models along with various workflow stages. 1. The applicant starts the process at `/request` interacting with the - `DomainRequest` object. + `DomainApplication` object. -2. The analyst approves the domain request using the `DomainRequest`'s +2. The analyst approves the application using the `DomainApplication`'s `approve()` method which creates many related objects: `UserDomainRole`, `Domain`, and `DomainInformation`. @@ -36,8 +36,8 @@ $ docker run -v $(pwd):$(pwd) -w $(pwd) -it plantuml/plantuml -tsvg model_timeli allowmixing left to right direction -class DomainRequest { - Request for a domain +class DomainApplication { + Application for a domain -- creator (User) investigator (User) @@ -66,7 +66,7 @@ note left of User username is the Login UUID end note -DomainRequest -l- User : creator, investigator +DomainApplication -l- User : creator, investigator class Contact { Contact info for a person @@ -80,7 +80,7 @@ class Contact { -- } -DomainRequest *-r-* Contact : authorizing_official, submitter, other_contacts +DomainApplication *-r-* Contact : authorizing_official, submitter, other_contacts class DraftDomain { Requested domain @@ -89,7 +89,7 @@ class DraftDomain { -- } -DomainRequest -l- DraftDomain : requested_domain +DomainApplication -l- DraftDomain : requested_domain class Domain { Approved domain @@ -99,21 +99,21 @@ class Domain { EPP methods } -DomainRequest .right[#blue].> Domain : approve() +DomainApplication .right[#blue].> Domain : approve() class DomainInformation { Registrar information on a domain -- domain (Domain) - domain_request (DomainRequest) + domain_application (DomainApplication) security_email -- Request information... } DomainInformation -- Domain -DomainInformation -- DomainRequest -DomainRequest .[#blue].> DomainInformation : approve() +DomainInformation -- DomainApplication +DomainApplication .[#blue].> DomainInformation : approve() class UserDomainRole { Permissions @@ -125,7 +125,7 @@ class UserDomainRole { } UserDomainRole -- User UserDomainRole -- Domain -DomainRequest .[#blue].> UserDomainRole : approve() +DomainApplication .[#blue].> UserDomainRole : approve() class DomainInvitation { Email invitations sent @@ -139,10 +139,10 @@ DomainInvitation -- Domain DomainInvitation .[#green].> UserDomainRole : User.on_each_login() actor applicant #Red -applicant -d-> DomainRequest : **/request** +applicant -d-> DomainApplication : **/request** actor analyst #Blue -analyst -[#blue]-> DomainRequest : **approve()** +analyst -[#blue]-> DomainApplication : **approve()** actor user1 #Green user1 -[#green]-> Domain : **/domain//nameservers** diff --git a/docs/architecture/diagrams/model_timeline.svg b/docs/architecture/diagrams/model_timeline.svg index 51a31b27d..5410bf25f 100644 --- a/docs/architecture/diagrams/model_timeline.svg +++ b/docs/architecture/diagrams/model_timeline.svg @@ -1 +1 @@ -DomainRequestRequest for a domaincreator (User)investigator (User)authorizing_official (Contact)submitter (Contact)other_contacts (Contacts)approved_domain (Domain)requested_domain (DraftDomain)current_websites (Websites)alternative_domains (Websites)Request information...UserDjango's user class...Created by DjangoOIDCwhen users arrive backfrom Login.gov usernameis the Login UUIDContactContact info for a personfirst_namemiddle_namelast_nametitleemailphoneDraftDomainRequested domainnameDomainApproved domainnameEPP methodsDomainInformationRegistrar information on a domaindomain (Domain)domain_request (DomainRequest)security_emailRequest information...UserDomainRolePermissionsdomain (Domain)user (User)role="ADMIN"DomainInvitationEmail invitations sentemaildomain (Domain)statusapplicantanalystuser1user2user3creator, investigatorauthorizing_official, submitter, other_contactsrequested_domainapprove()approve()approve()User.on_each_login()/registerapprove()/domain/<id>/nameservers/domain/<id>/?????/domain/<id>/users/add/domain/<id>/users/add \ No newline at end of file +DomainApplicationApplication for a domaincreator (User)investigator (User)authorizing_official (Contact)submitter (Contact)other_contacts (Contacts)approved_domain (Domain)requested_domain (DraftDomain)current_websites (Websites)alternative_domains (Websites)Request information...UserDjango's user class...Created by DjangoOIDCwhen users arrive backfrom Login.gov usernameis the Login UUIDContactContact info for a personfirst_namemiddle_namelast_nametitleemailphoneDraftDomainRequested domainnameDomainApproved domainnameEPP methodsDomainInformationRegistrar information on a domaindomain (Domain)domain_application (DomainApplication)security_emailRequest information...UserDomainRolePermissionsdomain (Domain)user (User)role="ADMIN"DomainInvitationEmail invitations sentemaildomain (Domain)statusapplicantanalystuser1user2user3creator, investigatorauthorizing_official, submitter, other_contactsrequested_domainapprove()approve()approve()User.on_each_login()/registerapprove()/domain/<id>/nameservers/domain/<id>/?????/domain/<id>/users/add/domain/<id>/users/add \ No newline at end of file diff --git a/docs/architecture/diagrams/models_diagram.md b/docs/architecture/diagrams/models_diagram.md index df0e39b7e..000d480c7 100644 --- a/docs/architecture/diagrams/models_diagram.md +++ b/docs/architecture/diagrams/models_diagram.md @@ -39,8 +39,8 @@ class "registrar.Contact " as registrar.Contact #d6f4e9 { registrar.Contact -- registrar.User -class "registrar.DomainRequest " as registrar.DomainRequest #d6f4e9 { - domain request +class "registrar.DomainApplication " as registrar.DomainApplication #d6f4e9 { + domain application -- + id (BigAutoField) + created_at (DateTimeField) @@ -77,15 +77,15 @@ class "registrar.DomainRequest " as registrar.DomainRequest #d6f4e9 { # other_contacts (ManyToManyField) -- } -registrar.DomainRequest -- registrar.User -registrar.DomainRequest -- registrar.User -registrar.DomainRequest -- registrar.Contact -registrar.DomainRequest -- registrar.DraftDomain -registrar.DomainRequest -- registrar.Domain -registrar.DomainRequest -- registrar.Contact -registrar.DomainRequest *--* registrar.Website -registrar.DomainRequest *--* registrar.Website -registrar.DomainRequest *--* registrar.Contact +registrar.DomainApplication -- registrar.User +registrar.DomainApplication -- registrar.User +registrar.DomainApplication -- registrar.Contact +registrar.DomainApplication -- registrar.DraftDomain +registrar.DomainApplication -- registrar.Domain +registrar.DomainApplication -- registrar.Contact +registrar.DomainApplication *--* registrar.Website +registrar.DomainApplication *--* registrar.Website +registrar.DomainApplication *--* registrar.Contact class "registrar.DomainInformation " as registrar.DomainInformation #d6f4e9 { @@ -95,7 +95,7 @@ class "registrar.DomainInformation " as registrar.DomainInformation # + created_at (DateTimeField) + updated_at (DateTimeField) ~ creator (ForeignKey) - ~ domain_request (OneToOneField) + ~ domain_application (OneToOneField) + organization_type (CharField) + federally_recognized_tribe (BooleanField) + state_recognized_tribe (BooleanField) @@ -124,7 +124,7 @@ class "registrar.DomainInformation " as registrar.DomainInformation # -- } registrar.DomainInformation -- registrar.User -registrar.DomainInformation -- registrar.DomainRequest +registrar.DomainInformation -- registrar.DomainApplication registrar.DomainInformation -- registrar.Contact registrar.DomainInformation -- registrar.Domain registrar.DomainInformation -- registrar.Contact diff --git a/docs/architecture/diagrams/models_diagram.svg b/docs/architecture/diagrams/models_diagram.svg index 49999454c..0075c44cb 100644 --- a/docs/architecture/diagrams/models_diagram.svg +++ b/docs/architecture/diagrams/models_diagram.svg @@ -1 +1 @@ -registrarregistrar.ContactRegistrarcontactid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)user (OneToOneField)first_name (TextField)middle_name (TextField)last_name (TextField)title (TextField)email (TextField)phone (PhoneNumberField)registrar.UserRegistraruserid (BigAutoField)password (CharField)last_login (DateTimeField)is_superuser (BooleanField)username (CharField)first_name (CharField)last_name (CharField)email (EmailField)is_staff (BooleanField)is_active (BooleanField)date_joined (DateTimeField)phone (PhoneNumberField)groups (ManyToManyField)user_permissions (ManyToManyField)domains (ManyToManyField)registrar.DomainRequestRegistrardomain requestid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)status (FSMField)creator (ForeignKey)investigator (ForeignKey)organization_type (CharField)federally_recognized_tribe (BooleanField)state_recognized_tribe (BooleanField)tribe_name (TextField)federal_agency (TextField)federal_type (CharField)is_election_board (BooleanField)organization_name (TextField)address_line1 (TextField)address_line2 (CharField)city (TextField)state_territory (CharField)zipcode (CharField)urbanization (TextField)type_of_work (TextField)more_organization_information (TextField)authorizing_official (ForeignKey)approved_domain (OneToOneField)requested_domain (OneToOneField)submitter (ForeignKey)purpose (TextField)no_other_contacts_rationale (TextField)anything_else (TextField)is_policy_acknowledged (BooleanField)current_websites (ManyToManyField)alternative_domains (ManyToManyField)other_contacts (ManyToManyField)registrar.DraftDomainRegistrardraft domainid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)registrar.DomainRegistrardomainid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)registrar.WebsiteRegistrarwebsiteid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)website (CharField)registrar.DomainInformationRegistrardomain informationid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)creator (ForeignKey)domain_request (OneToOneField)organization_type (CharField)federally_recognized_tribe (BooleanField)state_recognized_tribe (BooleanField)tribe_name (TextField)federal_agency (TextField)federal_type (CharField)is_election_board (BooleanField)organization_name (TextField)address_line1 (TextField)address_line2 (CharField)city (TextField)state_territory (CharField)zipcode (CharField)urbanization (TextField)type_of_work (TextField)more_organization_information (TextField)authorizing_official (ForeignKey)domain (OneToOneField)submitter (ForeignKey)purpose (TextField)no_other_contacts_rationale (TextField)anything_else (TextField)is_policy_acknowledged (BooleanField)security_email (EmailField)other_contacts (ManyToManyField)registrar.HostIPRegistrarhost ipid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)address (CharField)host (ForeignKey)registrar.HostRegistrarhostid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)domain (ForeignKey)registrar.UserDomainRoleRegistraruser domain roleid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)user (ForeignKey)domain (ForeignKey)role (TextField)registrar.DomainInvitationRegistrardomain invitationid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)email (EmailField)domain (ForeignKey)status (FSMField)registrar.NameserverRegistrarnameserverid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)domain (ForeignKey)host_ptr (OneToOneField)registrar.PublicContactRegistrarpublic contactid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)contact_type (CharField)registry_id (CharField)domain (ForeignKey)name (TextField)org (TextField)street1 (TextField)street2 (TextField)street3 (TextField)city (TextField)sp (TextField)pc (TextField)cc (TextField)email (TextField)voice (TextField)fax (TextField)pw (TextField) \ No newline at end of file +registrarregistrar.ContactRegistrarcontactid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)user (OneToOneField)first_name (TextField)middle_name (TextField)last_name (TextField)title (TextField)email (TextField)phone (PhoneNumberField)registrar.UserRegistraruserid (BigAutoField)password (CharField)last_login (DateTimeField)is_superuser (BooleanField)username (CharField)first_name (CharField)last_name (CharField)email (EmailField)is_staff (BooleanField)is_active (BooleanField)date_joined (DateTimeField)phone (PhoneNumberField)groups (ManyToManyField)user_permissions (ManyToManyField)domains (ManyToManyField)registrar.DomainApplicationRegistrardomain applicationid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)status (FSMField)creator (ForeignKey)investigator (ForeignKey)organization_type (CharField)federally_recognized_tribe (BooleanField)state_recognized_tribe (BooleanField)tribe_name (TextField)federal_agency (TextField)federal_type (CharField)is_election_board (BooleanField)organization_name (TextField)address_line1 (TextField)address_line2 (CharField)city (TextField)state_territory (CharField)zipcode (CharField)urbanization (TextField)type_of_work (TextField)more_organization_information (TextField)authorizing_official (ForeignKey)approved_domain (OneToOneField)requested_domain (OneToOneField)submitter (ForeignKey)purpose (TextField)no_other_contacts_rationale (TextField)anything_else (TextField)is_policy_acknowledged (BooleanField)current_websites (ManyToManyField)alternative_domains (ManyToManyField)other_contacts (ManyToManyField)registrar.DraftDomainRegistrardraft domainid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)registrar.DomainRegistrardomainid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)registrar.WebsiteRegistrarwebsiteid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)website (CharField)registrar.DomainInformationRegistrardomain informationid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)creator (ForeignKey)domain_application (OneToOneField)organization_type (CharField)federally_recognized_tribe (BooleanField)state_recognized_tribe (BooleanField)tribe_name (TextField)federal_agency (TextField)federal_type (CharField)is_election_board (BooleanField)organization_name (TextField)address_line1 (TextField)address_line2 (CharField)city (TextField)state_territory (CharField)zipcode (CharField)urbanization (TextField)type_of_work (TextField)more_organization_information (TextField)authorizing_official (ForeignKey)domain (OneToOneField)submitter (ForeignKey)purpose (TextField)no_other_contacts_rationale (TextField)anything_else (TextField)is_policy_acknowledged (BooleanField)security_email (EmailField)other_contacts (ManyToManyField)registrar.HostIPRegistrarhost ipid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)address (CharField)host (ForeignKey)registrar.HostRegistrarhostid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)domain (ForeignKey)registrar.UserDomainRoleRegistraruser domain roleid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)user (ForeignKey)domain (ForeignKey)role (TextField)registrar.DomainInvitationRegistrardomain invitationid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)email (EmailField)domain (ForeignKey)status (FSMField)registrar.NameserverRegistrarnameserverid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)name (CharField)domain (ForeignKey)host_ptr (OneToOneField)registrar.PublicContactRegistrarpublic contactid (BigAutoField)created_at (DateTimeField)updated_at (DateTimeField)contact_type (CharField)registry_id (CharField)domain (ForeignKey)name (TextField)org (TextField)street1 (TextField)street2 (TextField)street3 (TextField)city (TextField)sp (TextField)pc (TextField)cc (TextField)email (TextField)voice (TextField)fax (TextField)pw (TextField) \ No newline at end of file diff --git a/docs/developer/README.md b/docs/developer/README.md index e28c57378..dc4c9ddd2 100644 --- a/docs/developer/README.md +++ b/docs/developer/README.md @@ -78,7 +78,7 @@ Get the secrets from Cloud.gov by running `cf env getgov-YOURSANDBOX`. More info The endpoint /admin can be used to view and manage site content, including but not limited to user information and the list of current applications in the database. To be able to view and use /admin locally: 1. Login via login.gov -2. Go to the home page and make sure you can see the part where you can submit a domain request +2. Go to the home page and make sure you can see the part where you can submit an application 3. Go to /admin and it will tell you that UUID is not authorized, copy that UUID for use in 4 4. in src/registrar/fixtures_users.py add to the `ADMINS` list in that file by adding your UUID as your username along with your first and last name. See below: @@ -93,14 +93,14 @@ The endpoint /admin can be used to view and manage site content, including but n ] ``` -5. In the browser, navigate to /admin. To verify that all is working correctly, under "domain requests" you should see fake domains with various fake statuses. +5. In the browser, navigate to /admin. To verify that all is working correctly, under "domain applications" you should see fake domains with various fake statuses. 6. Add an optional email key/value pair ### Adding an Analyst to /admin Analysts are a variant of the admin role with limited permissions. The process for adding an Analyst is much the same as adding an admin: 1. Login via login.gov (if you already exist as an admin, you will need to create a separate login.gov account for this: i.e. first.last+1@email.com) -2. Go to the home page and make sure you can see the part where you can submit a domain request +2. Go to the home page and make sure you can see the part where you can submit an application 3. Go to /admin and it will tell you that UUID is not authorized, copy that UUID for use in 4 (this will be a different UUID than the one obtained from creating an admin) 4. in src/registrar/fixtures_users.py add to the `STAFF` list in that file by adding your UUID as your username along with your first and last name. See below: @@ -145,7 +145,7 @@ You can change the logging verbosity, if needed. Do a web search for "django log ## Mock data -[load.py](../../src/registrar/management/commands/load.py) called from docker-compose (locally) and reset-db.yml (upper) loads the fixtures from [fixtures_user.py](../../src/registrar/fixtures_users.py) and [fixtures_domain_requests.py](../../src/registrar/fixtures_domain_requests.py), giving you some test data to play with while developing. +[load.py](../../src/registrar/management/commands/load.py) called from docker-compose (locally) and reset-db.yml (upper) loads the fixtures from [fixtures_user.py](../../src/registrar/fixtures_users.py) and [fixtures_applications.py](../../src/registrar/fixtures_applications.py), giving you some test data to play with while developing. See the [database-access README](./database-access.md) for information on how to pull data to update these fixtures. diff --git a/docs/developer/generating-emails-guide.md b/docs/developer/generating-emails-guide.md index dd0a55e64..0a97a8bc6 100644 --- a/docs/developer/generating-emails-guide.md +++ b/docs/developer/generating-emails-guide.md @@ -24,8 +24,8 @@ ## Status Change Approved - Starting Location: Django Admin - Workflow: Analyst Admin -- Workflow Step: Click "domain requests" -> Click a domain request in a status of "submitted", "In review", "rejected", or "ineligible" -> Click status dropdown -> (select "approved") -> click "Save" -- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create a domain request, then set the status to "approved". This will send you an email. +- Workflow Step: Click "Domain applications" -> Click an application in a status of "submitted", "In review", "rejected", or "ineligible" -> Click status dropdown -> (select "approved") -> click "Save" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create an application, then set the status to "approved". This will send you an email. - [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_approved.txt) ### Status Change Approved Subject @@ -35,8 +35,8 @@ ## Status Change Rejected - Starting Location: Django Admin - Workflow: Analyst Admin -- Workflow Step: Click "domain requests" -> Click a domain request in a status of "In review", or "approved" -> Click status dropdown -> (select "rejected") -> click "Save" -- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create a domain request, then set the status to "in review" (and click save). Then, go back to the same application and set the status to "rejected". This will send you an email. +- Workflow Step: Click "Domain applications" -> Click an application in a status of "In review", or "approved" -> Click status dropdown -> (select "rejected") -> click "Save" +- Notes: Note that this will send an email to the submitter (email listed on Your Contact Information). To test this with your own email, you need to create an application, then set the status to "in review" (and click save). Then, go back to the same application and set the status to "rejected". This will send you an email. - [Email Content](https://github.com/cisagov/manage.get.gov/blob/main/src/registrar/templates/emails/status_change_rejected.txt) ### Status Change Rejected Subject diff --git a/docs/operations/README.md b/docs/operations/README.md index 9aaee4c86..0bd55ab51 100644 --- a/docs/operations/README.md +++ b/docs/operations/README.md @@ -114,7 +114,7 @@ that can be used for specific tasks. ## Cloud.gov dashboard At there is a list for all of the -applications that a Cloud.gov user has access to. Clicking on a domain request +applications that a Cloud.gov user has access to. Clicking on an application goes to a screen for that individual application, e.g. . On that page is a left-hand link for "Log Stream" e.g. diff --git a/ops/manifests/manifest-ab.yaml b/ops/manifests/manifest-ab.yaml index a78de338e..3ca800392 100644 --- a/ops/manifests/manifest-ab.yaml +++ b/ops/manifests/manifest-ab.yaml @@ -4,7 +4,7 @@ applications: buildpacks: - python_buildpack path: ../../src - instances: 2 + instances: 1 memory: 512M stack: cflinuxfs4 timeout: 180 diff --git a/ops/manifests/manifest-development.yaml b/ops/manifests/manifest-development.yaml index 23558ba4c..08244cf08 100644 --- a/ops/manifests/manifest-development.yaml +++ b/ops/manifests/manifest-development.yaml @@ -4,7 +4,7 @@ applications: buildpacks: - python_buildpack path: ../../src - instances: 2 + instances: 1 memory: 512M stack: cflinuxfs4 timeout: 180 diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 50801b79b..92e477667 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -14,7 +14,7 @@ from django.contrib.contenttypes.models import ContentType from django.urls import reverse from dateutil.relativedelta import relativedelta # type: ignore from epplibwrapper.errors import ErrorCode, RegistryError -from registrar.models import Contact, Domain, DomainRequest, DraftDomain, User, Website +from registrar.models import Contact, Domain, DomainApplication, DraftDomain, User, Website from registrar.utility import csv_export from registrar.views.utility.mixins import OrderableFieldsMixin from django.contrib.admin.views.main import ORDER_VAR @@ -69,12 +69,12 @@ class DomainInformationInlineForm(forms.ModelForm): } -class DomainRequestAdminForm(forms.ModelForm): +class DomainApplicationAdminForm(forms.ModelForm): """Custom form to limit transitions to available transitions. This form utilizes the custom widget for its class's ManyToMany UIs.""" class Meta: - model = models.DomainRequest + model = models.DomainApplication fields = "__all__" widgets = { "current_websites": NoAutocompleteFilteredSelectMultiple("current_websites", False), @@ -85,24 +85,24 @@ class DomainRequestAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - domain_request = kwargs.get("instance") - if domain_request and domain_request.pk: - current_state = domain_request.status + application = kwargs.get("instance") + if application and application.pk: + current_state = application.status # first option in status transitions is current state - available_transitions = [(current_state, domain_request.get_status_display())] + available_transitions = [(current_state, application.get_status_display())] transitions = get_available_FIELD_transitions( - domain_request, models.DomainRequest._meta.get_field("status") + application, models.DomainApplication._meta.get_field("status") ) for transition in transitions: available_transitions.append((transition.target, transition.target.label)) # only set the available transitions if the user is not restricted - # from editing the domain request; otherwise, the form will be + # from editing the domain application; otherwise, the form will be # readonly and the status field will not have a widget - if not domain_request.creator.is_restricted(): + if not application.creator.is_restricted(): self.fields["status"].widget.choices = available_transitions @@ -218,8 +218,8 @@ class AdminSortFields: "alternative_domains": (Website, "website"), # == DraftDomain == # "requested_domain": (DraftDomain, "name"), - # == DomainRequest == # - "domain_request": (DomainRequest, "requested_domain__name"), + # == DomainApplication == # + "domain_application": (DomainApplication, "requested_domain__name"), # == Domain == # "domain": (Domain, "name"), "approved_domain": (Domain, "name"), @@ -466,7 +466,7 @@ class MyUserAdmin(BaseUserAdmin): def get_search_results(self, request, queryset, search_term): """ Override for get_search_results. This affects any upstream model using autocomplete_fields, - such as DomainRequest. This is because autocomplete_fields uses an API call to fetch data, + such as DomainApplication. This is because autocomplete_fields uses an API call to fetch data, and this fetch comes from this method. """ # Custom filtering logic @@ -480,13 +480,13 @@ class MyUserAdmin(BaseUserAdmin): request_get = request.GET # The request defines model name and field name. - # For instance, model_name could be "DomainRequest" + # For instance, model_name could be "DomainApplication" # and field_name could be "investigator". model_name = request_get.get("model_name", None) field_name = request_get.get("field_name", None) # Make sure we're only modifying requests from these models. - models_to_target = {"domainrequest"} + models_to_target = {"domainapplication"} if model_name in models_to_target: # Define rules per field match field_name: @@ -777,7 +777,7 @@ class DomainInformationAdmin(ListHeaderAdmin): search_help_text = "Search by domain." fieldsets = [ - (None, {"fields": ["creator", "domain_request", "notes"]}), + (None, {"fields": ["creator", "domain_application", "notes"]}), ( "Type of organization", { @@ -828,7 +828,7 @@ class DomainInformationAdmin(ListHeaderAdmin): "type_of_work", "more_organization_information", "domain", - "domain_request", + "domain_application", "submitter", "no_other_contacts_rationale", "anything_else", @@ -841,7 +841,7 @@ class DomainInformationAdmin(ListHeaderAdmin): autocomplete_fields = [ "creator", - "domain_request", + "domain_application", "authorizing_official", "domain", "submitter", @@ -866,10 +866,10 @@ class DomainInformationAdmin(ListHeaderAdmin): return readonly_fields # Read-only fields for analysts -class DomainRequestAdmin(ListHeaderAdmin): - """Custom domain requests admin class.""" +class DomainApplicationAdmin(ListHeaderAdmin): + """Custom domain applications admin class.""" - form = DomainRequestAdminForm + form = DomainApplicationAdminForm class InvestigatorFilter(admin.SimpleListFilter): """Custom investigator filter that only displays users with the manager role""" @@ -884,7 +884,7 @@ class DomainRequestAdmin(ListHeaderAdmin): """ # Select all investigators that are staff, then order by name and email privileged_users = ( - DomainRequest.objects.select_related("investigator") + DomainApplication.objects.select_related("investigator") .filter(investigator__is_staff=True) .order_by("investigator__first_name", "investigator__last_name", "investigator__email") ) @@ -1055,17 +1055,17 @@ class DomainRequestAdmin(ListHeaderAdmin): # Trigger action when a fieldset is changed def save_model(self, request, obj, form, change): if obj and obj.creator.status != models.User.RESTRICTED: - if change: # Check if the domain request is being edited - # Get the original domain request from the database - original_obj = models.DomainRequest.objects.get(pk=obj.pk) + if change: # Check if the application is being edited + # Get the original application from the database + original_obj = models.DomainApplication.objects.get(pk=obj.pk) if ( obj - and original_obj.status == models.DomainRequest.DomainRequestStatus.APPROVED - and obj.status != models.DomainRequest.DomainRequestStatus.APPROVED + and original_obj.status == models.DomainApplication.ApplicationStatus.APPROVED + and obj.status != models.DomainApplication.ApplicationStatus.APPROVED and not obj.domain_is_not_active() ): - # If an admin tried to set an approved domain request to + # If an admin tried to set an approved application to # another status and the related domain is already # active, shortcut the action and throw a friendly # error message. This action would still not go through @@ -1081,7 +1081,9 @@ class DomainRequestAdmin(ListHeaderAdmin): ) elif ( - obj and obj.status == models.DomainRequest.DomainRequestStatus.REJECTED and not obj.rejection_reason + obj + and obj.status == models.DomainApplication.ApplicationStatus.REJECTED + and not obj.rejection_reason ): # This condition should never be triggered. # The opposite of this condition is acceptable (rejected -> other status and rejection_reason) @@ -1098,14 +1100,14 @@ class DomainRequestAdmin(ListHeaderAdmin): else: if obj.status != original_obj.status: status_method_mapping = { - models.DomainRequest.DomainRequestStatus.STARTED: None, - models.DomainRequest.DomainRequestStatus.SUBMITTED: obj.submit, - models.DomainRequest.DomainRequestStatus.IN_REVIEW: obj.in_review, - models.DomainRequest.DomainRequestStatus.ACTION_NEEDED: obj.action_needed, - models.DomainRequest.DomainRequestStatus.APPROVED: obj.approve, - models.DomainRequest.DomainRequestStatus.WITHDRAWN: obj.withdraw, - models.DomainRequest.DomainRequestStatus.REJECTED: obj.reject, - models.DomainRequest.DomainRequestStatus.INELIGIBLE: (obj.reject_with_prejudice), + models.DomainApplication.ApplicationStatus.STARTED: None, + models.DomainApplication.ApplicationStatus.SUBMITTED: obj.submit, + models.DomainApplication.ApplicationStatus.IN_REVIEW: obj.in_review, + models.DomainApplication.ApplicationStatus.ACTION_NEEDED: obj.action_needed, + models.DomainApplication.ApplicationStatus.APPROVED: obj.approve, + models.DomainApplication.ApplicationStatus.WITHDRAWN: obj.withdraw, + models.DomainApplication.ApplicationStatus.REJECTED: obj.reject, + models.DomainApplication.ApplicationStatus.INELIGIBLE: (obj.reject_with_prejudice), } selected_method = status_method_mapping.get(obj.status) if selected_method is None: @@ -1125,13 +1127,13 @@ class DomainRequestAdmin(ListHeaderAdmin): messages.error( request, - "This action is not permitted for domain requests with a restricted creator.", + "This action is not permitted for applications with a restricted creator.", ) def get_readonly_fields(self, request, obj=None): """Set the read-only state on form elements. We have 2 conditions that determine which fields are read-only: - admin user permissions and the domain request creator's status, so + admin user permissions and the application creator's status, so we'll use the baseline readonly_fields and extend it as needed. """ readonly_fields = list(self.readonly_fields) @@ -1156,7 +1158,7 @@ class DomainRequestAdmin(ListHeaderAdmin): if obj and obj.creator.status == models.User.RESTRICTED: messages.warning( request, - "Cannot edit a domain request with a restricted creator.", + "Cannot edit an application with a restricted creator.", ) def change_view(self, request, object_id, form_url="", extra_context=None): @@ -1200,7 +1202,7 @@ class DomainInformationInline(admin.StackedInline): autocomplete_fields = [ "creator", - "domain_request", + "domain_application", "authorizing_official", "domain", "submitter", @@ -1710,6 +1712,6 @@ admin.site.register(models.DraftDomain, DraftDomainAdmin) admin.site.register(models.Host, MyHostAdmin) admin.site.register(models.Website, WebsiteAdmin) admin.site.register(models.PublicContact, AuditedAdmin) -admin.site.register(models.DomainRequest, DomainRequestAdmin) +admin.site.register(models.DomainApplication, DomainApplicationAdmin) admin.site.register(models.TransitionDomain, TransitionDomainAdmin) admin.site.register(models.VerifiedByStaff, VerifiedByStaffAdmin) diff --git a/src/registrar/assets/sass/_theme/_admin.scss b/src/registrar/assets/sass/_theme/_admin.scss index 9c0d7517c..b57c6a015 100644 --- a/src/registrar/assets/sass/_theme/_admin.scss +++ b/src/registrar/assets/sass/_theme/_admin.scss @@ -135,8 +135,6 @@ html[data-theme="dark"] { color: var(--primary-fg); } - - #branding h1, h1, h2, h3, .module h2 { diff --git a/src/registrar/config/urls.py b/src/registrar/config/urls.py index 9049d718c..4bd7b4baf 100644 --- a/src/registrar/config/urls.py +++ b/src/registrar/config/urls.py @@ -13,18 +13,18 @@ from registrar import views from registrar.views.admin_views import ExportData -from registrar.views.domain_request import Step +from registrar.views.application import Step from registrar.views.utility import always_404 from api.views import available, get_current_federal, get_current_full -DOMAIN_REQUEST_NAMESPACE = views.DomainRequestWizard.URL_NAMESPACE -domain_request_urls = [ - path("", views.DomainRequestWizard.as_view(), name=""), +APPLICATION_NAMESPACE = views.ApplicationWizard.URL_NAMESPACE +application_urls = [ + path("", views.ApplicationWizard.as_view(), name=""), path("finished/", views.Finished.as_view(), name="finished"), ] -# dynamically generate the other domain_request_urls +# dynamically generate the other application_urls for step, view in [ # add/remove steps here (Step.ORGANIZATION_TYPE, views.OrganizationType), @@ -43,7 +43,7 @@ for step, view in [ (Step.REQUIREMENTS, views.Requirements), (Step.REVIEW, views.Review), ]: - domain_request_urls.append(path(f"{step}/", view.as_view(), name=step)) + application_urls.append(path(f"{step}/", view.as_view(), name=step)) urlpatterns = [ @@ -55,28 +55,28 @@ urlpatterns = [ path("export_data/", ExportData.as_view(), name="admin_export_data"), path("admin/", admin.site.urls), path( - "domain-request//edit/", - views.DomainRequestWizard.as_view(), - name=views.DomainRequestWizard.EDIT_URL_NAME, + "application//edit/", + views.ApplicationWizard.as_view(), + name=views.ApplicationWizard.EDIT_URL_NAME, ), path( - "domain-request/", - views.DomainRequestStatus.as_view(), - name="domain-request-status", + "application/", + views.ApplicationStatus.as_view(), + name="application-status", ), path( - "domain-request//withdraw", - views.DomainRequestWithdrawConfirmation.as_view(), - name="domain-request-withdraw-confirmation", + "application//withdraw", + views.ApplicationWithdrawConfirmation.as_view(), + name="application-withdraw-confirmation", ), path( - "domain-request//withdrawconfirmed", - views.DomainRequestWithdrawn.as_view(), - name="domain-request-withdrawn", + "application//withdrawconfirmed", + views.ApplicationWithdrawn.as_view(), + name="application-withdrawn", ), path("health", views.health, name="health"), path("openid/", include("djangooidc.urls")), - path("request/", include((domain_request_urls, DOMAIN_REQUEST_NAMESPACE))), + path("request/", include((application_urls, APPLICATION_NAMESPACE))), path("api/v1/available/", available, name="available"), path("api/v1/get-report/current-federal", get_current_federal, name="get-current-federal"), path("api/v1/get-report/current-full", get_current_full, name="get-current-full"), @@ -138,9 +138,9 @@ urlpatterns = [ name="invitation-delete", ), path( - "domain-request//delete", - views.DomainRequestDeleteView.as_view(http_method_names=["post"]), - name="domain-request-delete", + "application//delete", + views.DomainApplicationDeleteView.as_view(http_method_names=["post"]), + name="application-delete", ), path( "domain//users//delete", diff --git a/src/registrar/fixtures_domain_requests.py b/src/registrar/fixtures_applications.py similarity index 83% rename from src/registrar/fixtures_domain_requests.py rename to src/registrar/fixtures_applications.py index a78bdd1ab..3e4e0e362 100644 --- a/src/registrar/fixtures_domain_requests.py +++ b/src/registrar/fixtures_applications.py @@ -4,7 +4,7 @@ from faker import Faker from registrar.models import ( User, - DomainRequest, + DomainApplication, DraftDomain, Contact, Website, @@ -14,9 +14,9 @@ fake = Faker() logger = logging.getLogger(__name__) -class DomainRequestFixture: +class DomainApplicationFixture: """ - Load domain requests into the database. + Load domain applications into the database. Make sure this class' `load` method is called from `handle` in management/commands/load.py, then use `./manage.py load` @@ -49,27 +49,27 @@ class DomainRequestFixture: # }, DA = [ { - "status": DomainRequest.DomainRequestStatus.STARTED, + "status": DomainApplication.ApplicationStatus.STARTED, "organization_name": "Example - Finished but not submitted", }, { - "status": DomainRequest.DomainRequestStatus.SUBMITTED, + "status": DomainApplication.ApplicationStatus.SUBMITTED, "organization_name": "Example - Submitted but pending investigation", }, { - "status": DomainRequest.DomainRequestStatus.IN_REVIEW, + "status": DomainApplication.ApplicationStatus.IN_REVIEW, "organization_name": "Example - In investigation", }, { - "status": DomainRequest.DomainRequestStatus.IN_REVIEW, + "status": DomainApplication.ApplicationStatus.IN_REVIEW, "organization_name": "Example - Approved", }, { - "status": DomainRequest.DomainRequestStatus.WITHDRAWN, + "status": DomainApplication.ApplicationStatus.WITHDRAWN, "organization_name": "Example - Withdrawn", }, { - "status": DomainRequest.DomainRequestStatus.ACTION_NEEDED, + "status": DomainApplication.ApplicationStatus.ACTION_NEEDED, "organization_name": "Example - Action needed", }, { @@ -94,7 +94,7 @@ class DomainRequestFixture: return f"{fake.slug()}.gov" @classmethod - def _set_non_foreign_key_fields(cls, da: DomainRequest, app: dict): + def _set_non_foreign_key_fields(cls, da: DomainApplication, app: dict): """Helper method used by `load`.""" da.status = app["status"] if "status" in app else "started" da.organization_type = app["organization_type"] if "organization_type" in app else "federal" @@ -102,7 +102,7 @@ class DomainRequestFixture: app["federal_agency"] if "federal_agency" in app # Random choice of agency for selects, used as placeholders for testing. - else random.choice(DomainRequest.AGENCIES) # nosec + else random.choice(DomainApplication.AGENCIES) # nosec ) da.submission_date = fake.date() da.federal_type = ( @@ -121,7 +121,7 @@ class DomainRequestFixture: da.is_policy_acknowledged = app["is_policy_acknowledged"] if "is_policy_acknowledged" in app else True @classmethod - def _set_foreign_key_fields(cls, da: DomainRequest, app: dict, user: User): + def _set_foreign_key_fields(cls, da: DomainApplication, app: dict, user: User): """Helper method used by `load`.""" if not da.investigator: da.investigator = User.objects.get(username=user.username) if "investigator" in app else None @@ -145,7 +145,7 @@ class DomainRequestFixture: da.requested_domain = DraftDomain.objects.create(name=cls.fake_dot_gov()) @classmethod - def _set_many_to_many_relations(cls, da: DomainRequest, app: dict): + def _set_many_to_many_relations(cls, da: DomainApplication, app: dict): """Helper method used by `load`.""" if "other_contacts" in app: for contact in app["other_contacts"]: @@ -176,8 +176,8 @@ class DomainRequestFixture: @classmethod def load(cls): - """Creates domain requests for each user in the database.""" - logger.info("Going to load %s domain requests" % len(cls.DA)) + """Creates domain applications for each user in the database.""" + logger.info("Going to load %s domain applications" % len(cls.DA)) try: users = list(User.objects.all()) # force evaluation to catch db errors except Exception as e: @@ -185,10 +185,10 @@ class DomainRequestFixture: return for user in users: - logger.debug("Loading domain requests for %s" % user) + logger.debug("Loading domain applications for %s" % user) for app in cls.DA: try: - da, _ = DomainRequest.objects.get_or_create( + da, _ = DomainApplication.objects.get_or_create( creator=user, organization_name=app["organization_name"], ) @@ -200,7 +200,7 @@ class DomainRequestFixture: logger.warning(e) -class DomainFixture(DomainRequestFixture): +class DomainFixture(DomainApplicationFixture): """Create one domain and permissions on it for each user.""" @classmethod @@ -213,12 +213,12 @@ class DomainFixture(DomainRequestFixture): for user in users: # approve one of each users in review status domains - domain_request = DomainRequest.objects.filter( - creator=user, status=DomainRequest.DomainRequestStatus.IN_REVIEW + application = DomainApplication.objects.filter( + creator=user, status=DomainApplication.ApplicationStatus.IN_REVIEW ).last() - logger.debug(f"Approving {domain_request} for {user}") + logger.debug(f"Approving {application} for {user}") # We don't want fixtures sending out real emails to # fake email addresses, so we just skip that and log it instead - domain_request.approve(send_email=False) - domain_request.save() + application.approve(send_email=False) + application.save() diff --git a/src/registrar/forms/__init__.py b/src/registrar/forms/__init__.py index be3b634f6..914db375c 100644 --- a/src/registrar/forms/__init__.py +++ b/src/registrar/forms/__init__.py @@ -1,4 +1,4 @@ -from .domain_request_wizard import * +from .application_wizard import * from .domain import ( DomainAddUserForm, NameserverFormset, diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/application_wizard.py similarity index 94% rename from src/registrar/forms/domain_request_wizard.py rename to src/registrar/forms/application_wizard.py index 17e64fafd..df5b195c6 100644 --- a/src/registrar/forms/domain_request_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -10,7 +10,7 @@ from django.core.validators import RegexValidator, MaxLengthValidator from django.utils.safestring import mark_safe from django.db.models.fields.related import ForeignObjectRel -from registrar.models import Contact, DomainRequest, DraftDomain, Domain +from registrar.models import Contact, DomainApplication, DraftDomain, Domain from registrar.templatetags.url_helpers import public_site_url from registrar.utility.enums import ValidationReturnType @@ -21,7 +21,7 @@ class RegistrarForm(forms.Form): """ A common set of methods and configuration. - The registrar's domain request is several pages of "steps". + The registrar's domain application is several pages of "steps". Each step is an HTML form containing one or more Django "forms". Subclass this class to create new forms. @@ -29,11 +29,11 @@ class RegistrarForm(forms.Form): def __init__(self, *args, **kwargs): kwargs.setdefault("label_suffix", "") - # save a reference to a domain request object - self.domain_request = kwargs.pop("domain_request", None) + # save a reference to an application object + self.application = kwargs.pop("application", None) super(RegistrarForm, self).__init__(*args, **kwargs) - def to_database(self, obj: DomainRequest | Contact): + def to_database(self, obj: DomainApplication | Contact): """ Adds this form's cleaned data to `obj` and saves `obj`. @@ -46,7 +46,7 @@ class RegistrarForm(forms.Form): obj.save() @classmethod - def from_database(cls, obj: DomainRequest | Contact | None): + def from_database(cls, obj: DomainApplication | Contact | None): """Returns a dict of form field values gotten from `obj`.""" if obj is None: return {} @@ -61,8 +61,8 @@ class RegistrarFormSet(forms.BaseFormSet): """ def __init__(self, *args, **kwargs): - # save a reference to an domain_request object - self.domain_request = kwargs.pop("domain_request", None) + # save a reference to an application object + self.application = kwargs.pop("application", None) super(RegistrarFormSet, self).__init__(*args, **kwargs) # quick workaround to ensure that the HTML `required` # attribute shows up on required fields for any forms @@ -85,7 +85,7 @@ class RegistrarFormSet(forms.BaseFormSet): """Code to run before an item in the formset is created in the database.""" return cleaned - def to_database(self, obj: DomainRequest): + def to_database(self, obj: DomainApplication): """ Adds this form's cleaned data to `obj` and saves `obj`. @@ -97,7 +97,7 @@ class RegistrarFormSet(forms.BaseFormSet): def _to_database( self, - obj: DomainRequest, + obj: DomainApplication, join: str, should_delete: Callable, pre_update: Callable, @@ -137,14 +137,14 @@ class RegistrarFormSet(forms.BaseFormSet): if should_delete(cleaned): if hasattr(db_obj, "has_more_than_one_join") and db_obj.has_more_than_one_join(related_name): # Remove the specific relationship without deleting the object - getattr(db_obj, related_name).remove(self.domain_request) + getattr(db_obj, related_name).remove(self.application) else: # If there are no other relationships, delete the object db_obj.delete() else: if hasattr(db_obj, "has_more_than_one_join") and db_obj.has_more_than_one_join(related_name): # create a new db_obj and disconnect existing one - getattr(db_obj, related_name).remove(self.domain_request) + getattr(db_obj, related_name).remove(self.application) kwargs = pre_create(db_obj, cleaned) getattr(obj, join).create(**kwargs) else: @@ -163,15 +163,15 @@ class RegistrarFormSet(forms.BaseFormSet): return query.values() @classmethod - def from_database(cls, obj: DomainRequest, join: str, on_fetch: Callable): + def from_database(cls, obj: DomainApplication, join: str, on_fetch: Callable): """Returns a dict of form field values gotten from `obj`.""" return on_fetch(getattr(obj, join).order_by("created_at")) # order matters class OrganizationTypeForm(RegistrarForm): organization_type = forms.ChoiceField( - # use the long names in the domain request form - choices=DomainRequest.OrganizationChoicesVerbose.choices, + # use the long names in the application form + choices=DomainApplication.OrganizationChoicesVerbose.choices, widget=forms.RadioSelect, error_messages={"required": "Select the type of organization you represent."}, ) @@ -201,7 +201,7 @@ class TribalGovernmentForm(RegistrarForm): # into a link. There should be no user-facing input in the # HTML indicated here. mark_safe( # nosec - "You can’t complete this domain request yet. " + "You can’t complete this application yet. " "Only tribes recognized by the U.S. federal government " "or by a U.S. state government are eligible for .gov " 'domains. Use our contact form to ' @@ -215,7 +215,7 @@ class TribalGovernmentForm(RegistrarForm): class OrganizationFederalForm(RegistrarForm): federal_type = forms.ChoiceField( - choices=DomainRequest.BranchChoices.choices, + choices=DomainApplication.BranchChoices.choices, widget=forms.RadioSelect, error_messages={"required": ("Select the part of the federal government your organization is in.")}, ) @@ -251,7 +251,7 @@ class OrganizationContactForm(RegistrarForm): # it is a federal agency. Use clean to check programatically # if it has been filled in when required. required=False, - choices=[("", "--Select--")] + DomainRequest.AGENCY_CHOICES, + choices=[("", "--Select--")] + DomainApplication.AGENCY_CHOICES, ) organization_name = forms.CharField( label="Organization name", @@ -271,7 +271,7 @@ class OrganizationContactForm(RegistrarForm): ) state_territory = forms.ChoiceField( label="State, territory, or military post", - choices=[("", "--Select--")] + DomainRequest.StateTerritoryChoices.choices, + choices=[("", "--Select--")] + DomainApplication.StateTerritoryChoices.choices, error_messages={ "required": ("Select the state, territory, or military post where your organization is located.") }, @@ -294,16 +294,16 @@ class OrganizationContactForm(RegistrarForm): def clean_federal_agency(self): """Require something to be selected when this is a federal agency.""" federal_agency = self.cleaned_data.get("federal_agency", None) - # need the domain request object to know if this is federal - if self.domain_request is None: - # hmm, no saved domain request object?, default require the agency + # need the application object to know if this is federal + if self.application is None: + # hmm, no saved application object?, default require the agency if not federal_agency: # no answer was selected raise forms.ValidationError( "Select the federal agency your organization is in.", code="required", ) - if self.domain_request.is_federal(): + if self.application.is_federal(): if not federal_agency: # no answer was selected raise forms.ValidationError( @@ -390,7 +390,7 @@ class BaseCurrentSitesFormSet(RegistrarFormSet): website = cleaned.get("website", "") return website.strip() == "" - def to_database(self, obj: DomainRequest): + def to_database(self, obj: DomainApplication): # If we want to test against multiple joins for a website object, replace the empty array # and change the JOIN in the models to allow for reverse references self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create) @@ -444,7 +444,7 @@ class BaseAlternativeDomainFormSet(RegistrarFormSet): else: return {} - def to_database(self, obj: DomainRequest): + def to_database(self, obj: DomainApplication): # If we want to test against multiple joins for a website object, replace the empty array and # change the JOIN in the models to allow for reverse references self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create) @@ -530,7 +530,7 @@ class YourContactForm(RegistrarForm): if not self.is_valid(): return contact = getattr(obj, "submitter", None) - if contact is not None and not contact.has_more_than_one_join("submitted_domain_requests"): + if contact is not None and not contact.has_more_than_one_join("submitted_applications"): # if contact exists in the database and is not joined to other entities super().to_database(contact) else: @@ -578,13 +578,13 @@ class OtherContactsYesNoForm(RegistrarForm): def __init__(self, *args, **kwargs): """Extend the initialization of the form from RegistrarForm __init__""" super().__init__(*args, **kwargs) - # set the initial value based on attributes of domain request - if self.domain_request and self.domain_request.has_other_contacts(): + # set the initial value based on attributes of application + if self.application and self.application.has_other_contacts(): initial_value = True - elif self.domain_request and self.domain_request.has_rationale(): + elif self.application and self.application.has_rationale(): initial_value = False else: - # No pre-selection for new domain requests + # No pre-selection for new applications initial_value = None self.fields["has_other_contacts"] = forms.TypedChoiceField( @@ -687,7 +687,7 @@ class BaseOtherContactsFormSet(RegistrarFormSet): this case, all forms in formset are marked for deletion. Both of these conditions must co-exist. Also, other_contacts have db relationships to multiple db objects. When attempting - to delete an other_contact from a domain request, those db relationships must be + to delete an other_contact from an application, those db relationships must be tested and handled. """ @@ -701,7 +701,7 @@ class BaseOtherContactsFormSet(RegistrarFormSet): Override __init__ for RegistrarFormSet. """ self.formset_data_marked_for_deletion = False - self.domain_request = kwargs.pop("domain_request", None) + self.application = kwargs.pop("application", None) super(RegistrarFormSet, self).__init__(*args, **kwargs) # quick workaround to ensure that the HTML `required` # attribute shows up on required fields for the first form @@ -722,7 +722,7 @@ class BaseOtherContactsFormSet(RegistrarFormSet): cleaned.pop("DELETE") return cleaned - def to_database(self, obj: DomainRequest): + def to_database(self, obj: DomainApplication): self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create) @classmethod diff --git a/src/registrar/management/commands/load.py b/src/registrar/management/commands/load.py index aac5eade1..757d1a6e9 100644 --- a/src/registrar/management/commands/load.py +++ b/src/registrar/management/commands/load.py @@ -5,7 +5,7 @@ from auditlog.context import disable_auditlog # type: ignore from registrar.fixtures_users import UserFixture -from registrar.fixtures_domain_requests import DomainRequestFixture, DomainFixture +from registrar.fixtures_applications import DomainApplicationFixture, DomainFixture logger = logging.getLogger(__name__) @@ -16,6 +16,6 @@ class Command(BaseCommand): # https://github.com/jazzband/django-auditlog/issues/17 with disable_auditlog(): UserFixture.load() - DomainRequestFixture.load() + DomainApplicationFixture.load() DomainFixture.load() logger.info("All fixtures loaded.") diff --git a/src/registrar/management/commands/transfer_transition_domains_to_domains.py b/src/registrar/management/commands/transfer_transition_domains_to_domains.py index 7f09d8de7..15cd7376d 100644 --- a/src/registrar/management/commands/transfer_transition_domains_to_domains.py +++ b/src/registrar/management/commands/transfer_transition_domains_to_domains.py @@ -15,7 +15,7 @@ from registrar.management.commands.utility.terminal_helper import ( TerminalHelper, ) from registrar.models.contact import Contact -from registrar.models.domain_request import DomainRequest +from registrar.models.domain_application import DomainApplication from registrar.models.domain_information import DomainInformation from registrar.models.user import User @@ -817,9 +817,9 @@ class Command(BaseCommand): raise Exception(f"Domain {existing_domain} wants to be added" "but doesn't exist in the DB") invitation.save() - valid_org_choices = [(name, value) for name, value in DomainRequest.OrganizationChoices.choices] - valid_fed_choices = [value for name, value in DomainRequest.BranchChoices.choices] - valid_agency_choices = DomainRequest.AGENCIES + valid_org_choices = [(name, value) for name, value in DomainApplication.OrganizationChoices.choices] + valid_fed_choices = [value for name, value in DomainApplication.BranchChoices.choices] + valid_agency_choices = DomainApplication.AGENCIES # ====================================================== # ================= DOMAIN INFORMATION ================= logger.info( diff --git a/src/registrar/migrations/0073_domainrequest_and_more.py b/src/registrar/migrations/0073_domainrequest_and_more.py deleted file mode 100644 index 88608b03a..000000000 --- a/src/registrar/migrations/0073_domainrequest_and_more.py +++ /dev/null @@ -1,685 +0,0 @@ -# Generated by Django 4.2.10 on 2024-03-07 21:52 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -import django_fsm - - -class Migration(migrations.Migration): - - dependencies = [ - ("registrar", "0072_alter_publiccontact_fax_alter_publiccontact_voice"), - ] - - operations = [ - migrations.CreateModel( - name="DomainRequest", - fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("created_at", models.DateTimeField(auto_now_add=True)), - ("updated_at", models.DateTimeField(auto_now=True)), - ( - "status", - django_fsm.FSMField( - choices=[ - ("started", "Started"), - ("submitted", "Submitted"), - ("in review", "In review"), - ("action needed", "Action needed"), - ("approved", "Approved"), - ("withdrawn", "Withdrawn"), - ("rejected", "Rejected"), - ("ineligible", "Ineligible"), - ], - default="started", - max_length=50, - ), - ), - ( - "rejection_reason", - models.TextField( - blank=True, - choices=[ - ("purpose_not_met", "Purpose requirements not met"), - ("requestor_not_eligible", "Requestor not eligible to make request"), - ("org_has_domain", "Org already has a .gov domain"), - ("contacts_not_verified", "Org contacts couldn't be verified"), - ("org_not_eligible", "Org not eligible for a .gov domain"), - ("naming_not_met", "Naming requirements not met"), - ("other", "Other/Unspecified"), - ], - null=True, - ), - ), - ( - "organization_type", - models.CharField( - blank=True, - choices=[ - ("federal", "Federal"), - ("interstate", "Interstate"), - ("state_or_territory", "State or territory"), - ("tribal", "Tribal"), - ("county", "County"), - ("city", "City"), - ("special_district", "Special district"), - ("school_district", "School district"), - ], - help_text="Type of organization", - max_length=255, - null=True, - ), - ), - ( - "federally_recognized_tribe", - models.BooleanField(help_text="Is the tribe federally recognized", null=True), - ), - ( - "state_recognized_tribe", - models.BooleanField(help_text="Is the tribe recognized by a state", null=True), - ), - ("tribe_name", models.CharField(blank=True, help_text="Name of tribe", null=True)), - ( - "federal_agency", - models.CharField( - blank=True, - choices=[ - ( - "Administrative Conference of the United States", - "Administrative Conference of the United States", - ), - ("Advisory Council on Historic Preservation", "Advisory Council on Historic Preservation"), - ("American Battle Monuments Commission", "American Battle Monuments Commission"), - ("AMTRAK", "AMTRAK"), - ("Appalachian Regional Commission", "Appalachian Regional Commission"), - ( - "Appraisal Subcommittee of the Federal Financial Institutions Examination Council", - "Appraisal Subcommittee of the Federal Financial Institutions Examination Council", - ), - ("Appraisal Subcommittee", "Appraisal Subcommittee"), - ("Architect of the Capitol", "Architect of the Capitol"), - ("Armed Forces Retirement Home", "Armed Forces Retirement Home"), - ( - "Barry Goldwater Scholarship and Excellence in Education Foundation", - "Barry Goldwater Scholarship and Excellence in Education Foundation", - ), - ( - "Barry Goldwater Scholarship and Excellence in Education Program", - "Barry Goldwater Scholarship and Excellence in Education Program", - ), - ("Central Intelligence Agency", "Central Intelligence Agency"), - ("Chemical Safety Board", "Chemical Safety Board"), - ( - "Christopher Columbus Fellowship Foundation", - "Christopher Columbus Fellowship Foundation", - ), - ( - "Civil Rights Cold Case Records Review Board", - "Civil Rights Cold Case Records Review Board", - ), - ( - "Commission for the Preservation of America's Heritage Abroad", - "Commission for the Preservation of America's Heritage Abroad", - ), - ("Commission of Fine Arts", "Commission of Fine Arts"), - ( - "Committee for Purchase From People Who Are Blind or Severely Disabled", - "Committee for Purchase From People Who Are Blind or Severely Disabled", - ), - ("Commodity Futures Trading Commission", "Commodity Futures Trading Commission"), - ("Congressional Budget Office", "Congressional Budget Office"), - ("Consumer Financial Protection Bureau", "Consumer Financial Protection Bureau"), - ("Consumer Product Safety Commission", "Consumer Product Safety Commission"), - ( - "Corporation for National & Community Service", - "Corporation for National & Community Service", - ), - ( - "Corporation for National and Community Service", - "Corporation for National and Community Service", - ), - ( - "Council of Inspectors General on Integrity and Efficiency", - "Council of Inspectors General on Integrity and Efficiency", - ), - ("Court Services and Offender Supervision", "Court Services and Offender Supervision"), - ("Cyberspace Solarium Commission", "Cyberspace Solarium Commission"), - ( - "DC Court Services and Offender Supervision Agency", - "DC Court Services and Offender Supervision Agency", - ), - ("DC Pre-trial Services", "DC Pre-trial Services"), - ("Defense Nuclear Facilities Safety Board", "Defense Nuclear Facilities Safety Board"), - ("Delta Regional Authority", "Delta Regional Authority"), - ("Denali Commission", "Denali Commission"), - ("Department of Agriculture", "Department of Agriculture"), - ("Department of Commerce", "Department of Commerce"), - ("Department of Defense", "Department of Defense"), - ("Department of Education", "Department of Education"), - ("Department of Energy", "Department of Energy"), - ("Department of Health and Human Services", "Department of Health and Human Services"), - ("Department of Homeland Security", "Department of Homeland Security"), - ( - "Department of Housing and Urban Development", - "Department of Housing and Urban Development", - ), - ("Department of Justice", "Department of Justice"), - ("Department of Labor", "Department of Labor"), - ("Department of State", "Department of State"), - ("Department of the Interior", "Department of the Interior"), - ("Department of the Treasury", "Department of the Treasury"), - ("Department of Transportation", "Department of Transportation"), - ("Department of Veterans Affairs", "Department of Veterans Affairs"), - ("Director of National Intelligence", "Director of National Intelligence"), - ("Dwight D. Eisenhower Memorial Commission", "Dwight D. Eisenhower Memorial Commission"), - ("Election Assistance Commission", "Election Assistance Commission"), - ("Environmental Protection Agency", "Environmental Protection Agency"), - ("Equal Employment Opportunity Commission", "Equal Employment Opportunity Commission"), - ("Executive Office of the President", "Executive Office of the President"), - ("Export-Import Bank of the United States", "Export-Import Bank of the United States"), - ("Export/Import Bank of the U.S.", "Export/Import Bank of the U.S."), - ("Farm Credit Administration", "Farm Credit Administration"), - ("Farm Credit System Insurance Corporation", "Farm Credit System Insurance Corporation"), - ("Federal Communications Commission", "Federal Communications Commission"), - ("Federal Deposit Insurance Corporation", "Federal Deposit Insurance Corporation"), - ("Federal Election Commission", "Federal Election Commission"), - ("Federal Energy Regulatory Commission", "Federal Energy Regulatory Commission"), - ( - "Federal Financial Institutions Examination Council", - "Federal Financial Institutions Examination Council", - ), - ("Federal Housing Finance Agency", "Federal Housing Finance Agency"), - ("Federal Judiciary", "Federal Judiciary"), - ("Federal Labor Relations Authority", "Federal Labor Relations Authority"), - ("Federal Maritime Commission", "Federal Maritime Commission"), - ( - "Federal Mediation and Conciliation Service", - "Federal Mediation and Conciliation Service", - ), - ( - "Federal Mine Safety and Health Review Commission", - "Federal Mine Safety and Health Review Commission", - ), - ( - "Federal Permitting Improvement Steering Council", - "Federal Permitting Improvement Steering Council", - ), - ("Federal Reserve Board of Governors", "Federal Reserve Board of Governors"), - ("Federal Reserve System", "Federal Reserve System"), - ("Federal Trade Commission", "Federal Trade Commission"), - ("General Services Administration", "General Services Administration"), - ("gov Administration", "gov Administration"), - ("Government Accountability Office", "Government Accountability Office"), - ("Government Publishing Office", "Government Publishing Office"), - ("Gulf Coast Ecosystem Restoration Council", "Gulf Coast Ecosystem Restoration Council"), - ("Harry S Truman Scholarship Foundation", "Harry S Truman Scholarship Foundation"), - ("Harry S. Truman Scholarship Foundation", "Harry S. Truman Scholarship Foundation"), - ("Institute of Museum and Library Services", "Institute of Museum and Library Services"), - ("Institute of Peace", "Institute of Peace"), - ("Inter-American Foundation", "Inter-American Foundation"), - ( - "International Boundary and Water Commission: United States and Mexico", - "International Boundary and Water Commission: United States and Mexico", - ), - ( - "International Boundary Commission: United States and Canada", - "International Boundary Commission: United States and Canada", - ), - ( - "International Joint Commission: United States and Canada", - "International Joint Commission: United States and Canada", - ), - ( - "James Madison Memorial Fellowship Foundation", - "James Madison Memorial Fellowship Foundation", - ), - ("Japan-United States Friendship Commission", "Japan-United States Friendship Commission"), - ("Japan-US Friendship Commission", "Japan-US Friendship Commission"), - ( - "John F. Kennedy Center for Performing Arts", - "John F. Kennedy Center for Performing Arts", - ), - ( - "John F. Kennedy Center for the Performing Arts", - "John F. Kennedy Center for the Performing Arts", - ), - ("Legal Services Corporation", "Legal Services Corporation"), - ("Legislative Branch", "Legislative Branch"), - ("Library of Congress", "Library of Congress"), - ("Marine Mammal Commission", "Marine Mammal Commission"), - ( - "Medicaid and CHIP Payment and Access Commission", - "Medicaid and CHIP Payment and Access Commission", - ), - ("Medical Payment Advisory Commission", "Medical Payment Advisory Commission"), - ("Medicare Payment Advisory Commission", "Medicare Payment Advisory Commission"), - ("Merit Systems Protection Board", "Merit Systems Protection Board"), - ("Millennium Challenge Corporation", "Millennium Challenge Corporation"), - ( - "Morris K. Udall and Stewart L. Udall Foundation", - "Morris K. Udall and Stewart L. Udall Foundation", - ), - ( - "National Aeronautics and Space Administration", - "National Aeronautics and Space Administration", - ), - ( - "National Archives and Records Administration", - "National Archives and Records Administration", - ), - ("National Capital Planning Commission", "National Capital Planning Commission"), - ("National Council on Disability", "National Council on Disability"), - ("National Credit Union Administration", "National Credit Union Administration"), - ("National Endowment for the Arts", "National Endowment for the Arts"), - ("National Endowment for the Humanities", "National Endowment for the Humanities"), - ( - "National Foundation on the Arts and the Humanities", - "National Foundation on the Arts and the Humanities", - ), - ("National Gallery of Art", "National Gallery of Art"), - ("National Indian Gaming Commission", "National Indian Gaming Commission"), - ("National Labor Relations Board", "National Labor Relations Board"), - ("National Mediation Board", "National Mediation Board"), - ("National Science Foundation", "National Science Foundation"), - ( - "National Security Commission on Artificial Intelligence", - "National Security Commission on Artificial Intelligence", - ), - ("National Transportation Safety Board", "National Transportation Safety Board"), - ( - "Networking Information Technology Research and Development", - "Networking Information Technology Research and Development", - ), - ("Non-Federal Agency", "Non-Federal Agency"), - ("Northern Border Regional Commission", "Northern Border Regional Commission"), - ("Nuclear Regulatory Commission", "Nuclear Regulatory Commission"), - ("Nuclear Safety Oversight Committee", "Nuclear Safety Oversight Committee"), - ("Nuclear Waste Technical Review Board", "Nuclear Waste Technical Review Board"), - ( - "Occupational Safety & Health Review Commission", - "Occupational Safety & Health Review Commission", - ), - ( - "Occupational Safety and Health Review Commission", - "Occupational Safety and Health Review Commission", - ), - ("Office of Compliance", "Office of Compliance"), - ("Office of Congressional Workplace Rights", "Office of Congressional Workplace Rights"), - ("Office of Government Ethics", "Office of Government Ethics"), - ( - "Office of Navajo and Hopi Indian Relocation", - "Office of Navajo and Hopi Indian Relocation", - ), - ("Office of Personnel Management", "Office of Personnel Management"), - ("Open World Leadership Center", "Open World Leadership Center"), - ("Overseas Private Investment Corporation", "Overseas Private Investment Corporation"), - ("Peace Corps", "Peace Corps"), - ("Pension Benefit Guaranty Corporation", "Pension Benefit Guaranty Corporation"), - ("Postal Regulatory Commission", "Postal Regulatory Commission"), - ("Presidio Trust", "Presidio Trust"), - ( - "Privacy and Civil Liberties Oversight Board", - "Privacy and Civil Liberties Oversight Board", - ), - ("Public Buildings Reform Board", "Public Buildings Reform Board"), - ( - "Public Defender Service for the District of Columbia", - "Public Defender Service for the District of Columbia", - ), - ("Railroad Retirement Board", "Railroad Retirement Board"), - ("Securities and Exchange Commission", "Securities and Exchange Commission"), - ("Selective Service System", "Selective Service System"), - ("Small Business Administration", "Small Business Administration"), - ("Smithsonian Institution", "Smithsonian Institution"), - ("Social Security Administration", "Social Security Administration"), - ("Social Security Advisory Board", "Social Security Advisory Board"), - ("Southeast Crescent Regional Commission", "Southeast Crescent Regional Commission"), - ("Southwest Border Regional Commission", "Southwest Border Regional Commission"), - ("State Justice Institute", "State Justice Institute"), - ("State, Local, and Tribal Government", "State, Local, and Tribal Government"), - ("Stennis Center for Public Service", "Stennis Center for Public Service"), - ("Surface Transportation Board", "Surface Transportation Board"), - ("Tennessee Valley Authority", "Tennessee Valley Authority"), - ("The Executive Office of the President", "The Executive Office of the President"), - ("The Intelligence Community", "The Intelligence Community"), - ("The Legislative Branch", "The Legislative Branch"), - ("The Supreme Court", "The Supreme Court"), - ( - "The United States World War One Centennial Commission", - "The United States World War One Centennial Commission", - ), - ("U.S. Access Board", "U.S. Access Board"), - ("U.S. Agency for Global Media", "U.S. Agency for Global Media"), - ("U.S. Agency for International Development", "U.S. Agency for International Development"), - ("U.S. Capitol Police", "U.S. Capitol Police"), - ("U.S. Chemical Safety Board", "U.S. Chemical Safety Board"), - ( - "U.S. China Economic and Security Review Commission", - "U.S. China Economic and Security Review Commission", - ), - ( - "U.S. Commission for the Preservation of Americas Heritage Abroad", - "U.S. Commission for the Preservation of Americas Heritage Abroad", - ), - ("U.S. Commission of Fine Arts", "U.S. Commission of Fine Arts"), - ("U.S. Commission on Civil Rights", "U.S. Commission on Civil Rights"), - ( - "U.S. Commission on International Religious Freedom", - "U.S. Commission on International Religious Freedom", - ), - ("U.S. Courts", "U.S. Courts"), - ("U.S. Department of Agriculture", "U.S. Department of Agriculture"), - ("U.S. Interagency Council on Homelessness", "U.S. Interagency Council on Homelessness"), - ("U.S. International Trade Commission", "U.S. International Trade Commission"), - ("U.S. Nuclear Waste Technical Review Board", "U.S. Nuclear Waste Technical Review Board"), - ("U.S. Office of Special Counsel", "U.S. Office of Special Counsel"), - ("U.S. Peace Corps", "U.S. Peace Corps"), - ("U.S. Postal Service", "U.S. Postal Service"), - ("U.S. Semiquincentennial Commission", "U.S. Semiquincentennial Commission"), - ("U.S. Trade and Development Agency", "U.S. Trade and Development Agency"), - ( - "U.S.-China Economic and Security Review Commission", - "U.S.-China Economic and Security Review Commission", - ), - ("Udall Foundation", "Udall Foundation"), - ("United States AbilityOne", "United States AbilityOne"), - ("United States Access Board", "United States Access Board"), - ( - "United States African Development Foundation", - "United States African Development Foundation", - ), - ("United States Agency for Global Media", "United States Agency for Global Media"), - ("United States Arctic Research Commission", "United States Arctic Research Commission"), - ( - "United States Global Change Research Program", - "United States Global Change Research Program", - ), - ("United States Holocaust Memorial Museum", "United States Holocaust Memorial Museum"), - ("United States Institute of Peace", "United States Institute of Peace"), - ( - "United States Interagency Council on Homelessness", - "United States Interagency Council on Homelessness", - ), - ( - "United States International Development Finance Corporation", - "United States International Development Finance Corporation", - ), - ( - "United States International Trade Commission", - "United States International Trade Commission", - ), - ("United States Postal Service", "United States Postal Service"), - ("United States Senate", "United States Senate"), - ( - "United States Trade and Development Agency", - "United States Trade and Development Agency", - ), - ( - "Utah Reclamation Mitigation and Conservation Commission", - "Utah Reclamation Mitigation and Conservation Commission", - ), - ("Vietnam Education Foundation", "Vietnam Education Foundation"), - ("Western Hemisphere Drug Policy Commission", "Western Hemisphere Drug Policy Commission"), - ( - "Woodrow Wilson International Center for Scholars", - "Woodrow Wilson International Center for Scholars", - ), - ("World War I Centennial Commission", "World War I Centennial Commission"), - ], - help_text="Federal agency", - null=True, - ), - ), - ( - "federal_type", - models.CharField( - blank=True, - choices=[("executive", "Executive"), ("judicial", "Judicial"), ("legislative", "Legislative")], - help_text="Federal government branch", - max_length=50, - null=True, - ), - ), - ( - "is_election_board", - models.BooleanField(blank=True, help_text="Is your organization an election office?", null=True), - ), - ( - "organization_name", - models.CharField(blank=True, db_index=True, help_text="Organization name", null=True), - ), - ( - "address_line1", - models.CharField(blank=True, help_text="Street address", null=True, verbose_name="Address line 1"), - ), - ( - "address_line2", - models.CharField( - blank=True, - help_text="Street address line 2 (optional)", - null=True, - verbose_name="Address line 2", - ), - ), - ("city", models.CharField(blank=True, help_text="City", null=True)), - ( - "state_territory", - models.CharField( - blank=True, - choices=[ - ("AL", "Alabama (AL)"), - ("AK", "Alaska (AK)"), - ("AS", "American Samoa (AS)"), - ("AZ", "Arizona (AZ)"), - ("AR", "Arkansas (AR)"), - ("CA", "California (CA)"), - ("CO", "Colorado (CO)"), - ("CT", "Connecticut (CT)"), - ("DE", "Delaware (DE)"), - ("DC", "District of Columbia (DC)"), - ("FL", "Florida (FL)"), - ("GA", "Georgia (GA)"), - ("GU", "Guam (GU)"), - ("HI", "Hawaii (HI)"), - ("ID", "Idaho (ID)"), - ("IL", "Illinois (IL)"), - ("IN", "Indiana (IN)"), - ("IA", "Iowa (IA)"), - ("KS", "Kansas (KS)"), - ("KY", "Kentucky (KY)"), - ("LA", "Louisiana (LA)"), - ("ME", "Maine (ME)"), - ("MD", "Maryland (MD)"), - ("MA", "Massachusetts (MA)"), - ("MI", "Michigan (MI)"), - ("MN", "Minnesota (MN)"), - ("MS", "Mississippi (MS)"), - ("MO", "Missouri (MO)"), - ("MT", "Montana (MT)"), - ("NE", "Nebraska (NE)"), - ("NV", "Nevada (NV)"), - ("NH", "New Hampshire (NH)"), - ("NJ", "New Jersey (NJ)"), - ("NM", "New Mexico (NM)"), - ("NY", "New York (NY)"), - ("NC", "North Carolina (NC)"), - ("ND", "North Dakota (ND)"), - ("MP", "Northern Mariana Islands (MP)"), - ("OH", "Ohio (OH)"), - ("OK", "Oklahoma (OK)"), - ("OR", "Oregon (OR)"), - ("PA", "Pennsylvania (PA)"), - ("PR", "Puerto Rico (PR)"), - ("RI", "Rhode Island (RI)"), - ("SC", "South Carolina (SC)"), - ("SD", "South Dakota (SD)"), - ("TN", "Tennessee (TN)"), - ("TX", "Texas (TX)"), - ("UM", "United States Minor Outlying Islands (UM)"), - ("UT", "Utah (UT)"), - ("VT", "Vermont (VT)"), - ("VI", "Virgin Islands (VI)"), - ("VA", "Virginia (VA)"), - ("WA", "Washington (WA)"), - ("WV", "West Virginia (WV)"), - ("WI", "Wisconsin (WI)"), - ("WY", "Wyoming (WY)"), - ("AA", "Armed Forces Americas (AA)"), - ("AE", "Armed Forces Africa, Canada, Europe, Middle East (AE)"), - ("AP", "Armed Forces Pacific (AP)"), - ], - help_text="State, territory, or military post", - max_length=2, - null=True, - ), - ), - ( - "zipcode", - models.CharField(blank=True, db_index=True, help_text="Zip code", max_length=10, null=True), - ), - ( - "urbanization", - models.CharField(blank=True, help_text="Urbanization (required for Puerto Rico only)", null=True), - ), - ( - "about_your_organization", - models.TextField(blank=True, help_text="Information about your organization", null=True), - ), - ("purpose", models.TextField(blank=True, help_text="Purpose of your domain", null=True)), - ( - "no_other_contacts_rationale", - models.TextField(blank=True, help_text="Reason for listing no additional contacts", null=True), - ), - ("anything_else", models.TextField(blank=True, help_text="Anything else?", null=True)), - ( - "is_policy_acknowledged", - models.BooleanField(blank=True, help_text="Acknowledged .gov acceptable use policy", null=True), - ), - ("submission_date", models.DateField(blank=True, default=None, help_text="Date submitted", null=True)), - ("notes", models.TextField(blank=True, help_text="Notes about this request", null=True)), - ( - "alternative_domains", - models.ManyToManyField(blank=True, related_name="alternatives+", to="registrar.website"), - ), - ( - "approved_domain", - models.OneToOneField( - blank=True, - help_text="The approved domain", - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="domain_request", - to="registrar.domain", - ), - ), - ( - "authorizing_official", - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="authorizing_official", - to="registrar.contact", - ), - ), - ( - "creator", - models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="domain_requests_created", - to=settings.AUTH_USER_MODEL, - ), - ), - ( - "current_websites", - models.ManyToManyField( - blank=True, related_name="current+", to="registrar.website", verbose_name="websites" - ), - ), - ( - "investigator", - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="domain_requests_investigating", - to=settings.AUTH_USER_MODEL, - ), - ), - ( - "other_contacts", - models.ManyToManyField( - blank=True, - related_name="contact_domain_requests", - to="registrar.contact", - verbose_name="contacts", - ), - ), - ( - "requested_domain", - models.OneToOneField( - blank=True, - help_text="The requested domain", - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="domain_request", - to="registrar.draftdomain", - ), - ), - ( - "submitter", - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="submitted_domain_requests", - to="registrar.contact", - ), - ), - ], - options={ - "abstract": False, - }, - ), - migrations.RemoveField( - model_name="domaininformation", - name="domain_application", - ), - migrations.AlterField( - model_name="domaininformation", - name="other_contacts", - field=models.ManyToManyField( - blank=True, - related_name="contact_domain_requests_information", - to="registrar.contact", - verbose_name="contacts", - ), - ), - migrations.AlterField( - model_name="domaininformation", - name="submitter", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="submitted_domain_requests_information", - to="registrar.contact", - ), - ), - migrations.DeleteModel( - name="DomainApplication", - ), - migrations.AddField( - model_name="domaininformation", - name="domain_request", - field=models.OneToOneField( - blank=True, - help_text="Associated domain request", - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="DomainRequest_info", - to="registrar.domainrequest", - ), - ), - ] diff --git a/src/registrar/migrations/0074_create_groups_v08.py b/src/registrar/migrations/0074_create_groups_v08.py deleted file mode 100644 index 0c28cee52..000000000 --- a/src/registrar/migrations/0074_create_groups_v08.py +++ /dev/null @@ -1,37 +0,0 @@ -# This migration creates the create_full_access_group and create_cisa_analyst_group groups -# It is dependent on 0035 (which populates ContentType and Permissions) -# If permissions on the groups need changing, edit CISA_ANALYST_GROUP_PERMISSIONS -# in the user_group model then: -# [NOT RECOMMENDED] -# step 1: docker-compose exec app ./manage.py migrate --fake registrar 0035_contenttypes_permissions -# step 2: docker-compose exec app ./manage.py migrate registrar 0036_create_groups -# step 3: fake run the latest migration in the migrations list -# [RECOMMENDED] -# Alternatively: -# step 1: duplicate the migration that loads data -# step 2: docker-compose exec app ./manage.py migrate - -from django.db import migrations -from registrar.models import UserGroup -from typing import Any - - -# For linting: RunPython expects a function reference, -# so let's give it one -def create_groups(apps, schema_editor) -> Any: - UserGroup.create_cisa_analyst_group(apps, schema_editor) - UserGroup.create_full_access_group(apps, schema_editor) - - -class Migration(migrations.Migration): - dependencies = [ - ("registrar", "0073_domainrequest_and_more"), - ] - - operations = [ - migrations.RunPython( - create_groups, - reverse_code=migrations.RunPython.noop, - atomic=True, - ), - ] diff --git a/src/registrar/models/__init__.py b/src/registrar/models/__init__.py index d203421ac..d9ccd64cb 100644 --- a/src/registrar/models/__init__.py +++ b/src/registrar/models/__init__.py @@ -1,6 +1,6 @@ from auditlog.registry import auditlog # type: ignore from .contact import Contact -from .domain_request import DomainRequest +from .domain_application import DomainApplication from .domain_information import DomainInformation from .domain import Domain from .draft_domain import DraftDomain @@ -17,7 +17,7 @@ from .verified_by_staff import VerifiedByStaff __all__ = [ "Contact", - "DomainRequest", + "DomainApplication", "DomainInformation", "Domain", "DraftDomain", @@ -34,7 +34,7 @@ __all__ = [ ] auditlog.register(Contact) -auditlog.register(DomainRequest) +auditlog.register(DomainApplication) auditlog.register(Domain) auditlog.register(DraftDomain) auditlog.register(DomainInvitation) diff --git a/src/registrar/models/domain.py b/src/registrar/models/domain.py index 079fce3bc..449c4c4bb 100644 --- a/src/registrar/models/domain.py +++ b/src/registrar/models/domain.py @@ -897,8 +897,8 @@ class Domain(TimeStampedModel, DomainHelper): def security_contact(self, contact: PublicContact): """makes the contact in the registry, for security the public contact should have the org or registrant information - from domain information (not domain request) - and should have the security email from DomainRequest""" + from domain information (not domain application) + and should have the security email from DomainApplication""" logger.info("making security contact in registry") self._set_singleton_contact(contact, expectedType=contact.ContactTypeChoices.SECURITY) diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_application.py similarity index 86% rename from src/registrar/models/domain_request.py rename to src/registrar/models/domain_application.py index 417713197..8c417b51a 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_application.py @@ -17,11 +17,11 @@ from itertools import chain logger = logging.getLogger(__name__) -class DomainRequest(TimeStampedModel): - """A registrant's domain request for a new domain.""" +class DomainApplication(TimeStampedModel): + """A registrant's application for a new domain.""" # Constants for choice fields - class DomainRequestStatus(models.TextChoices): + class ApplicationStatus(models.TextChoices): STARTED = "started", "Started" SUBMITTED = "submitted", "Submitted" IN_REVIEW = "in review", "In review" @@ -115,7 +115,7 @@ class DomainRequest(TimeStampedModel): class OrganizationChoicesVerbose(models.TextChoices): """ Secondary organization choices - For use in the domain request form and on the templates + For use in the application form and on the templates Keys need to match OrganizationChoices """ @@ -366,10 +366,10 @@ class DomainRequest(TimeStampedModel): NAMING_REQUIREMENTS = "naming_not_met", "Naming requirements not met" OTHER = "other", "Other/Unspecified" - # #### Internal fields about the domain request ##### + # #### Internal fields about the application ##### status = FSMField( - choices=DomainRequestStatus.choices, # possible states as an array of constants - default=DomainRequestStatus.STARTED, # sensible default + choices=ApplicationStatus.choices, # possible states as an array of constants + default=ApplicationStatus.STARTED, # sensible default protected=False, # can change state directly, particularly in Django admin ) @@ -379,12 +379,12 @@ class DomainRequest(TimeStampedModel): blank=True, ) - # This is the domain request user who created this domain request. The contact + # This is the application user who created this application. The contact # information that they gave is in the `submitter` field creator = models.ForeignKey( "registrar.User", on_delete=models.PROTECT, - related_name="domain_requests_created", + related_name="applications_created", ) investigator = models.ForeignKey( @@ -392,7 +392,7 @@ class DomainRequest(TimeStampedModel): null=True, blank=True, on_delete=models.SET_NULL, - related_name="domain_requests_investigating", + related_name="applications_investigating", ) # ##### data fields from the initial form ##### @@ -499,7 +499,7 @@ class DomainRequest(TimeStampedModel): on_delete=models.PROTECT, ) - # "+" means no reverse relation to lookup domain requests from Website + # "+" means no reverse relation to lookup applications from Website current_websites = models.ManyToManyField( "registrar.Website", blank=True, @@ -512,7 +512,7 @@ class DomainRequest(TimeStampedModel): null=True, blank=True, help_text="The approved domain", - related_name="domain_request", + related_name="domain_application", on_delete=models.SET_NULL, ) @@ -521,7 +521,7 @@ class DomainRequest(TimeStampedModel): null=True, blank=True, help_text="The requested domain", - related_name="domain_request", + related_name="domain_application", on_delete=models.PROTECT, ) alternative_domains = models.ManyToManyField( @@ -530,13 +530,13 @@ class DomainRequest(TimeStampedModel): related_name="alternatives+", ) - # This is the contact information provided by the domain requestor. The - # user who created the domain request is in the `creator` field. + # This is the contact information provided by the applicant. The + # application user who created it is in the `creator` field. submitter = models.ForeignKey( "registrar.Contact", null=True, blank=True, - related_name="submitted_domain_requests", + related_name="submitted_applications", on_delete=models.PROTECT, ) @@ -549,7 +549,7 @@ class DomainRequest(TimeStampedModel): other_contacts = models.ManyToManyField( "registrar.Contact", blank=True, - related_name="contact_domain_requests", + related_name="contact_applications", verbose_name="contacts", ) @@ -571,7 +571,7 @@ class DomainRequest(TimeStampedModel): help_text="Acknowledged .gov acceptable use policy", ) - # submission date records when domain request is submitted + # submission date records when application is submitted submission_date = models.DateField( null=True, blank=True, @@ -590,7 +590,7 @@ class DomainRequest(TimeStampedModel): if self.requested_domain and self.requested_domain.name: return self.requested_domain.name else: - return f"{self.status} domain request created by {self.creator}" + return f"{self.status} application created by {self.creator}" except Exception: return "" @@ -638,7 +638,7 @@ class DomainRequest(TimeStampedModel): email_template, email_template_subject, self.submitter.email, - context={"domain_request": self}, + context={"application": self}, bcc_address=bcc_address, ) logger.info(f"The {new_status} email sent to: {self.submitter.email}") @@ -648,15 +648,15 @@ class DomainRequest(TimeStampedModel): @transition( field="status", source=[ - DomainRequestStatus.STARTED, - DomainRequestStatus.IN_REVIEW, - DomainRequestStatus.ACTION_NEEDED, - DomainRequestStatus.WITHDRAWN, + ApplicationStatus.STARTED, + ApplicationStatus.IN_REVIEW, + ApplicationStatus.ACTION_NEEDED, + ApplicationStatus.WITHDRAWN, ], - target=DomainRequestStatus.SUBMITTED, + target=ApplicationStatus.SUBMITTED, ) def submit(self): - """Submit a domain request that is started. + """Submit an application that is started. As a side effect, an email notification is sent.""" @@ -679,7 +679,7 @@ class DomainRequest(TimeStampedModel): self.save() # Limit email notifications to transitions from Started and Withdrawn - limited_statuses = [self.DomainRequestStatus.STARTED, self.DomainRequestStatus.WITHDRAWN] + limited_statuses = [self.ApplicationStatus.STARTED, self.ApplicationStatus.WITHDRAWN] bcc_address = "" if settings.IS_PRODUCTION: @@ -697,17 +697,17 @@ class DomainRequest(TimeStampedModel): @transition( field="status", source=[ - DomainRequestStatus.SUBMITTED, - DomainRequestStatus.ACTION_NEEDED, - DomainRequestStatus.APPROVED, - DomainRequestStatus.REJECTED, - DomainRequestStatus.INELIGIBLE, + ApplicationStatus.SUBMITTED, + ApplicationStatus.ACTION_NEEDED, + ApplicationStatus.APPROVED, + ApplicationStatus.REJECTED, + ApplicationStatus.INELIGIBLE, ], - target=DomainRequestStatus.IN_REVIEW, + target=ApplicationStatus.IN_REVIEW, conditions=[domain_is_not_active], ) def in_review(self): - """Investigate a domain request that has been submitted. + """Investigate an application that has been submitted. This action is logged. @@ -716,13 +716,13 @@ class DomainRequest(TimeStampedModel): As side effects this will delete the domain and domain_information (will cascade) when they exist.""" - if self.status == self.DomainRequestStatus.APPROVED: + if self.status == self.ApplicationStatus.APPROVED: self.delete_and_clean_up_domain("in_review") - if self.status == self.DomainRequestStatus.REJECTED: + if self.status == self.ApplicationStatus.REJECTED: self.rejection_reason = None - literal = DomainRequest.DomainRequestStatus.IN_REVIEW + literal = DomainApplication.ApplicationStatus.IN_REVIEW # Check if the tuple exists, then grab its value in_review = literal if literal is not None else "In Review" logger.info(f"A status change occurred. {self} was changed to '{in_review}'") @@ -730,16 +730,16 @@ class DomainRequest(TimeStampedModel): @transition( field="status", source=[ - DomainRequestStatus.IN_REVIEW, - DomainRequestStatus.APPROVED, - DomainRequestStatus.REJECTED, - DomainRequestStatus.INELIGIBLE, + ApplicationStatus.IN_REVIEW, + ApplicationStatus.APPROVED, + ApplicationStatus.REJECTED, + ApplicationStatus.INELIGIBLE, ], - target=DomainRequestStatus.ACTION_NEEDED, + target=ApplicationStatus.ACTION_NEEDED, conditions=[domain_is_not_active], ) def action_needed(self): - """Send back a domain request that is under investigation or rejected. + """Send back an application that is under investigation or rejected. This action is logged. @@ -748,13 +748,13 @@ class DomainRequest(TimeStampedModel): As side effects this will delete the domain and domain_information (will cascade) when they exist.""" - if self.status == self.DomainRequestStatus.APPROVED: + if self.status == self.ApplicationStatus.APPROVED: self.delete_and_clean_up_domain("reject_with_prejudice") - if self.status == self.DomainRequestStatus.REJECTED: + if self.status == self.ApplicationStatus.REJECTED: self.rejection_reason = None - literal = DomainRequest.DomainRequestStatus.ACTION_NEEDED + literal = DomainApplication.ApplicationStatus.ACTION_NEEDED # Check if the tuple is setup correctly, then grab its value action_needed = literal if literal is not None else "Action Needed" logger.info(f"A status change occurred. {self} was changed to '{action_needed}'") @@ -762,21 +762,21 @@ class DomainRequest(TimeStampedModel): @transition( field="status", source=[ - DomainRequestStatus.SUBMITTED, - DomainRequestStatus.IN_REVIEW, - DomainRequestStatus.ACTION_NEEDED, - DomainRequestStatus.REJECTED, + ApplicationStatus.SUBMITTED, + ApplicationStatus.IN_REVIEW, + ApplicationStatus.ACTION_NEEDED, + ApplicationStatus.REJECTED, ], - target=DomainRequestStatus.APPROVED, + target=ApplicationStatus.APPROVED, ) def approve(self, send_email=True): - """Approve a domain request that has been submitted. + """Approve an application that has been submitted. This action cleans up the rejection status if moving away from rejected. This has substantial side-effects because it creates another database object for the approved Domain and makes the user who created the - domain request into an admin on that domain. It also triggers an email + application into an admin on that domain. It also triggers an email notification.""" # create the domain @@ -786,9 +786,9 @@ class DomainRequest(TimeStampedModel): created_domain = Domain.objects.create(name=self.requested_domain.name) self.approved_domain = created_domain - # copy the information from DomainRequest into domaininformation + # copy the information from domainapplication into domaininformation DomainInformation = apps.get_model("registrar.DomainInformation") - DomainInformation.create_from_da(domain_request=self, domain=created_domain) + DomainInformation.create_from_da(domain_application=self, domain=created_domain) # create the permission for the user UserDomainRole = apps.get_model("registrar.UserDomainRole") @@ -796,11 +796,11 @@ class DomainRequest(TimeStampedModel): user=self.creator, domain=created_domain, role=UserDomainRole.Roles.MANAGER ) - if self.status == self.DomainRequestStatus.REJECTED: + if self.status == self.ApplicationStatus.REJECTED: self.rejection_reason = None self._send_status_update_email( - "domain request approved", + "application approved", "emails/status_change_approved.txt", "emails/status_change_approved_subject.txt", send_email, @@ -808,11 +808,11 @@ class DomainRequest(TimeStampedModel): @transition( field="status", - source=[DomainRequestStatus.SUBMITTED, DomainRequestStatus.IN_REVIEW, DomainRequestStatus.ACTION_NEEDED], - target=DomainRequestStatus.WITHDRAWN, + source=[ApplicationStatus.SUBMITTED, ApplicationStatus.IN_REVIEW, ApplicationStatus.ACTION_NEEDED], + target=ApplicationStatus.WITHDRAWN, ) def withdraw(self): - """Withdraw a domain request that has been submitted.""" + """Withdraw an application that has been submitted.""" self._send_status_update_email( "withdraw", @@ -822,17 +822,17 @@ class DomainRequest(TimeStampedModel): @transition( field="status", - source=[DomainRequestStatus.IN_REVIEW, DomainRequestStatus.ACTION_NEEDED, DomainRequestStatus.APPROVED], - target=DomainRequestStatus.REJECTED, + source=[ApplicationStatus.IN_REVIEW, ApplicationStatus.ACTION_NEEDED, ApplicationStatus.APPROVED], + target=ApplicationStatus.REJECTED, conditions=[domain_is_not_active], ) def reject(self): - """Reject a domain request that has been submitted. + """Reject an application that has been submitted. As side effects this will delete the domain and domain_information (will cascade), and send an email notification.""" - if self.status == self.DomainRequestStatus.APPROVED: + if self.status == self.ApplicationStatus.APPROVED: self.delete_and_clean_up_domain("reject") self._send_status_update_email( @@ -844,24 +844,24 @@ class DomainRequest(TimeStampedModel): @transition( field="status", source=[ - DomainRequestStatus.IN_REVIEW, - DomainRequestStatus.ACTION_NEEDED, - DomainRequestStatus.APPROVED, - DomainRequestStatus.REJECTED, + ApplicationStatus.IN_REVIEW, + ApplicationStatus.ACTION_NEEDED, + ApplicationStatus.APPROVED, + ApplicationStatus.REJECTED, ], - target=DomainRequestStatus.INELIGIBLE, + target=ApplicationStatus.INELIGIBLE, conditions=[domain_is_not_active], ) def reject_with_prejudice(self): """The applicant is a bad actor, reject with prejudice. No email As a side effect, but we block the applicant from editing - any existing domains/domain requests and from submitting new aplications. + any existing domains/applications and from submitting new aplications. We do this by setting an ineligible status on the user, which the permissions classes test against. This will also delete the domain and domain_information (will cascade) when they exist.""" - if self.status == self.DomainRequestStatus.APPROVED: + if self.status == self.ApplicationStatus.APPROVED: self.delete_and_clean_up_domain("reject_with_prejudice") self.creator.restrict_user() @@ -869,18 +869,18 @@ class DomainRequest(TimeStampedModel): # ## Form policies ### # # These methods control what questions need to be answered by applicants - # during the domain request flow. They are policies about the domain request so + # during the application flow. They are policies about the application so # they appear here. def show_organization_federal(self) -> bool: """Show this step if the answer to the first question was "federal".""" user_choice = self.organization_type - return user_choice == DomainRequest.OrganizationChoices.FEDERAL + return user_choice == DomainApplication.OrganizationChoices.FEDERAL def show_tribal_government(self) -> bool: """Show this step if the answer to the first question was "tribal".""" user_choice = self.organization_type - return user_choice == DomainRequest.OrganizationChoices.TRIBAL + return user_choice == DomainApplication.OrganizationChoices.TRIBAL def show_organization_election(self) -> bool: """Show this step if the answer to the first question implies it. @@ -890,9 +890,9 @@ class DomainRequest(TimeStampedModel): """ user_choice = self.organization_type excluded = [ - DomainRequest.OrganizationChoices.FEDERAL, - DomainRequest.OrganizationChoices.INTERSTATE, - DomainRequest.OrganizationChoices.SCHOOL_DISTRICT, + DomainApplication.OrganizationChoices.FEDERAL, + DomainApplication.OrganizationChoices.INTERSTATE, + DomainApplication.OrganizationChoices.SCHOOL_DISTRICT, ] return bool(user_choice and user_choice not in excluded) @@ -900,27 +900,27 @@ class DomainRequest(TimeStampedModel): """Show this step if this is a special district or interstate.""" user_choice = self.organization_type return user_choice in [ - DomainRequest.OrganizationChoices.SPECIAL_DISTRICT, - DomainRequest.OrganizationChoices.INTERSTATE, + DomainApplication.OrganizationChoices.SPECIAL_DISTRICT, + DomainApplication.OrganizationChoices.INTERSTATE, ] def has_rationale(self) -> bool: - """Does this domain request have no_other_contacts_rationale?""" + """Does this application have no_other_contacts_rationale?""" return bool(self.no_other_contacts_rationale) def has_other_contacts(self) -> bool: - """Does this domain request have other contacts listed?""" + """Does this application have other contacts listed?""" return self.other_contacts.exists() def is_federal(self) -> Union[bool, None]: - """Is this domain request for a federal agency? + """Is this application for a federal agency? organization_type can be both null and blank, """ if not self.organization_type: # organization_type is either blank or None, can't answer return None - if self.organization_type == DomainRequest.OrganizationChoices.FEDERAL: + if self.organization_type == DomainApplication.OrganizationChoices.FEDERAL: return True return False diff --git a/src/registrar/models/domain_information.py b/src/registrar/models/domain_information.py index 77a072ae9..861171c5c 100644 --- a/src/registrar/models/domain_information.py +++ b/src/registrar/models/domain_information.py @@ -2,7 +2,7 @@ from __future__ import annotations from django.db import transaction from registrar.models.utility.domain_helper import DomainHelper -from .domain_request import DomainRequest +from .domain_application import DomainApplication from .utility.time_stamped_model import TimeStampedModel import logging @@ -15,22 +15,22 @@ logger = logging.getLogger(__name__) class DomainInformation(TimeStampedModel): """A registrant's domain information for that domain, exported from - DomainRequest. We use these field from DomainRequest with few exceptions + DomainApplication. We use these field from DomainApplication with few exceptions which are 'removed' via pop at the bottom of this file. Most of design for domain - management's user information are based on domain_request, but we cannot change - the domain request once approved, so copying them that way we can make changes - after its approved. Most fields here are copied from DomainRequest.""" + management's user information are based on application, but we cannot change + the application once approved, so copying them that way we can make changes + after its approved. Most fields here are copied from Application.""" - StateTerritoryChoices = DomainRequest.StateTerritoryChoices + StateTerritoryChoices = DomainApplication.StateTerritoryChoices # use the short names in Django admin - OrganizationChoices = DomainRequest.OrganizationChoices + OrganizationChoices = DomainApplication.OrganizationChoices - BranchChoices = DomainRequest.BranchChoices + BranchChoices = DomainApplication.BranchChoices - AGENCY_CHOICES = DomainRequest.AGENCY_CHOICES + AGENCY_CHOICES = DomainApplication.AGENCY_CHOICES - # This is the domain request user who created this domain request. The contact + # This is the application user who created this application. The contact # information that they gave is in the `submitter` field creator = models.ForeignKey( "registrar.User", @@ -38,13 +38,13 @@ class DomainInformation(TimeStampedModel): related_name="information_created", ) - domain_request = models.OneToOneField( - "registrar.DomainRequest", + domain_application = models.OneToOneField( + "registrar.DomainApplication", on_delete=models.PROTECT, blank=True, null=True, - related_name="DomainRequest_info", - help_text="Associated domain request", + related_name="domainapplication_info", + help_text="Associated domain application", unique=True, ) @@ -163,13 +163,13 @@ class DomainInformation(TimeStampedModel): help_text="Domain to which this information belongs", ) - # This is the contact information provided by the domain requestor. The - # user who created the domain request is in the `creator` field. + # This is the contact information provided by the applicant. The + # application user who created it is in the `creator` field. submitter = models.ForeignKey( "registrar.Contact", null=True, blank=True, - related_name="submitted_domain_requests_information", + related_name="submitted_applications_information", on_delete=models.PROTECT, ) @@ -182,7 +182,7 @@ class DomainInformation(TimeStampedModel): other_contacts = models.ManyToManyField( "registrar.Contact", blank=True, - related_name="contact_domain_requests_information", + related_name="contact_applications_information", verbose_name="contacts", ) @@ -220,25 +220,25 @@ class DomainInformation(TimeStampedModel): return "" @classmethod - def create_from_da(cls, domain_request: DomainRequest, domain=None): - """Takes in a DomainRequest and converts it into DomainInformation""" + def create_from_da(cls, domain_application: DomainApplication, domain=None): + """Takes in a DomainApplication and converts it into DomainInformation""" # Throw an error if we get None - we can't create something from nothing - if domain_request is None: - raise ValueError("The provided DomainRequest is None") + if domain_application is None: + raise ValueError("The provided DomainApplication is None") # Throw an error if the da doesn't have an id - if not hasattr(domain_request, "id"): - raise ValueError("The provided DomainRequest has no id") + if not hasattr(domain_application, "id"): + raise ValueError("The provided DomainApplication has no id") # check if we have a record that corresponds with the domain - # domain_request, if so short circuit the create - existing_domain_info = cls.objects.filter(domain_request__id=domain_request.id).first() + # application, if so short circuit the create + existing_domain_info = cls.objects.filter(domain_application__id=domain_application.id).first() if existing_domain_info: return existing_domain_info - # Get the fields that exist on both DomainRequest and DomainInformation - common_fields = DomainHelper.get_common_fields(DomainRequest, DomainInformation) + # Get the fields that exist on both DomainApplication and DomainInformation + common_fields = DomainHelper.get_common_fields(DomainApplication, DomainInformation) # Get a list of all many_to_many relations on DomainInformation (needs to be saved differently) info_many_to_many_fields = DomainInformation._get_many_to_many_fields() @@ -249,11 +249,11 @@ class DomainInformation(TimeStampedModel): for field in common_fields: # If the field isn't many_to_many, populate the da_dict. # If it is, populate da_many_to_many_dict as we need to save this later. - if hasattr(domain_request, field): + if hasattr(domain_application, field): if field not in info_many_to_many_fields: - da_dict[field] = getattr(domain_request, field) + da_dict[field] = getattr(domain_application, field) else: - da_many_to_many_dict[field] = getattr(domain_request, field).all() + da_many_to_many_dict[field] = getattr(domain_application, field).all() # This will not happen in normal code flow, but having some redundancy doesn't hurt. # da_dict should not have "id" under any circumstances. @@ -266,8 +266,8 @@ class DomainInformation(TimeStampedModel): # Create a placeholder DomainInformation object domain_info = DomainInformation(**da_dict) - # Add the domain_request and domain fields - domain_info.domain_request = domain_request + # Add the domain_application and domain fields + domain_info.domain_application = domain_application if domain: domain_info.domain = domain diff --git a/src/registrar/models/user_group.py b/src/registrar/models/user_group.py index a84da798a..a32406a05 100644 --- a/src/registrar/models/user_group.py +++ b/src/registrar/models/user_group.py @@ -33,8 +33,8 @@ class UserGroup(Group): }, { "app_label": "registrar", - "model": "domainrequest", - "permissions": ["change_domainrequest"], + "model": "domainapplication", + "permissions": ["change_domainapplication"], }, { "app_label": "registrar", diff --git a/src/registrar/models/utility/domain_helper.py b/src/registrar/models/utility/domain_helper.py index 27a78403c..8b9391add 100644 --- a/src/registrar/models/utility/domain_helper.py +++ b/src/registrar/models/utility/domain_helper.py @@ -184,7 +184,7 @@ class DomainHelper: model_1_fields = set(field.name for field in model_1._meta.get_fields() if field.name != "id") model_2_fields = set(field.name for field in model_2._meta.get_fields() if field.name != "id") - # Get the fields that exist on both DomainRequest and DomainInformation + # Get the fields that exist on both DomainApplication and DomainInformation common_fields = model_1_fields & model_2_fields return common_fields diff --git a/src/registrar/models/website.py b/src/registrar/models/website.py index 29739b8ee..0b337e397 100644 --- a/src/registrar/models/website.py +++ b/src/registrar/models/website.py @@ -4,7 +4,7 @@ from .utility.time_stamped_model import TimeStampedModel class Website(TimeStampedModel): - """Keep domain names in their own table so that domain requests can refer to + """Keep domain names in their own table so that applications can refer to many of them.""" # domain names have strictly limited lengths, 255 characters is more than diff --git a/src/registrar/templates/domain_request_about_your_organization.html b/src/registrar/templates/application_about_your_organization.html similarity index 95% rename from src/registrar/templates/domain_request_about_your_organization.html rename to src/registrar/templates/application_about_your_organization.html index 9be8626aa..02e2e2c4f 100644 --- a/src/registrar/templates/domain_request_about_your_organization.html +++ b/src/registrar/templates/application_about_your_organization.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_anything_else.html b/src/registrar/templates/application_anything_else.html similarity index 92% rename from src/registrar/templates/domain_request_anything_else.html rename to src/registrar/templates/application_anything_else.html index 326f9a5cf..c1ecf94a9 100644 --- a/src/registrar/templates/domain_request_anything_else.html +++ b/src/registrar/templates/application_anything_else.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_authorizing_official.html b/src/registrar/templates/application_authorizing_official.html similarity index 96% rename from src/registrar/templates/domain_request_authorizing_official.html rename to src/registrar/templates/application_authorizing_official.html index df4931ba7..068457373 100644 --- a/src/registrar/templates/domain_request_authorizing_official.html +++ b/src/registrar/templates/application_authorizing_official.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers url_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_current_sites.html b/src/registrar/templates/application_current_sites.html similarity index 96% rename from src/registrar/templates/domain_request_current_sites.html rename to src/registrar/templates/application_current_sites.html index 2a2ac6885..debadcfe2 100644 --- a/src/registrar/templates/domain_request_current_sites.html +++ b/src/registrar/templates/application_current_sites.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load static field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_done.html b/src/registrar/templates/application_done.html similarity index 100% rename from src/registrar/templates/domain_request_done.html rename to src/registrar/templates/application_done.html diff --git a/src/registrar/templates/domain_request_dotgov_domain.html b/src/registrar/templates/application_dotgov_domain.html similarity index 98% rename from src/registrar/templates/domain_request_dotgov_domain.html rename to src/registrar/templates/application_dotgov_domain.html index 60220e014..155fdbeb4 100644 --- a/src/registrar/templates/domain_request_dotgov_domain.html +++ b/src/registrar/templates/application_dotgov_domain.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load static field_helpers url_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_form.html b/src/registrar/templates/application_form.html similarity index 96% rename from src/registrar/templates/domain_request_form.html rename to src/registrar/templates/application_form.html index cde12ad80..965967072 100644 --- a/src/registrar/templates/domain_request_form.html +++ b/src/registrar/templates/application_form.html @@ -6,12 +6,12 @@
- {% include 'domain_request_sidebar.html' %} + {% include 'application_sidebar.html' %}
{% if steps.prev %} - + Previous step diff --git a/src/registrar/templates/domain_request_intro.html b/src/registrar/templates/application_intro.html similarity index 100% rename from src/registrar/templates/domain_request_intro.html rename to src/registrar/templates/application_intro.html diff --git a/src/registrar/templates/domain_request_org_contact.html b/src/registrar/templates/application_org_contact.html similarity index 96% rename from src/registrar/templates/domain_request_org_contact.html rename to src/registrar/templates/application_org_contact.html index 21cf19306..e8e8f50bf 100644 --- a/src/registrar/templates/domain_request_org_contact.html +++ b/src/registrar/templates/application_org_contact.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers url_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_org_election.html b/src/registrar/templates/application_org_election.html similarity index 94% rename from src/registrar/templates/domain_request_org_election.html rename to src/registrar/templates/application_org_election.html index 182234bc3..b2ef462b5 100644 --- a/src/registrar/templates/domain_request_org_election.html +++ b/src/registrar/templates/application_org_election.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_org_federal.html b/src/registrar/templates/application_org_federal.html similarity index 91% rename from src/registrar/templates/domain_request_org_federal.html rename to src/registrar/templates/application_org_federal.html index 834298f24..8a5a574b0 100644 --- a/src/registrar/templates/domain_request_org_federal.html +++ b/src/registrar/templates/application_org_federal.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_org_type.html b/src/registrar/templates/application_org_type.html similarity index 92% rename from src/registrar/templates/domain_request_org_type.html rename to src/registrar/templates/application_org_type.html index eab61e0bc..ef3fb82f7 100644 --- a/src/registrar/templates/domain_request_org_type.html +++ b/src/registrar/templates/application_org_type.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_other_contacts.html b/src/registrar/templates/application_other_contacts.html similarity index 99% rename from src/registrar/templates/domain_request_other_contacts.html rename to src/registrar/templates/application_other_contacts.html index 4189e8c73..4e13f705b 100644 --- a/src/registrar/templates/domain_request_other_contacts.html +++ b/src/registrar/templates/application_other_contacts.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load static field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_purpose.html b/src/registrar/templates/application_purpose.html similarity index 95% rename from src/registrar/templates/domain_request_purpose.html rename to src/registrar/templates/application_purpose.html index f79bf46e2..d71d068de 100644 --- a/src/registrar/templates/domain_request_purpose.html +++ b/src/registrar/templates/application_purpose.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers url_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_requirements.html b/src/registrar/templates/application_requirements.html similarity index 98% rename from src/registrar/templates/domain_request_requirements.html rename to src/registrar/templates/application_requirements.html index d0da7818b..ef0bf00f2 100644 --- a/src/registrar/templates/domain_request_requirements.html +++ b/src/registrar/templates/application_requirements.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_review.html b/src/registrar/templates/application_review.html similarity index 57% rename from src/registrar/templates/domain_request_review.html rename to src/registrar/templates/application_review.html index 71aec8d0a..4af6b758f 100644 --- a/src/registrar/templates/domain_request_review.html +++ b/src/registrar/templates/application_review.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load static url_helpers %} {% load custom_filters %} @@ -23,98 +23,98 @@
{% if step == Step.ORGANIZATION_TYPE %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% if domain_request.organization_type is not None %} - {% with title=form_titles|get_item:step value=domain_request.get_organization_type_display|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% if application.organization_type is not None %} + {% with title=form_titles|get_item:step value=application.get_organization_type_display|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% else %} {% with title=form_titles|get_item:step value="Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% endif %} {% if step == Step.TRIBAL_GOVERNMENT %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.tribe_name|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} - {% if domain_request.federally_recognized_tribe %}

Federally-recognized tribe

{% endif %} - {% if domain_request.state_recognized_tribe %}

State-recognized tribe

{% endif %} + {% if application.federally_recognized_tribe %}

Federally-recognized tribe

{% endif %} + {% if application.state_recognized_tribe %}

State-recognized tribe

{% endif %} {% endif %} {% if step == Step.ORGANIZATION_FEDERAL %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.get_federal_type_display|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% if step == Step.ORGANIZATION_ELECTION %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.is_election_board|yesno:"Yes,No,Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.is_election_board|yesno:"Yes,No,Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% if step == Step.ORGANIZATION_CONTACT %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% if domain_request.organization_name %} - {% with title=form_titles|get_item:step value=domain_request %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url address='true' %} + {% namespaced_url 'application' step as application_url %} + {% if application.organization_name %} + {% with title=form_titles|get_item:step value=application %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url address='true' %} {% endwith %} {% else %} {% with title=form_titles|get_item:step value='Incomplete' %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% endif %} {% if step == Step.ABOUT_YOUR_ORGANIZATION %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.about_your_organization|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% if step == Step.AUTHORIZING_OFFICIAL %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% if domain_request.authorizing_official is not None %} - {% with title=form_titles|get_item:step value=domain_request.authorizing_official %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} + {% namespaced_url 'application' step as application_url %} + {% if application.authorizing_official is not None %} + {% with title=form_titles|get_item:step value=application.authorizing_official %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' %} {% endwith %} {% else %} {% with title=form_titles|get_item:step value="Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% endif %} {% if step == Step.CURRENT_SITES %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% if domain_request.current_websites.all %} - {% with title=form_titles|get_item:step value=domain_request.current_websites.all %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url list='true' %} + {% namespaced_url 'application' step as application_url %} + {% if application.current_websites.all %} + {% with title=form_titles|get_item:step value=application.current_websites.all %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url list='true' %} {% endwith %} {% else %} {% with title=form_titles|get_item:step value='None' %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% endif %} {% if step == Step.DOTGOV_DOMAIN %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.requested_domain.name|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} - {% if domain_request.alternative_domains.all %} + {% if application.alternative_domains.all %}

Alternative domains

    - {% for site in domain_request.alternative_domains.all %} + {% for site in application.alternative_domains.all %}
  • {{ site.website }}
  • {% endfor %}
@@ -122,51 +122,51 @@ {% endif %} {% if step == Step.PURPOSE %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.purpose|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% if step == Step.YOUR_CONTACT %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% if domain_request.submitter is not None %} - {% with title=form_titles|get_item:step value=domain_request.submitter %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} + {% namespaced_url 'application' step as application_url %} + {% if application.submitter is not None %} + {% with title=form_titles|get_item:step value=application.submitter %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' %} {% endwith %} {% else %} {% with title=form_titles|get_item:step value="Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% endif %} {% if step == Step.OTHER_CONTACTS %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% if domain_request.other_contacts.all %} - {% with title=form_titles|get_item:step value=domain_request.other_contacts.all %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' list='true' %} + {% namespaced_url 'application' step as application_url %} + {% if application.other_contacts.all %} + {% with title=form_titles|get_item:step value=application.other_contacts.all %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' list='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% with title=form_titles|get_item:step value=application.no_other_contacts_rationale|default:"Incomplete" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% endif %} {% if step == Step.ANYTHING_ELSE %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.anything_else|default:"No" %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.anything_else|default:"No" %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} {% if step == Step.REQUIREMENTS %} - {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." %} - {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} + {% namespaced_url 'application' step as application_url %} + {% with title=form_titles|get_item:step value=application.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." %} + {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %} {% endwith %} {% endif %} diff --git a/src/registrar/templates/domain_request_sidebar.html b/src/registrar/templates/application_sidebar.html similarity index 95% rename from src/registrar/templates/domain_request_sidebar.html rename to src/registrar/templates/application_sidebar.html index f9ca5397d..e0e51dd45 100644 --- a/src/registrar/templates/domain_request_sidebar.html +++ b/src/registrar/templates/application_sidebar.html @@ -15,7 +15,7 @@ {% endif %} {% endif %} -
+
+ + + +

+ Back to manage your domains +

+
+

Domain request for {{ domainapplication.requested_domain.name }}

+
+
+

+ + Status: + + {% if domainapplication.status == 'approved' %} Approved + {% elif domainapplication.status == 'in review' %} In review + {% elif domainapplication.status == 'rejected' %} Rejected + {% elif domainapplication.status == 'submitted' %} Submitted + {% elif domainapplication.status == 'ineligible' %} Ineligible + {% else %}ERROR Please contact technical support/dev + {% endif %} +

+
+
+
+

Last updated: {{domainapplication.updated_at|date:"F j, Y"}}
+ Request #: {{domainapplication.id}}

+

{% include "includes/domain_application.html" %}

+

+ Withdraw request +

+
+ +
+

Summary of your domain request

+ {% with heading_level='h3' %} + {% with org_type=domainapplication.get_organization_type_display %} + {% include "includes/summary_item.html" with title='Type of organization' value=org_type heading_level=heading_level %} + {% endwith %} + + {% if domainapplication.tribe_name %} + {% include "includes/summary_item.html" with title='Tribal government' value=domainapplication.tribe_name heading_level=heading_level %} + + {% if domainapplication.federally_recognized_tribe %} +

Federally-recognized tribe

+ {% endif %} + + {% if domainapplication.state_recognized_tribe %} +

State-recognized tribe

+ {% endif %} + + {% endif %} + + {% if domainapplication.get_federal_type_display %} + {% include "includes/summary_item.html" with title='Federal government branch' value=domainapplication.get_federal_type_display heading_level=heading_level %} + {% endif %} + + {% if domainapplication.is_election_board %} + {% with value=domainapplication.is_election_board|yesno:"Yes,No,Incomplete" %} + {% include "includes/summary_item.html" with title='Election office' value=value heading_level=heading_level %} + {% endwith %} + {% endif %} + + {% if domainapplication.organization_name %} + {% include "includes/summary_item.html" with title='Organization name and mailing address' value=domainapplication address='true' heading_level=heading_level %} + {% endif %} + + {% 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.authorizing_official %} + {% include "includes/summary_item.html" with title='Authorizing official' value=domainapplication.authorizing_official contact='true' heading_level=heading_level %} + {% endif %} + + {% if domainapplication.current_websites.all %} + {% include "includes/summary_item.html" with title='Current websites' value=domainapplication.current_websites.all list='true' heading_level=heading_level %} + {% endif %} + + {% if domainapplication.requested_domain %} + {% include "includes/summary_item.html" with title='.gov domain' value=domainapplication.requested_domain heading_level=heading_level %} + {% endif %} + + {% if domainapplication.alternative_domains.all %} + {% include "includes/summary_item.html" with title='Alternative domains' value=domainapplication.alternative_domains.all list='true' heading_level=heading_level %} + {% endif %} + + {% if domainapplication.purpose %} + {% include "includes/summary_item.html" with title='Purpose of your domain' value=domainapplication.purpose heading_level=heading_level %} + {% endif %} + + {% if domainapplication.submitter %} + {% include "includes/summary_item.html" with title='Your contact information' value=domainapplication.submitter contact='true' heading_level=heading_level %} + {% endif %} + + {% if domainapplication.other_contacts.all %} + {% include "includes/summary_item.html" with title='Other employees from your organization' value=domainapplication.other_contacts.all contact='true' list='true' heading_level=heading_level %} + {% else %} + {% include "includes/summary_item.html" with title='Other employees from your organization' value=domainapplication.no_other_contacts_rationale heading_level=heading_level %} + {% endif %} + + {% include "includes/summary_item.html" with title='Anything else?' value=domainapplication.anything_else|default:"No" heading_level=heading_level %} + + {% endwith %} +
+ +
+{% endblock %} diff --git a/src/registrar/templates/domain_request_tribal_government.html b/src/registrar/templates/application_tribal_government.html similarity index 96% rename from src/registrar/templates/domain_request_tribal_government.html rename to src/registrar/templates/application_tribal_government.html index ceed72cb2..3e79a4524 100644 --- a/src/registrar/templates/domain_request_tribal_government.html +++ b/src/registrar/templates/application_tribal_government.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/application_withdraw_confirmation.html b/src/registrar/templates/application_withdraw_confirmation.html new file mode 100644 index 000000000..98d838ae1 --- /dev/null +++ b/src/registrar/templates/application_withdraw_confirmation.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} + +{% block title %}Withdraw request for {{ domainapplication.requested_domain.name }} | {% endblock %} +{% load static url_helpers %} + +{% block content %} +
+
+ + +

Withdraw request for {{ domainapplication.requested_domain.name }}?

+ +

If you withdraw your request, we won't review it. Once you withdraw your request, you can edit it and submit it again.

+ +

Withdraw request + Cancel

+ +
+ +
+{% endblock %} diff --git a/src/registrar/templates/domain_request_your_contact.html b/src/registrar/templates/application_your_contact.html similarity index 95% rename from src/registrar/templates/domain_request_your_contact.html rename to src/registrar/templates/application_your_contact.html index 768d684c3..080b84eb6 100644 --- a/src/registrar/templates/domain_request_your_contact.html +++ b/src/registrar/templates/application_your_contact.html @@ -1,4 +1,4 @@ -{% extends 'domain_request_form.html' %} +{% extends 'application_form.html' %} {% load field_helpers %} {% block form_instructions %} diff --git a/src/registrar/templates/domain_request_status.html b/src/registrar/templates/domain_request_status.html deleted file mode 100644 index 55260db97..000000000 --- a/src/registrar/templates/domain_request_status.html +++ /dev/null @@ -1,126 +0,0 @@ -{% extends 'base.html' %} - -{% load custom_filters %} - -{% block title %}Domain request status | {{ DomainRequest.requested_domain.name }} | {% endblock %} -{% load static url_helpers %} - -{% block content %} -
-
- - - -

- Back to manage your domains -

-
-

Domain request for {{ DomainRequest.requested_domain.name }}

-
-
-

- - Status: - - {% if DomainRequest.status == 'approved' %} Approved - {% elif DomainRequest.status == 'in review' %} In review - {% elif DomainRequest.status == 'rejected' %} Rejected - {% elif DomainRequest.status == 'submitted' %} Submitted - {% elif DomainRequest.status == 'ineligible' %} Ineligible - {% else %}ERROR Please contact technical support/dev - {% endif %} -

-
-
-
-

Last updated: {{DomainRequest.updated_at|date:"F j, Y"}}
- Request #: {{DomainRequest.id}}

-

{% include "includes/domain_request.html" %}

-

- Withdraw request -

-
- -
-

Summary of your domain request

- {% with heading_level='h3' %} - {% with org_type=DomainRequest.get_organization_type_display %} - {% include "includes/summary_item.html" with title='Type of organization' value=org_type heading_level=heading_level %} - {% endwith %} - - {% if DomainRequest.tribe_name %} - {% include "includes/summary_item.html" with title='Tribal government' value=DomainRequest.tribe_name heading_level=heading_level %} - - {% if DomainRequest.federally_recognized_tribe %} -

Federally-recognized tribe

- {% endif %} - - {% if DomainRequest.state_recognized_tribe %} -

State-recognized tribe

- {% endif %} - - {% endif %} - - {% if DomainRequest.get_federal_type_display %} - {% include "includes/summary_item.html" with title='Federal government branch' value=DomainRequest.get_federal_type_display heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.is_election_board %} - {% with value=DomainRequest.is_election_board|yesno:"Yes,No,Incomplete" %} - {% include "includes/summary_item.html" with title='Election office' value=value heading_level=heading_level %} - {% endwith %} - {% endif %} - - {% if DomainRequest.organization_name %} - {% include "includes/summary_item.html" with title='Organization name and mailing address' value=DomainRequest address='true' heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.about_your_organization %} - {% include "includes/summary_item.html" with title='About your organization' value=DomainRequest.about_your_organization heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.authorizing_official %} - {% include "includes/summary_item.html" with title='Authorizing official' value=DomainRequest.authorizing_official contact='true' heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.current_websites.all %} - {% include "includes/summary_item.html" with title='Current websites' value=DomainRequest.current_websites.all list='true' heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.requested_domain %} - {% include "includes/summary_item.html" with title='.gov domain' value=DomainRequest.requested_domain heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.alternative_domains.all %} - {% include "includes/summary_item.html" with title='Alternative domains' value=DomainRequest.alternative_domains.all list='true' heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.purpose %} - {% include "includes/summary_item.html" with title='Purpose of your domain' value=DomainRequest.purpose heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.submitter %} - {% include "includes/summary_item.html" with title='Your contact information' value=DomainRequest.submitter contact='true' heading_level=heading_level %} - {% endif %} - - {% if DomainRequest.other_contacts.all %} - {% include "includes/summary_item.html" with title='Other employees from your organization' value=DomainRequest.other_contacts.all contact='true' list='true' heading_level=heading_level %} - {% else %} - {% include "includes/summary_item.html" with title='Other employees from your organization' value=DomainRequest.no_other_contacts_rationale heading_level=heading_level %} - {% endif %} - - {% include "includes/summary_item.html" with title='Anything else?' value=DomainRequest.anything_else|default:"No" heading_level=heading_level %} - - {% endwith %} -
- -
-{% endblock %} diff --git a/src/registrar/templates/domain_request_withdraw_confirmation.html b/src/registrar/templates/domain_request_withdraw_confirmation.html deleted file mode 100644 index edcdcadd3..000000000 --- a/src/registrar/templates/domain_request_withdraw_confirmation.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends 'base.html' %} - -{% block title %}Withdraw request for {{ DomainRequest.requested_domain.name }} | {% endblock %} -{% load static url_helpers %} - -{% block content %} -
-
- - -

Withdraw request for {{ DomainRequest.requested_domain.name }}?

- -

If you withdraw your request, we won't review it. Once you withdraw your request, you can edit it and submit it again.

- -

Withdraw request - Cancel

- -
- -
-{% endblock %} diff --git a/src/registrar/templates/emails/domain_request_withdrawn.txt b/src/registrar/templates/emails/domain_request_withdrawn.txt index 5ef429541..7a6aa227c 100644 --- a/src/registrar/templates/emails/domain_request_withdrawn.txt +++ b/src/registrar/templates/emails/domain_request_withdrawn.txt @@ -1,10 +1,10 @@ {% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} -Hi, {{ domain_request.submitter.first_name }}. +Hi, {{ application.submitter.first_name }}. Your .gov domain request has been withdrawn and will not be reviewed by our team. -DOMAIN REQUESTED: {{ domain_request.requested_domain.name }} -REQUEST RECEIVED ON: {{ domain_request.submission_date|date }} +DOMAIN REQUESTED: {{ application.requested_domain.name }} +REQUEST RECEIVED ON: {{ application.submission_date|date }} STATUS: Withdrawn ---------------------------------------------------------------- diff --git a/src/registrar/templates/emails/domain_request_withdrawn_subject.txt b/src/registrar/templates/emails/domain_request_withdrawn_subject.txt index 51b2c745a..5ceaa29af 100644 --- a/src/registrar/templates/emails/domain_request_withdrawn_subject.txt +++ b/src/registrar/templates/emails/domain_request_withdrawn_subject.txt @@ -1 +1 @@ -Update on your .gov request: {{ domain_request.requested_domain.name }} +Update on your .gov request: {{ application.requested_domain.name }} diff --git a/src/registrar/templates/emails/includes/application_summary.txt b/src/registrar/templates/emails/includes/application_summary.txt new file mode 100644 index 000000000..707689812 --- /dev/null +++ b/src/registrar/templates/emails/includes/application_summary.txt @@ -0,0 +1,55 @@ +SUMMARY OF YOUR DOMAIN REQUEST + +Type of organization: +{{ application.get_organization_type_display }} +{% if application.show_organization_federal %} +Federal government branch: +{{ application.get_federal_type_display }} +{% elif application.show_tribal_government %} +Tribal government: +{{ application.tribe_name|default:"Incomplete" }}{% if application.federally_recognized_tribe %} +Federally-recognized tribe +{% endif %}{% if application.state_recognized_tribe %} +State-recognized tribe +{% endif %}{% endif %}{% if application.show_organization_election %} +Election office: +{{ application.is_election_board|yesno:"Yes,No,Incomplete" }} +{% endif %} +Organization name and mailing address: +{% spaceless %}{{ application.federal_agency }} +{{ application.organization_name }} +{{ application.address_line1 }}{% if application.address_line2 %} +{{ application.address_line2 }}{% endif %} +{{ application.city }}, {{ application.state_territory }} +{{ application.zipcode }}{% if application.urbanization %} +{{ application.urbanization }}{% endif %}{% endspaceless %} +{% if application.about_your_organization %}{# if block makes one newline if it's false #} +About your organization: +{% spaceless %}{{ application.about_your_organization }}{% endspaceless %} +{% endif %} +Authorizing official: +{% spaceless %}{% include "emails/includes/contact.txt" with contact=application.authorizing_official %}{% endspaceless %} +{% if application.current_websites.exists %}{# if block makes a newline #} +Current websites: {% for site in application.current_websites.all %} +{% spaceless %}{{ site.website }}{% endspaceless %} +{% endfor %}{% endif %} +.gov domain: +{{ application.requested_domain.name }} +{% if application.alternative_domains.all %} +Alternative domains: +{% for site in application.alternative_domains.all %}{% spaceless %}{{ site.website }}{% endspaceless %} +{% endfor %}{% endif %} +Purpose of your domain: +{{ application.purpose }} + +Your contact information: +{% spaceless %}{% include "emails/includes/contact.txt" with contact=application.submitter %}{% endspaceless %} + +Other employees from your organization:{% for other in application.other_contacts.all %} +{% spaceless %}{% include "emails/includes/contact.txt" with contact=other %}{% endspaceless %} +{% empty %} +{{ application.no_other_contacts_rationale }} +{% endfor %}{% if application.anything_else %} +Anything else? +{{ application.anything_else }} +{% endif %} \ No newline at end of file diff --git a/src/registrar/templates/emails/includes/domain_request_summary.txt b/src/registrar/templates/emails/includes/domain_request_summary.txt deleted file mode 100644 index 6c7b36523..000000000 --- a/src/registrar/templates/emails/includes/domain_request_summary.txt +++ /dev/null @@ -1,55 +0,0 @@ -SUMMARY OF YOUR DOMAIN REQUEST - -Type of organization: -{{ domain_request.get_organization_type_display }} -{% if domain_request.show_organization_federal %} -Federal government branch: -{{ domain_request.get_federal_type_display }} -{% elif domain_request.show_tribal_government %} -Tribal government: -{{ domain_request.tribe_name|default:"Incomplete" }}{% if domain_request.federally_recognized_tribe %} -Federally-recognized tribe -{% endif %}{% if domain_request.state_recognized_tribe %} -State-recognized tribe -{% endif %}{% endif %}{% if domain_request.show_organization_election %} -Election office: -{{ domain_request.is_election_board|yesno:"Yes,No,Incomplete" }} -{% endif %} -Organization name and mailing address: -{% spaceless %}{{ domain_request.federal_agency }} -{{ domain_request.organization_name }} -{{ domain_request.address_line1 }}{% if domain_request.address_line2 %} -{{ domain_request.address_line2 }}{% endif %} -{{ domain_request.city }}, {{ domain_request.state_territory }} -{{ domain_request.zipcode }}{% if domain_request.urbanization %} -{{ domain_request.urbanization }}{% endif %}{% endspaceless %} -{% if domain_request.about_your_organization %}{# if block makes one newline if it's false #} -About your organization: -{% spaceless %}{{ domain_request.about_your_organization }}{% endspaceless %} -{% endif %} -Authorizing official: -{% spaceless %}{% include "emails/includes/contact.txt" with contact=domain_request.authorizing_official %}{% endspaceless %} -{% if domain_request.current_websites.exists %}{# if block makes a newline #} -Current websites: {% for site in domain_request.current_websites.all %} -{% spaceless %}{{ site.website }}{% endspaceless %} -{% endfor %}{% endif %} -.gov domain: -{{ domain_request.requested_domain.name }} -{% if domain_request.alternative_domains.all %} -Alternative domains: -{% for site in domain_request.alternative_domains.all %}{% spaceless %}{{ site.website }}{% endspaceless %} -{% endfor %}{% endif %} -Purpose of your domain: -{{ domain_request.purpose }} - -Your contact information: -{% spaceless %}{% include "emails/includes/contact.txt" with contact=domain_request.submitter %}{% endspaceless %} - -Other employees from your organization:{% for other in domain_request.other_contacts.all %} -{% spaceless %}{% include "emails/includes/contact.txt" with contact=other %}{% endspaceless %} -{% empty %} -{{ domain_request.no_other_contacts_rationale }} -{% endfor %}{% if domain_request.anything_else %} -Anything else? -{{ domain_request.anything_else }} -{% endif %} \ No newline at end of file diff --git a/src/registrar/templates/emails/status_change_approved.txt b/src/registrar/templates/emails/status_change_approved.txt index cab88d973..8e9ecfbd9 100644 --- a/src/registrar/templates/emails/status_change_approved.txt +++ b/src/registrar/templates/emails/status_change_approved.txt @@ -1,10 +1,10 @@ {% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} -Hi, {{ domain_request.submitter.first_name }}. +Hi, {{ application.submitter.first_name }}. Congratulations! Your .gov domain request has been approved. -DOMAIN REQUESTED: {{ domain_request.requested_domain.name }} -REQUEST RECEIVED ON: {{ domain_request.submission_date|date }} +DOMAIN REQUESTED: {{ application.requested_domain.name }} +REQUEST RECEIVED ON: {{ application.submission_date|date }} STATUS: Approved You can manage your approved domain on the .gov registrar . diff --git a/src/registrar/templates/emails/status_change_approved_subject.txt b/src/registrar/templates/emails/status_change_approved_subject.txt index 51b2c745a..5ceaa29af 100644 --- a/src/registrar/templates/emails/status_change_approved_subject.txt +++ b/src/registrar/templates/emails/status_change_approved_subject.txt @@ -1 +1 @@ -Update on your .gov request: {{ domain_request.requested_domain.name }} +Update on your .gov request: {{ application.requested_domain.name }} diff --git a/src/registrar/templates/emails/status_change_rejected.txt b/src/registrar/templates/emails/status_change_rejected.txt index 4febb4c64..fecac5e90 100644 --- a/src/registrar/templates/emails/status_change_rejected.txt +++ b/src/registrar/templates/emails/status_change_rejected.txt @@ -1,15 +1,15 @@ {% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} -Hi, {{ domain_request.submitter.first_name }}. +Hi, {{ application.submitter.first_name }}. Your .gov domain request has been rejected. -DOMAIN REQUESTED: {{ domain_request.requested_domain.name }} -REQUEST RECEIVED ON: {{ domain_request.submission_date|date }} +DOMAIN REQUESTED: {{ application.requested_domain.name }} +REQUEST RECEIVED ON: {{ application.submission_date|date }} STATUS: Rejected ---------------------------------------------------------------- -{% if domain_request.rejection_reason != 'other' %} -REJECTION REASON{% endif %}{% if domain_request.rejection_reason == 'purpose_not_met' %} +{% if application.rejection_reason != 'other' %} +REJECTION REASON{% endif %}{% if application.rejection_reason == 'purpose_not_met' %} Your domain request was rejected because the purpose you provided did not meet our requirements. You didn’t provide enough information about how you intend to use the domain. @@ -18,16 +18,16 @@ Learn more about: - Eligibility for a .gov domain - What you can and can’t do with .gov domains -If you have questions or comments, reply to this email.{% elif domain_request.rejection_reason == 'requestor_not_eligible' %} +If you have questions or comments, reply to this email.{% elif application.rejection_reason == 'requestor_not_eligible' %} Your domain request was rejected because we don’t believe you’re eligible to request a -.gov domain on behalf of {{ domain_request.organization_name }}. You must be a government employee, or be +.gov domain on behalf of {{ application.organization_name }}. You must be a government employee, or be working on behalf of a government organization, to request a .gov domain. DEMONSTRATE ELIGIBILITY If you can provide more information that demonstrates your eligibility, or you want to -discuss further, reply to this email.{% elif domain_request.rejection_reason == 'org_has_domain' %} -Your domain request was rejected because {{ domain_request.organization_name }} has a .gov domain. Our +discuss further, reply to this email.{% elif application.rejection_reason == 'org_has_domain' %} +Your domain request was rejected because {{ application.organization_name }} has a .gov domain. Our practice is to approve one domain per online service per government organization. We evaluate additional requests on a case-by-case basis. You did not provide sufficient justification for an additional domain. @@ -35,10 +35,10 @@ justification for an additional domain. Read more about our practice of approving one domain per online service . -If you have questions or comments, reply to this email.{% elif domain_request.rejection_reason == 'contacts_not_verified' %} +If you have questions or comments, reply to this email.{% elif application.rejection_reason == 'contacts_not_verified' %} Your domain request was rejected because we could not verify the organizational -contacts you provided. If you have questions or comments, reply to this email.{% elif domain_request.rejection_reason == 'org_not_eligible' %} -Your domain request was rejected because we determined that {{ domain_request.organization_name }} is not +contacts you provided. If you have questions or comments, reply to this email.{% elif application.rejection_reason == 'org_not_eligible' %} +Your domain request was rejected because we determined that {{ application.organization_name }} is not eligible for a .gov domain. .Gov domains are only available to official U.S.-based government organizations. @@ -48,7 +48,7 @@ If you can provide documentation that demonstrates your eligibility, reply to th This can include links to (or copies of) your authorizing legislation, your founding charter or bylaws, or other similar documentation. Without this, we can’t approve a .gov domain for your organization. Learn more about eligibility for .gov domains -.{% elif domain_request.rejection_reason == 'naming_not_met' %} +.{% elif application.rejection_reason == 'naming_not_met' %} Your domain request was rejected because it does not meet our naming requirements. Domains should uniquely identify a government organization and be clear to the general public. Learn more about naming requirements for your type of organization @@ -57,7 +57,7 @@ general public. Learn more about naming requirements for your type of organizati YOU CAN SUBMIT A NEW REQUEST We encourage you to request a domain that meets our requirements. If you have -questions or want to discuss potential domain names, reply to this email.{% elif domain_request.rejection_reason == 'other' %} +questions or want to discuss potential domain names, reply to this email.{% elif application.rejection_reason == 'other' %} YOU CAN SUBMIT A NEW REQUEST If your organization is eligible for a .gov domain and you meet our other requirements, you can submit a new request. diff --git a/src/registrar/templates/emails/status_change_rejected_subject.txt b/src/registrar/templates/emails/status_change_rejected_subject.txt index 51b2c745a..5ceaa29af 100644 --- a/src/registrar/templates/emails/status_change_rejected_subject.txt +++ b/src/registrar/templates/emails/status_change_rejected_subject.txt @@ -1 +1 @@ -Update on your .gov request: {{ domain_request.requested_domain.name }} +Update on your .gov request: {{ application.requested_domain.name }} diff --git a/src/registrar/templates/emails/submission_confirmation.txt b/src/registrar/templates/emails/submission_confirmation.txt index 5d99cef5c..92c239f03 100644 --- a/src/registrar/templates/emails/submission_confirmation.txt +++ b/src/registrar/templates/emails/submission_confirmation.txt @@ -1,10 +1,10 @@ {% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #} -Hi, {{ domain_request.submitter.first_name }}. +Hi, {{ application.submitter.first_name }}. We received your .gov domain request. -DOMAIN REQUESTED: {{ domain_request.requested_domain.name }} -REQUEST RECEIVED ON: {{ domain_request.submission_date|date }} +DOMAIN REQUESTED: {{ application.requested_domain.name }} +REQUEST RECEIVED ON: {{ application.submission_date|date }} STATUS: Submitted ---------------------------------------------------------------- @@ -29,7 +29,7 @@ THANK YOU ---------------------------------------------------------------- -{% include 'emails/includes/domain_request_summary.txt' %} +{% include 'emails/includes/application_summary.txt' %} ---------------------------------------------------------------- The .gov team diff --git a/src/registrar/templates/emails/submission_confirmation_subject.txt b/src/registrar/templates/emails/submission_confirmation_subject.txt index 51b2c745a..5ceaa29af 100644 --- a/src/registrar/templates/emails/submission_confirmation_subject.txt +++ b/src/registrar/templates/emails/submission_confirmation_subject.txt @@ -1 +1 @@ -Update on your .gov request: {{ domain_request.requested_domain.name }} +Update on your .gov request: {{ application.requested_domain.name }} diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index dd505f3c6..93f1243ea 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -17,7 +17,7 @@

- Start a new domain request @@ -103,7 +103,7 @@

Domain requests

- {% if domain_requests %} + {% if domain_applications %} @@ -112,61 +112,61 @@ - {% if has_deletable_domain_requests %} + {% if has_deletable_applications %} {% endif %} - {% for domain_request in domain_requests %} + {% for application in domain_applications %} - - + - {% if has_deletable_domain_requests %} + {% if has_deletable_applications %} ', count=1) @@ -293,7 +293,7 @@ class TestDomainAdmin(MockEppLib, WebTest): Scenario: Domain deletion is unsuccessful When the domain is deleted Then a user-friendly success message is returned for displaying on the web - And `state` is set to `DELETED` + And `state` is et to `DELETED` """ with less_console_noise(): domain = create_ready_domain() @@ -435,19 +435,19 @@ class TestDomainAdmin(MockEppLib, WebTest): super().tearDown() Domain.objects.all().delete() DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() User.objects.all().delete() -class TestDomainRequestAdminForm(TestCase): +class TestDomainApplicationAdminForm(TestCase): def setUp(self): - # Create a test domain request with an initial state of started - self.domain_request = completed_domain_request() + # Create a test application with an initial state of started + self.application = completed_application() def test_form_choices(self): with less_console_noise(): - # Create a form instance with the test domain request - form = DomainRequestAdminForm(instance=self.domain_request) + # Create a form instance with the test application + form = DomainApplicationAdminForm(instance=self.application) # Verify that the form choices match the available transitions for started expected_choices = [("started", "Started"), ("submitted", "Submitted")] @@ -456,41 +456,41 @@ class TestDomainRequestAdminForm(TestCase): def test_form_choices_when_no_instance(self): with less_console_noise(): # Create a form instance without an instance - form = DomainRequestAdminForm() + form = DomainApplicationAdminForm() # Verify that the form choices show all choices when no instance is provided; # this is necessary to show all choices when creating a new domain - # request in django admin; - # note that FSM ensures that no domain request exists with invalid status, + # application in django admin; + # note that FSM ensures that no domain application exists with invalid status, # so don't need to test for invalid status self.assertEqual( form.fields["status"].widget.choices, - DomainRequest._meta.get_field("status").choices, + DomainApplication._meta.get_field("status").choices, ) def test_form_choices_when_ineligible(self): with less_console_noise(): - # Create a form instance with a domain request with ineligible status - ineligible_domain_request = DomainRequest(status="ineligible") + # Create a form instance with a domain application with ineligible status + ineligible_application = DomainApplication(status="ineligible") - # Attempt to create a form with the ineligible domain request + # Attempt to create a form with the ineligible application # The form should not raise an error, but choices should be the # full list of possible choices - form = DomainRequestAdminForm(instance=ineligible_domain_request) + form = DomainApplicationAdminForm(instance=ineligible_application) self.assertEqual( form.fields["status"].widget.choices, - DomainRequest._meta.get_field("status").choices, + DomainApplication._meta.get_field("status").choices, ) @boto3_mocking.patching -class TestDomainRequestAdmin(MockEppLib): +class TestDomainApplicationAdmin(MockEppLib): def setUp(self): super().setUp() self.site = AdminSite() self.factory = RequestFactory() - self.admin = DomainRequestAdmin(model=DomainRequest, admin_site=self.site) + self.admin = DomainApplicationAdmin(model=DomainApplication, admin_site=self.site) self.superuser = create_superuser() self.staffuser = create_user() self.client = Client(HTTP_HOST="localhost:8080") @@ -498,18 +498,18 @@ class TestDomainRequestAdmin(MockEppLib): factory=self.factory, user=self.superuser, admin=self.admin, - url="/admin/registrar/domainrequest/", - model=DomainRequest, + url="/admin/registrar/DomainApplication/", + model=DomainApplication, ) self.mock_client = MockSESClient() def test_domain_sortable(self): - """Tests if the DomainRequest sorts by domain correctly""" + """Tests if the DomainApplication sorts by domain correctly""" with less_console_noise(): p = "adminpass" self.client.login(username="superuser", password=p) - multiple_unalphabetical_domain_objects("domain_request") + multiple_unalphabetical_domain_objects("application") # Assert that our sort works correctly self.test_helper.assert_table_sorted("1", ("requested_domain__name",)) @@ -518,15 +518,15 @@ class TestDomainRequestAdmin(MockEppLib): self.test_helper.assert_table_sorted("-1", ("-requested_domain__name",)) def test_submitter_sortable(self): - """Tests if the DomainRequest sorts by domain correctly""" + """Tests if the DomainApplication sorts by domain correctly""" with less_console_noise(): p = "adminpass" self.client.login(username="superuser", password=p) - multiple_unalphabetical_domain_objects("domain_request") + multiple_unalphabetical_domain_objects("application") - additional_domain_request = generic_domain_object("domain_request", "Xylophone") - new_user = User.objects.filter(username=additional_domain_request.investigator.username).get() + additional_application = generic_domain_object("application", "Xylophone") + new_user = User.objects.filter(username=additional_application.investigator.username).get() new_user.first_name = "Xylophonic" new_user.save() @@ -549,14 +549,14 @@ class TestDomainRequestAdmin(MockEppLib): ) def test_investigator_sortable(self): - """Tests if the DomainRequest sorts by domain correctly""" + """Tests if the DomainApplication sorts by domain correctly""" with less_console_noise(): p = "adminpass" self.client.login(username="superuser", password=p) - multiple_unalphabetical_domain_objects("domain_request") - additional_domain_request = generic_domain_object("domain_request", "Xylophone") - new_user = User.objects.filter(username=additional_domain_request.investigator.username).get() + multiple_unalphabetical_domain_objects("application") + additional_application = generic_domain_object("application", "Xylophone") + new_user = User.objects.filter(username=additional_application.investigator.username).get() new_user.first_name = "Xylophonic" new_user.save() @@ -578,36 +578,36 @@ class TestDomainRequestAdmin(MockEppLib): ), ) - def test_short_org_name_in_domain_requests_list(self): + def test_short_org_name_in_applications_list(self): """ Make sure the short name is displaying in admin on the list page """ with less_console_noise(): self.client.force_login(self.superuser) - completed_domain_request() - response = self.client.get("/admin/registrar/domainrequest/") + completed_application() + response = self.client.get("/admin/registrar/domainapplication/") # There are 4 template references to Federal (4) plus two references in the table - # for our actual domain request + # for our actual application self.assertContains(response, "Federal", count=6) # This may be a bit more robust self.assertContains(response, '', count=1) # Now let's make sure the long description does not exist self.assertNotContains(response, "Federal: an agency of the U.S. government") - def transition_state_and_send_email(self, domain_request, status, rejection_reason=None): + def transition_state_and_send_email(self, application, status, rejection_reason=None): """Helper method for the email test cases.""" with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): # Create a mock request - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) - # Modify the domain request's properties - domain_request.status = status - domain_request.rejection_reason = rejection_reason + # Modify the application's properties + application.status = status + application.rejection_reason = rejection_reason # Use the model admin's save_model method - self.admin.save_model(request, domain_request, form=None, change=True) + self.admin.save_model(request, application, form=None, change=True) def assert_email_is_accurate( self, expected_string, email_index, email_address, test_that_no_bcc=False, bcc_email_address="" @@ -657,43 +657,43 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request() + # Create a sample application + application = completed_application() # Test Submitted Status from started - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, True) self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Test Withdrawn Status - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.WITHDRAWN) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN) self.assert_email_is_accurate( "Your .gov domain request has been withdrawn and will not be reviewed by our team.", 1, EMAIL, True ) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) # Test Submitted Status Again (from withdrawn) - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Move it to IN_REVIEW - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Test Submitted Status Again from in IN_REVIEW, no new email should be sent - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Move it to IN_REVIEW - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Move it to ACTION_NEEDED - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.ACTION_NEEDED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.ACTION_NEEDED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Test Submitted Status Again from in ACTION_NEEDED, no new email should be sent - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) @override_settings(IS_PRODUCTION=True) @@ -714,44 +714,44 @@ class TestDomainRequestAdmin(MockEppLib): BCC_EMAIL = settings.DEFAULT_FROM_EMAIL - # Create a sample domain request - domain_request = completed_domain_request() + # Create a sample application + application = completed_application() # Test Submitted Status from started - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, False, BCC_EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Test Withdrawn Status - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.WITHDRAWN) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN) self.assert_email_is_accurate( "Your .gov domain request has been withdrawn and will not be reviewed by our team.", 1, EMAIL ) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) # Test Submitted Status Again (from withdrawn) - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, False, BCC_EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Move it to IN_REVIEW - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Test Submitted Status Again from in IN_REVIEW, no new email should be sent - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Move it to IN_REVIEW - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Move it to ACTION_NEEDED - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.ACTION_NEEDED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.ACTION_NEEDED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) # Test Submitted Status Again from in ACTION_NEEDED, no new email should be sent - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) def test_save_model_sends_approved_email(self): @@ -763,25 +763,25 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Test Submitted Status - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 0, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Test Withdrawn Status self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.DOMAIN_PURPOSE, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.DOMAIN_PURPOSE, ) self.assert_email_is_accurate("Your .gov domain request has been rejected.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) # Test Submitted Status Again (No new email should be sent) - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) def test_save_model_sends_rejected_email_purpose_not_met(self): @@ -793,14 +793,14 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason DOMAIN_PURPOSE and test email self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.DOMAIN_PURPOSE, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.DOMAIN_PURPOSE, ) self.assert_email_is_accurate( "Your domain request was rejected because the purpose you provided did not meet our \nrequirements.", @@ -810,7 +810,7 @@ class TestDomainRequestAdmin(MockEppLib): self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -823,12 +823,12 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason REQUESTOR and test email including dynamic organization name self.transition_state_and_send_email( - domain_request, DomainRequest.DomainRequestStatus.REJECTED, DomainRequest.RejectionReasons.REQUESTOR + application, DomainApplication.ApplicationStatus.REJECTED, DomainApplication.RejectionReasons.REQUESTOR ) self.assert_email_is_accurate( "Your domain request was rejected because we don’t believe you’re eligible to request a \n.gov " @@ -839,7 +839,7 @@ class TestDomainRequestAdmin(MockEppLib): self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -852,14 +852,14 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason SECOND_DOMAIN_REASONING and test email including dynamic organization name self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.SECOND_DOMAIN_REASONING, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.SECOND_DOMAIN_REASONING, ) self.assert_email_is_accurate( "Your domain request was rejected because Testorg has a .gov domain.", 0, EMAIL @@ -867,7 +867,7 @@ class TestDomainRequestAdmin(MockEppLib): self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -880,14 +880,14 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason CONTACTS_OR_ORGANIZATION_LEGITIMACY and test email including dynamic organization name self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY, ) self.assert_email_is_accurate( "Your domain request was rejected because we could not verify the organizational \n" @@ -898,7 +898,7 @@ class TestDomainRequestAdmin(MockEppLib): self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -911,14 +911,14 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason ORGANIZATION_ELIGIBILITY and test email including dynamic organization name self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.ORGANIZATION_ELIGIBILITY, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.ORGANIZATION_ELIGIBILITY, ) self.assert_email_is_accurate( "Your domain request was rejected because we determined that Testorg is not \neligible for " @@ -929,7 +929,7 @@ class TestDomainRequestAdmin(MockEppLib): self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -942,14 +942,14 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.NAMING_REQUIREMENTS, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.NAMING_REQUIREMENTS, ) self.assert_email_is_accurate( "Your domain request was rejected because it does not meet our naming requirements.", 0, EMAIL @@ -957,7 +957,7 @@ class TestDomainRequestAdmin(MockEppLib): self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -970,20 +970,20 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name self.transition_state_and_send_email( - domain_request, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.OTHER, + application, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.OTHER, ) self.assert_email_is_accurate("Choosing a .gov domain name", 0, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Approve - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.APPROVED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED) self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) @@ -995,25 +995,25 @@ class TestDomainRequestAdmin(MockEppLib): """ with less_console_noise(): - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED) + application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED) # Create a request object with a superuser - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) request.user = self.superuser with ExitStack() as stack: stack.enter_context(patch.object(messages, "error")) - domain_request.status = DomainRequest.DomainRequestStatus.REJECTED + application.status = DomainApplication.ApplicationStatus.REJECTED - self.admin.save_model(request, domain_request, None, True) + self.admin.save_model(request, application, None, True) messages.error.assert_called_once_with( request, "A rejection reason is required.", ) - domain_request.refresh_from_db() - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.APPROVED) + application.refresh_from_db() + self.assertEqual(application.status, DomainApplication.ApplicationStatus.APPROVED) def test_transition_to_rejected_with_rejection_reason_does_not_trigger_error(self): """ @@ -1023,23 +1023,23 @@ class TestDomainRequestAdmin(MockEppLib): """ with less_console_noise(): - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED) + application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED) # Create a request object with a superuser - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) request.user = self.superuser with ExitStack() as stack: stack.enter_context(patch.object(messages, "error")) - domain_request.status = DomainRequest.DomainRequestStatus.REJECTED - domain_request.rejection_reason = DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY + application.status = DomainApplication.ApplicationStatus.REJECTED + application.rejection_reason = DomainApplication.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY - self.admin.save_model(request, domain_request, None, True) + self.admin.save_model(request, application, None, True) messages.error.assert_not_called() - domain_request.refresh_from_db() - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.REJECTED) + application.refresh_from_db() + self.assertEqual(application.status, DomainApplication.ApplicationStatus.REJECTED) def test_save_model_sends_withdrawn_email(self): """When transitioning to withdrawn on a domain request, @@ -1050,23 +1050,23 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Test Submitted Status - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.WITHDRAWN) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN) self.assert_email_is_accurate( "Your .gov domain request has been withdrawn and will not be reviewed by our team.", 0, EMAIL ) self.assertEqual(len(self.mock_client.EMAILS_SENT), 1) # Test Withdrawn Status - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.SUBMITTED) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED) self.assert_email_is_accurate("We received your .gov domain request.", 1, EMAIL) self.assertEqual(len(self.mock_client.EMAILS_SENT), 2) # Test Submitted Status Again (No new email should be sent) - self.transition_state_and_send_email(domain_request, DomainRequest.DomainRequestStatus.WITHDRAWN) + self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN) self.assertEqual(len(self.mock_client.EMAILS_SENT), 3) def test_save_model_sets_approved_domain(self): @@ -1075,21 +1075,21 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Create a mock request - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - # Modify the domain request's property - domain_request.status = DomainRequest.DomainRequestStatus.APPROVED + # Modify the application's property + application.status = DomainApplication.ApplicationStatus.APPROVED # Use the model admin's save_model method - self.admin.save_model(request, domain_request, form=None, change=True) + self.admin.save_model(request, application, form=None, change=True) # Test that approved domain exists and equals requested domain - self.assertEqual(domain_request.requested_domain.name, domain_request.approved_domain.name) + self.assertEqual(application.requested_domain.name, application.approved_domain.name) def test_save_model_sets_restricted_status_on_user(self): with less_console_noise(): @@ -1097,33 +1097,33 @@ class TestDomainRequestAdmin(MockEppLib): EMAIL = "mayor@igorville.gov" User.objects.filter(email=EMAIL).delete() - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) # Create a mock request - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - # Modify the domain request's property - domain_request.status = DomainRequest.DomainRequestStatus.INELIGIBLE + # Modify the application's property + application.status = DomainApplication.ApplicationStatus.INELIGIBLE # Use the model admin's save_model method - self.admin.save_model(request, domain_request, form=None, change=True) + self.admin.save_model(request, application, form=None, change=True) # Test that approved domain exists and equals requested domain - self.assertEqual(domain_request.creator.status, "restricted") + self.assertEqual(application.creator.status, "restricted") def test_readonly_when_restricted_creator(self): with less_console_noise(): - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - domain_request.creator.status = User.RESTRICTED - domain_request.creator.save() + application.creator.status = User.RESTRICTED + application.creator.save() request = self.factory.get("/") request.user = self.superuser - readonly_fields = self.admin.get_readonly_fields(request, domain_request) + readonly_fields = self.admin.get_readonly_fields(request, application) expected_fields = [ "id", @@ -1201,10 +1201,10 @@ class TestDomainRequestAdmin(MockEppLib): def test_saving_when_restricted_creator(self): with less_console_noise(): # Create an instance of the model - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - domain_request.creator.status = User.RESTRICTED - domain_request.creator.save() + application.creator.status = User.RESTRICTED + application.creator.save() # Create a request object with a superuser request = self.factory.get("/") @@ -1212,36 +1212,36 @@ class TestDomainRequestAdmin(MockEppLib): with patch("django.contrib.messages.error") as mock_error: # Simulate saving the model - self.admin.save_model(request, domain_request, None, False) + self.admin.save_model(request, application, None, False) # Assert that the error message was called with the correct argument mock_error.assert_called_once_with( request, - "This action is not permitted for domain requests with a restricted creator.", + "This action is not permitted for applications with a restricted creator.", ) # Assert that the status has not changed - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.assertEqual(application.status, DomainApplication.ApplicationStatus.IN_REVIEW) def test_change_view_with_restricted_creator(self): with less_console_noise(): # Create an instance of the model - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - domain_request.creator.status = User.RESTRICTED - domain_request.creator.save() + application.creator.status = User.RESTRICTED + application.creator.save() with patch("django.contrib.messages.warning") as mock_warning: # Create a request object with a superuser - request = self.factory.get("/admin/your_app/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.get("/admin/your_app/domainapplication/{}/change/".format(application.pk)) request.user = self.superuser - self.admin.display_restricted_warning(request, domain_request) + self.admin.display_restricted_warning(request, application) # Assert that the error message was called with the correct argument mock_warning.assert_called_once_with( request, - "Cannot edit a domain request with a restricted creator.", + "Cannot edit an application with a restricted creator.", ) def trigger_saving_approved_to_another_state(self, domain_is_active, another_state, rejection_reason=None): @@ -1253,14 +1253,14 @@ class TestDomainRequestAdmin(MockEppLib): with less_console_noise(): # Create an instance of the model - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED) - domain = Domain.objects.create(name=domain_request.requested_domain.name) + application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED) + domain = Domain.objects.create(name=application.requested_domain.name) domain_information = DomainInformation.objects.create(creator=self.superuser, domain=domain) - domain_request.approved_domain = domain - domain_request.save() + application.approved_domain = domain + application.save() # Create a request object with a superuser - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) request.user = self.superuser # Define a custom implementation for is_active @@ -1273,10 +1273,10 @@ class TestDomainRequestAdmin(MockEppLib): stack.enter_context(patch.object(Domain, "is_active", custom_is_active)) stack.enter_context(patch.object(messages, "error")) - domain_request.status = another_state - domain_request.rejection_reason = rejection_reason + application.status = another_state + application.rejection_reason = rejection_reason - self.admin.save_model(request, domain_request, None, True) + self.admin.save_model(request, application, None, True) # Assert that the error message was called with the correct argument if domain_is_active: @@ -1288,7 +1288,7 @@ class TestDomainRequestAdmin(MockEppLib): # Assert that the error message was never called messages.error.assert_not_called() - self.assertEqual(domain_request.approved_domain, None) + self.assertEqual(application.approved_domain, None) # Assert that Domain got Deleted with self.assertRaises(Domain.DoesNotExist): @@ -1299,38 +1299,38 @@ class TestDomainRequestAdmin(MockEppLib): domain_information.refresh_from_db() def test_error_when_saving_approved_to_in_review_and_domain_is_active(self): - self.trigger_saving_approved_to_another_state(True, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.IN_REVIEW) def test_error_when_saving_approved_to_action_needed_and_domain_is_active(self): - self.trigger_saving_approved_to_another_state(True, DomainRequest.DomainRequestStatus.ACTION_NEEDED) + self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.ACTION_NEEDED) def test_error_when_saving_approved_to_rejected_and_domain_is_active(self): - self.trigger_saving_approved_to_another_state(True, DomainRequest.DomainRequestStatus.REJECTED) + self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.REJECTED) def test_error_when_saving_approved_to_ineligible_and_domain_is_active(self): - self.trigger_saving_approved_to_another_state(True, DomainRequest.DomainRequestStatus.INELIGIBLE) + self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.INELIGIBLE) def test_side_effects_when_saving_approved_to_in_review(self): - self.trigger_saving_approved_to_another_state(False, DomainRequest.DomainRequestStatus.IN_REVIEW) + self.trigger_saving_approved_to_another_state(False, DomainApplication.ApplicationStatus.IN_REVIEW) def test_side_effects_when_saving_approved_to_action_needed(self): - self.trigger_saving_approved_to_another_state(False, DomainRequest.DomainRequestStatus.ACTION_NEEDED) + self.trigger_saving_approved_to_another_state(False, DomainApplication.ApplicationStatus.ACTION_NEEDED) def test_side_effects_when_saving_approved_to_rejected(self): self.trigger_saving_approved_to_another_state( False, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY, ) def test_side_effects_when_saving_approved_to_ineligible(self): - self.trigger_saving_approved_to_another_state(False, DomainRequest.DomainRequestStatus.INELIGIBLE) + self.trigger_saving_approved_to_another_state(False, DomainApplication.ApplicationStatus.INELIGIBLE) def test_has_correct_filters(self): """ - This test verifies that DomainRequestAdmin has the correct filters set up. + This test verifies that DomainApplicationAdmin has the correct filters set up. - It retrieves the current list of filters from DomainRequestAdmin + It retrieves the current list of filters from DomainApplicationAdmin and checks that it matches the expected list of filters. """ with less_console_noise(): @@ -1343,32 +1343,32 @@ class TestDomainRequestAdmin(MockEppLib): "status", "organization_type", "federal_type", - DomainRequestAdmin.ElectionOfficeFilter, + DomainApplicationAdmin.ElectionOfficeFilter, "rejection_reason", - DomainRequestAdmin.InvestigatorFilter, + DomainApplicationAdmin.InvestigatorFilter, ) self.assertEqual(readonly_fields, expected_fields) def test_table_sorted_alphabetically(self): """ - This test verifies that the DomainRequestAdmin table is sorted alphabetically + This test verifies that the DomainApplicationAdmin table is sorted alphabetically by the 'requested_domain__name' field. - It creates a list of DomainRequest instances in a non-alphabetical order, - then retrieves the queryset from the DomainRequestAdmin and checks + It creates a list of DomainApplication instances in a non-alphabetical order, + then retrieves the queryset from the DomainApplicationAdmin and checks that it matches the expected queryset, which is sorted alphabetically by the 'requested_domain__name' field. """ with less_console_noise(): - # Creates a list of DomainRequests in scrambled order - multiple_unalphabetical_domain_objects("domain_request") + # Creates a list of DomainApplications in scrambled order + multiple_unalphabetical_domain_objects("application") request = self.factory.get("/") request.user = self.superuser - # Get the expected list of alphabetically sorted DomainRequests - expected_order = DomainRequest.objects.order_by("requested_domain__name") + # Get the expected list of alphabetically sorted DomainApplications + expected_order = DomainApplication.objects.order_by("requested_domain__name") # Get the returned queryset queryset = self.admin.get_queryset(request) @@ -1382,11 +1382,11 @@ class TestDomainRequestAdmin(MockEppLib): def test_displays_investigator_filter(self): """ This test verifies that the investigator filter in the admin interface for - the DomainRequest model displays correctly. + the DomainApplication model displays correctly. - It creates two DomainRequest instances, each with a different investigator. + It creates two DomainApplication instances, each with a different investigator. It then simulates a staff user logging in and applying the investigator filter - on the DomainRequest admin page. + on the DomainApplication admin page. We then test if the page displays the filter we expect, but we do not test if we get back the correct response in the table. This is to isolate if @@ -1394,16 +1394,16 @@ class TestDomainRequestAdmin(MockEppLib): """ with less_console_noise(): - # Create a mock DomainRequest object, with a fake investigator - domain_request: DomainRequest = generic_domain_object("domain_request", "SomeGuy") - investigator_user = User.objects.filter(username=domain_request.investigator.username).get() + # Create a mock DomainApplication object, with a fake investigator + application: DomainApplication = generic_domain_object("application", "SomeGuy") + investigator_user = User.objects.filter(username=application.investigator.username).get() investigator_user.is_staff = True investigator_user.save() p = "userpass" self.client.login(username="staffuser", password=p) response = self.client.get( - "/admin/registrar/domainrequest/", + "/admin/registrar/domainapplication/", { "investigator__id__exact": investigator_user.id, }, @@ -1428,54 +1428,54 @@ class TestDomainRequestAdmin(MockEppLib): def test_investigator_dropdown_displays_only_staff(self): """ - This test verifies that the dropdown for the 'investigator' field in the DomainRequestAdmin + This test verifies that the dropdown for the 'investigator' field in the DomainApplicationAdmin interface only displays users who are marked as staff. - It creates two DomainRequest instances, one with an investigator + It creates two DomainApplication instances, one with an investigator who is a staff user and another with an investigator who is not a staff user. - It then retrieves the queryset for the 'investigator' dropdown from DomainRequestAdmin + It then retrieves the queryset for the 'investigator' dropdown from DomainApplicationAdmin and checks that it matches the expected queryset, which only includes staff users. """ with less_console_noise(): - # Create a mock DomainRequest object, with a fake investigator - domain_request: DomainRequest = generic_domain_object("domain_request", "SomeGuy") - investigator_user = User.objects.filter(username=domain_request.investigator.username).get() + # Create a mock DomainApplication object, with a fake investigator + application: DomainApplication = generic_domain_object("application", "SomeGuy") + investigator_user = User.objects.filter(username=application.investigator.username).get() investigator_user.is_staff = True investigator_user.save() - # Create a mock DomainRequest object, with a user that is not staff - domain_request_2: DomainRequest = generic_domain_object("domain_request", "SomeOtherGuy") - investigator_user_2 = User.objects.filter(username=domain_request_2.investigator.username).get() + # Create a mock DomainApplication object, with a user that is not staff + application_2: DomainApplication = generic_domain_object("application", "SomeOtherGuy") + investigator_user_2 = User.objects.filter(username=application_2.investigator.username).get() investigator_user_2.is_staff = False investigator_user_2.save() p = "userpass" self.client.login(username="staffuser", password=p) - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk)) # Get the actual field from the model's meta information - investigator_field = DomainRequest._meta.get_field("investigator") + investigator_field = DomainApplication._meta.get_field("investigator") # We should only be displaying staff users, in alphabetical order sorted_fields = ["first_name", "last_name", "email"] expected_dropdown = list(User.objects.filter(is_staff=True).order_by(*sorted_fields)) # Grab the current dropdown. We do an API call to autocomplete to get this info. - domain_request_queryset = self.admin.formfield_for_foreignkey(investigator_field, request).queryset + application_queryset = self.admin.formfield_for_foreignkey(investigator_field, request).queryset user_request = self.factory.post( - "/admin/autocomplete/?app_label=registrar&model_name=domainrequest&field_name=investigator" + "/admin/autocomplete/?app_label=registrar&model_name=domainapplication&field_name=investigator" ) user_admin = MyUserAdmin(User, self.site) - user_queryset = user_admin.get_search_results(user_request, domain_request_queryset, None)[0] + user_queryset = user_admin.get_search_results(user_request, application_queryset, None)[0] current_dropdown = list(user_queryset) self.assertEqual(expected_dropdown, current_dropdown) # Non staff users should not be in the list - self.assertNotIn(domain_request_2, current_dropdown) + self.assertNotIn(application_2, current_dropdown) def test_investigator_list_is_alphabetically_sorted(self): """ @@ -1483,20 +1483,20 @@ class TestDomainRequestAdmin(MockEppLib): is displayed alphabetically """ with less_console_noise(): - # Create a mock DomainRequest object, with a fake investigator - domain_request: DomainRequest = generic_domain_object("domain_request", "SomeGuy") - investigator_user = User.objects.filter(username=domain_request.investigator.username).get() + # Create a mock DomainApplication object, with a fake investigator + application: DomainApplication = generic_domain_object("application", "SomeGuy") + investigator_user = User.objects.filter(username=application.investigator.username).get() investigator_user.is_staff = True investigator_user.save() - domain_request_2: DomainRequest = generic_domain_object("domain_request", "AGuy") - investigator_user_2 = User.objects.filter(username=domain_request_2.investigator.username).get() + application_2: DomainApplication = generic_domain_object("application", "AGuy") + investigator_user_2 = User.objects.filter(username=application_2.investigator.username).get() investigator_user_2.first_name = "AGuy" investigator_user_2.is_staff = True investigator_user_2.save() - domain_request_3: DomainRequest = generic_domain_object("domain_request", "FinalGuy") - investigator_user_3 = User.objects.filter(username=domain_request_3.investigator.username).get() + application_3: DomainApplication = generic_domain_object("application", "FinalGuy") + investigator_user_3 = User.objects.filter(username=application_3.investigator.username).get() investigator_user_3.first_name = "FinalGuy" investigator_user_3.is_staff = True investigator_user_3.save() @@ -1522,7 +1522,7 @@ class TestDomainRequestAdmin(MockEppLib): super().tearDown() Domain.objects.all().delete() DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() User.objects.all().delete() Contact.objects.all().delete() Website.objects.all().delete() @@ -1619,7 +1619,7 @@ class TestDomainInformationAdmin(TestCase): def tearDown(self): """Delete all Users, Domains, and UserDomainRoles""" DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() Domain.objects.all().delete() Contact.objects.all().delete() User.objects.all().delete() @@ -1637,7 +1637,7 @@ class TestDomainInformationAdmin(TestCase): "type_of_work", "more_organization_information", "domain", - "domain_request", + "domain_application", "submitter", "no_other_contacts_rationale", "anything_else", @@ -1811,7 +1811,7 @@ class ListHeaderAdminTest(TestCase): def setUp(self): self.site = AdminSite() self.factory = RequestFactory() - self.admin = ListHeaderAdmin(model=DomainRequest, admin_site=None) + self.admin = ListHeaderAdmin(model=DomainApplication, admin_site=None) self.client = Client(HTTP_HOST="localhost:8080") self.superuser = create_superuser() @@ -1826,7 +1826,7 @@ class ListHeaderAdminTest(TestCase): # which handles CSRF # Follow=True handles the redirect response = self.client.get( - "/admin/registrar/domainrequest/", + "/admin/registrar/domainapplication/", { "status__exact": "started", "investigator__id__exact": user.id, @@ -1874,9 +1874,9 @@ class ListHeaderAdminTest(TestCase): ) def tearDown(self): - # delete any domain requests too + # delete any applications too DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() User.objects.all().delete() @@ -1945,24 +1945,24 @@ class AuditedAdminTest(TestCase): return ordered_list - def test_alphabetically_sorted_domain_request_investigator(self): + def test_alphabetically_sorted_domain_application_investigator(self): """Tests if the investigator field is alphabetically sorted by mimicking the call event flow""" - # Creates multiple domain requests - review status does not matter - domain_requests = multiple_unalphabetical_domain_objects("domain_request") + # Creates multiple domain applications - review status does not matter + applications = multiple_unalphabetical_domain_objects("application") # Create a mock request - domain_request_request = self.factory.post( - "/admin/registrar/domainrequest/{}/change/".format(domain_requests[0].pk) + application_request = self.factory.post( + "/admin/registrar/domainapplication/{}/change/".format(applications[0].pk) ) - # Get the formfield data from the domain request page - domain_request_admin = AuditedAdmin(DomainRequest, self.site) - field = DomainRequest.investigator.field - domain_request_queryset = domain_request_admin.formfield_for_foreignkey(field, domain_request_request).queryset + # Get the formfield data from the application page + application_admin = AuditedAdmin(DomainApplication, self.site) + field = DomainApplication.investigator.field + application_queryset = application_admin.formfield_for_foreignkey(field, application_request).queryset request = self.factory.post( - "/admin/autocomplete/?app_label=registrar&model_name=domainrequest&field_name=investigator" + "/admin/autocomplete/?app_label=registrar&model_name=domainapplication&field_name=investigator" ) sorted_fields = ["first_name", "last_name", "email"] @@ -1970,7 +1970,7 @@ class AuditedAdminTest(TestCase): # Grab the data returned from get search results admin = MyUserAdmin(User, self.site) - search_queryset = admin.get_search_results(request, domain_request_queryset, None)[0] + search_queryset = admin.get_search_results(request, application_queryset, None)[0] current_sort_order = list(search_queryset) self.assertEqual( @@ -1980,23 +1980,23 @@ class AuditedAdminTest(TestCase): ) # This test case should be refactored in general, as it is too overly specific and engineered - def test_alphabetically_sorted_fk_fields_domain_request(self): + def test_alphabetically_sorted_fk_fields_domain_application(self): with less_console_noise(): tested_fields = [ - DomainRequest.authorizing_official.field, - DomainRequest.submitter.field, - # DomainRequest.investigator.field, - DomainRequest.creator.field, - DomainRequest.requested_domain.field, + DomainApplication.authorizing_official.field, + DomainApplication.submitter.field, + # DomainApplication.investigator.field, + DomainApplication.creator.field, + DomainApplication.requested_domain.field, ] - # Creates multiple domain requests - review status does not matter - domain_requests = multiple_unalphabetical_domain_objects("domain_request") + # Creates multiple domain applications - review status does not matter + applications = multiple_unalphabetical_domain_objects("application") # Create a mock request - request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_requests[0].pk)) + request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(applications[0].pk)) - model_admin = AuditedAdmin(DomainRequest, self.site) + model_admin = AuditedAdmin(DomainApplication, self.site) sorted_fields = [] # Typically we wouldn't want two nested for fields, @@ -2004,7 +2004,7 @@ class AuditedAdminTest(TestCase): # For test case purposes, this should be performant. for field in tested_fields: with self.subTest(field=field): - isNamefield: bool = field == DomainRequest.requested_domain.field + isNamefield: bool = field == DomainApplication.requested_domain.field if isNamefield: sorted_fields = ["name"] else: @@ -2045,13 +2045,13 @@ class AuditedAdminTest(TestCase): DomainInformation.submitter.field, # DomainInformation.creator.field, (DomainInformation.domain.field, ["name"]), - (DomainInformation.domain_request.field, ["requested_domain__name"]), + (DomainInformation.domain_application.field, ["requested_domain__name"]), ] - # Creates multiple domain requests - review status does not matter - domain_requests = multiple_unalphabetical_domain_objects("information") + # Creates multiple domain applications - review status does not matter + applications = multiple_unalphabetical_domain_objects("information") # Create a mock request - request = self.factory.post("/admin/registrar/domaininformation/{}/change/".format(domain_requests[0].pk)) + request = self.factory.post("/admin/registrar/domaininformation/{}/change/".format(applications[0].pk)) model_admin = AuditedAdmin(DomainInformation, self.site) @@ -2085,7 +2085,7 @@ class AuditedAdminTest(TestCase): last = obj.last_name elif field_obj == DomainInformation.domain.field: first = obj.name - elif field_obj == DomainInformation.domain_request.field: + elif field_obj == DomainInformation.domain_application.field: first = obj.requested_domain.name name_tuple = self.coerced_fk_field_helper(first, last, field_obj.name, ":") @@ -2102,11 +2102,11 @@ class AuditedAdminTest(TestCase): with less_console_noise(): tested_fields = [DomainInvitation.domain.field] - # Creates multiple domain requests - review status does not matter - domain_requests = multiple_unalphabetical_domain_objects("invitation") + # Creates multiple domain applications - review status does not matter + applications = multiple_unalphabetical_domain_objects("invitation") # Create a mock request - request = self.factory.post("/admin/registrar/domaininvitation/{}/change/".format(domain_requests[0].pk)) + request = self.factory.post("/admin/registrar/domaininvitation/{}/change/".format(applications[0].pk)) model_admin = AuditedAdmin(DomainInvitation, self.site) @@ -2158,7 +2158,7 @@ class AuditedAdminTest(TestCase): def tearDown(self): DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() DomainInvitation.objects.all().delete() @@ -2330,10 +2330,10 @@ class ContactAdminTest(TestCase): contact, _ = Contact.objects.get_or_create(user=self.staffuser) # join it to 4 domain requests. The 5th join will be a user. - domain_request1 = completed_domain_request(submitter=contact, name="city1.gov") - domain_request2 = completed_domain_request(submitter=contact, name="city2.gov") - domain_request3 = completed_domain_request(submitter=contact, name="city3.gov") - domain_request4 = completed_domain_request(submitter=contact, name="city4.gov") + application1 = completed_application(submitter=contact, name="city1.gov") + application2 = completed_application(submitter=contact, name="city2.gov") + application3 = completed_application(submitter=contact, name="city3.gov") + application4 = completed_application(submitter=contact, name="city4.gov") with patch("django.contrib.messages.warning") as mock_warning: # Use the test client to simulate the request @@ -2344,14 +2344,14 @@ class ContactAdminTest(TestCase): mock_warning.assert_called_once_with( response.wsgi_request, "", @@ -2365,11 +2365,11 @@ class ContactAdminTest(TestCase): # Create an instance of the model # join it to 5 domain requests. The 6th join will be a user. contact, _ = Contact.objects.get_or_create(user=self.staffuser) - domain_request1 = completed_domain_request(submitter=contact, name="city1.gov") - domain_request2 = completed_domain_request(submitter=contact, name="city2.gov") - domain_request3 = completed_domain_request(submitter=contact, name="city3.gov") - domain_request4 = completed_domain_request(submitter=contact, name="city4.gov") - domain_request5 = completed_domain_request(submitter=contact, name="city5.gov") + application1 = completed_application(submitter=contact, name="city1.gov") + application2 = completed_application(submitter=contact, name="city2.gov") + application3 = completed_application(submitter=contact, name="city3.gov") + application4 = completed_application(submitter=contact, name="city4.gov") + application5 = completed_application(submitter=contact, name="city5.gov") with patch("django.contrib.messages.warning") as mock_warning: # Use the test client to simulate the request response = self.client.get(reverse("admin:registrar_contact_change", args=[contact.pk])) @@ -2379,22 +2379,22 @@ class ContactAdminTest(TestCase): mock_warning.assert_called_once_with( response.wsgi_request, "" "

And 1 more...

", ) def tearDown(self): - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() Contact.objects.all().delete() User.objects.all().delete() diff --git a/src/registrar/tests/test_emails.py b/src/registrar/tests/test_emails.py index a4807545b..f2a94a186 100644 --- a/src/registrar/tests/test_emails.py +++ b/src/registrar/tests/test_emails.py @@ -3,7 +3,7 @@ from unittest.mock import MagicMock from django.test import TestCase -from .common import completed_domain_request, less_console_noise +from .common import completed_application, less_console_noise import boto3_mocking # type: ignore @@ -17,11 +17,11 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation(self): """Submission confirmation email works.""" - domain_request = completed_domain_request() + application = completed_application() with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() # check that an email was sent self.assertTrue(self.mock_client.send_email.called) @@ -55,10 +55,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_no_current_website_spacing(self): """Test line spacing without current_website.""" - domain_request = completed_domain_request(has_current_website=False) + application = completed_application(has_current_website=False) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertNotIn("Current websites:", body) @@ -68,10 +68,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_current_website_spacing(self): """Test line spacing with current_website.""" - domain_request = completed_domain_request(has_current_website=True) + application = completed_application(has_current_website=True) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertIn("Current websites:", body) @@ -82,10 +82,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_other_contacts_spacing(self): """Test line spacing with other contacts.""" - domain_request = completed_domain_request(has_other_contacts=True) + application = completed_application(has_other_contacts=True) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertIn("Other employees from your organization:", body) @@ -96,10 +96,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_no_other_contacts_spacing(self): """Test line spacing without other contacts.""" - domain_request = completed_domain_request(has_other_contacts=False) + application = completed_application(has_other_contacts=False) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] # spacing should be right between adjacent elements @@ -109,10 +109,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_alternative_govdomain_spacing(self): """Test line spacing with alternative .gov domain.""" - domain_request = completed_domain_request(has_alternative_gov_domain=True) + application = completed_application(has_alternative_gov_domain=True) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertIn("city1.gov", body) @@ -122,10 +122,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_no_alternative_govdomain_spacing(self): """Test line spacing without alternative .gov domain.""" - domain_request = completed_domain_request(has_alternative_gov_domain=False) + application = completed_application(has_alternative_gov_domain=False) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertNotIn("city1.gov", body) @@ -135,10 +135,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_about_your_organization_spacing(self): """Test line spacing with about your organization.""" - domain_request = completed_domain_request(has_about_your_organization=True) + application = completed_application(has_about_your_organization=True) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertIn("About your organization:", body) @@ -148,10 +148,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_no_about_your_organization_spacing(self): """Test line spacing without about your organization.""" - domain_request = completed_domain_request(has_about_your_organization=False) + application = completed_application(has_about_your_organization=False) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertNotIn("About your organization:", body) @@ -161,10 +161,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_anything_else_spacing(self): """Test line spacing with anything else.""" - domain_request = completed_domain_request(has_anything_else=True) + application = completed_application(has_anything_else=True) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] # spacing should be right between adjacent elements @@ -173,10 +173,10 @@ class TestEmails(TestCase): @boto3_mocking.patching def test_submission_confirmation_no_anything_else_spacing(self): """Test line spacing without anything else.""" - domain_request = completed_domain_request(has_anything_else=False) + application = completed_application(has_anything_else=False) with boto3_mocking.clients.handler_for("sesv2", self.mock_client_class): with less_console_noise(): - domain_request.submit() + application.submit() _, kwargs = self.mock_client.send_email.call_args body = kwargs["Content"]["Simple"]["Body"]["Text"]["Data"] self.assertNotIn("Anything else", body) diff --git a/src/registrar/tests/test_forms.py b/src/registrar/tests/test_forms.py index 8f85631a9..c9dd3c4f0 100644 --- a/src/registrar/tests/test_forms.py +++ b/src/registrar/tests/test_forms.py @@ -4,7 +4,7 @@ import json from django.test import TestCase, RequestFactory from api.views import available -from registrar.forms.domain_request_wizard import ( +from registrar.forms.application_wizard import ( AlternativeDomainForm, CurrentSitesForm, DotGovDomainForm, diff --git a/src/registrar/tests/test_migrations.py b/src/registrar/tests/test_migrations.py index 50861d97f..773a885c1 100644 --- a/src/registrar/tests/test_migrations.py +++ b/src/registrar/tests/test_migrations.py @@ -34,10 +34,10 @@ class TestGroups(TestCase): "view_logentry", "change_contact", "view_domain", + "change_domainapplication", "change_domaininformation", "add_domaininvitation", "view_domaininvitation", - "change_domainrequest", "change_draftdomain", "analyst_access_permission", "change_user", diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index 9b12dbf98..f243956ff 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -4,7 +4,7 @@ from unittest.mock import patch from registrar.models import ( Contact, - DomainRequest, + DomainApplication, DomainInformation, User, Website, @@ -17,39 +17,39 @@ from registrar.models import ( import boto3_mocking from registrar.models.transition_domain import TransitionDomain from registrar.models.verified_by_staff import VerifiedByStaff # type: ignore -from .common import MockSESClient, less_console_noise, completed_domain_request +from .common import MockSESClient, less_console_noise, completed_application from django_fsm import TransitionNotAllowed # Test comment for push -- will remove -# The DomainRequest submit method has a side effect of sending an email +# The DomainApplication submit method has a side effect of sending an email # with AWS SES, so mock that out in all of these test cases @boto3_mocking.patching -class TestDomainRequest(TestCase): +class TestDomainApplication(TestCase): def setUp(self): - self.started_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.STARTED, name="started.gov" + self.started_application = completed_application( + status=DomainApplication.ApplicationStatus.STARTED, name="started.gov" ) - self.submitted_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.SUBMITTED, name="submitted.gov" + self.submitted_application = completed_application( + status=DomainApplication.ApplicationStatus.SUBMITTED, name="submitted.gov" ) - self.in_review_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.IN_REVIEW, name="in-review.gov" + self.in_review_application = completed_application( + status=DomainApplication.ApplicationStatus.IN_REVIEW, name="in-review.gov" ) - self.action_needed_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.ACTION_NEEDED, name="action-needed.gov" + self.action_needed_application = completed_application( + status=DomainApplication.ApplicationStatus.ACTION_NEEDED, name="action-needed.gov" ) - self.approved_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.APPROVED, name="approved.gov" + self.approved_application = completed_application( + status=DomainApplication.ApplicationStatus.APPROVED, name="approved.gov" ) - self.withdrawn_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.WITHDRAWN, name="withdrawn.gov" + self.withdrawn_application = completed_application( + status=DomainApplication.ApplicationStatus.WITHDRAWN, name="withdrawn.gov" ) - self.rejected_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.REJECTED, name="rejected.gov" + self.rejected_application = completed_application( + status=DomainApplication.ApplicationStatus.REJECTED, name="rejected.gov" ) - self.ineligible_domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.INELIGIBLE, name="ineligible.gov" + self.ineligible_application = completed_application( + status=DomainApplication.ApplicationStatus.INELIGIBLE, name="ineligible.gov" ) self.mock_client = MockSESClient() @@ -64,19 +64,19 @@ class TestDomainRequest(TestCase): return self.assertRaises(Exception, None, exception_type) def test_empty_create_fails(self): - """Can't create a completely empty domain request. + """Can't create a completely empty domain application. NOTE: something about theexception this test raises messes up with the atomic block in a custom tearDown method for the parent test class.""" with less_console_noise(): with self.assertRaisesRegex(IntegrityError, "creator"): - DomainRequest.objects.create() + DomainApplication.objects.create() def test_minimal_create(self): """Can create with just a creator.""" with less_console_noise(): user, _ = User.objects.get_or_create(username="testy") - domain_request = DomainRequest.objects.create(creator=user) - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.STARTED) + application = DomainApplication.objects.create(creator=user) + self.assertEqual(application.status, DomainApplication.ApplicationStatus.STARTED) def test_full_create(self): """Can create with all fields.""" @@ -86,11 +86,11 @@ class TestDomainRequest(TestCase): com_website, _ = Website.objects.get_or_create(website="igorville.com") gov_website, _ = Website.objects.get_or_create(website="igorville.gov") domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov") - domain_request = DomainRequest.objects.create( + application = DomainApplication.objects.create( creator=user, investigator=user, - organization_type=DomainRequest.OrganizationChoices.FEDERAL, - federal_type=DomainRequest.BranchChoices.EXECUTIVE, + organization_type=DomainApplication.OrganizationChoices.FEDERAL, + federal_type=DomainApplication.BranchChoices.EXECUTIVE, is_election_board=False, organization_name="Test", address_line1="100 Main St.", @@ -104,10 +104,10 @@ class TestDomainRequest(TestCase): anything_else="All of Igorville loves the dotgov program.", is_policy_acknowledged=True, ) - domain_request.current_websites.add(com_website) - domain_request.alternative_domains.add(gov_website) - domain_request.other_contacts.add(contact) - domain_request.save() + application.current_websites.add(com_website) + application.alternative_domains.add(gov_website) + application.other_contacts.add(contact) + application.save() def test_domain_info(self): """Can create domain info with all fields.""" @@ -140,35 +140,35 @@ class TestDomainRequest(TestCase): def test_status_fsm_submit_fail(self): with less_console_noise(): user, _ = User.objects.get_or_create(username="testy") - domain_request = DomainRequest.objects.create(creator=user) + application = DomainApplication.objects.create(creator=user) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): with self.assertRaises(ValueError): - # can't submit a domain request with a null domain name - domain_request.submit() + # can't submit an application with a null domain name + application.submit() def test_status_fsm_submit_succeed(self): with less_console_noise(): user, _ = User.objects.get_or_create(username="testy") site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create(creator=user, requested_domain=site) + application = DomainApplication.objects.create(creator=user, requested_domain=site) # no submitter email so this emits a log warning with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - domain_request.submit() - self.assertEqual(domain_request.status, domain_request.DomainRequestStatus.SUBMITTED) + application.submit() + self.assertEqual(application.status, application.ApplicationStatus.SUBMITTED) - def check_email_sent(self, domain_request, msg, action, expected_count): + def check_email_sent(self, application, msg, action, expected_count): """Check if an email was sent after performing an action.""" with self.subTest(msg=msg, action=action): with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): # Perform the specified action - action_method = getattr(domain_request, action) + action_method = getattr(application, action) action_method() # Check if an email was sent @@ -180,62 +180,62 @@ class TestDomainRequest(TestCase): self.assertEqual(len(sent_emails), expected_count) def test_submit_from_started_sends_email(self): - msg = "Create a domain request and submit it and see if email was sent." - domain_request = completed_domain_request() - self.check_email_sent(domain_request, msg, "submit", 1) + msg = "Create an application and submit it and see if email was sent." + application = completed_application() + self.check_email_sent(application, msg, "submit", 1) def test_submit_from_withdrawn_sends_email(self): - msg = "Create a withdrawn domain request and submit it and see if email was sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.WITHDRAWN) - self.check_email_sent(domain_request, msg, "submit", 1) + msg = "Create a withdrawn application and submit it and see if email was sent." + application = completed_application(status=DomainApplication.ApplicationStatus.WITHDRAWN) + self.check_email_sent(application, msg, "submit", 1) def test_submit_from_action_needed_does_not_send_email(self): - msg = "Create a domain request with ACTION_NEEDED status and submit it, check if email was not sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.ACTION_NEEDED) - self.check_email_sent(domain_request, msg, "submit", 0) + msg = "Create an application with ACTION_NEEDED status and submit it, check if email was not sent." + application = completed_application(status=DomainApplication.ApplicationStatus.ACTION_NEEDED) + self.check_email_sent(application, msg, "submit", 0) def test_submit_from_in_review_does_not_send_email(self): - msg = "Create a withdrawn domain request and submit it and see if email was sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) - self.check_email_sent(domain_request, msg, "submit", 0) + msg = "Create a withdrawn application and submit it and see if email was sent." + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) + self.check_email_sent(application, msg, "submit", 0) def test_approve_sends_email(self): - msg = "Create a domain request and approve it and see if email was sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) - self.check_email_sent(domain_request, msg, "approve", 1) + msg = "Create an application and approve it and see if email was sent." + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) + self.check_email_sent(application, msg, "approve", 1) def test_withdraw_sends_email(self): - msg = "Create a domain request and withdraw it and see if email was sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) - self.check_email_sent(domain_request, msg, "withdraw", 1) + msg = "Create an application and withdraw it and see if email was sent." + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) + self.check_email_sent(application, msg, "withdraw", 1) def test_reject_sends_email(self): - msg = "Create a domain request and reject it and see if email was sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED) - self.check_email_sent(domain_request, msg, "reject", 1) + msg = "Create an application and reject it and see if email was sent." + application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED) + self.check_email_sent(application, msg, "reject", 1) def test_reject_with_prejudice_does_not_send_email(self): - msg = "Create a domain request and reject it with prejudice and see if email was sent." - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED) - self.check_email_sent(domain_request, msg, "reject_with_prejudice", 0) + msg = "Create an application and reject it with prejudice and see if email was sent." + application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED) + self.check_email_sent(application, msg, "reject_with_prejudice", 0) def test_submit_transition_allowed(self): """ Test that calling submit from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.in_review_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.submit() + application.submit() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -244,37 +244,37 @@ class TestDomainRequest(TestCase): Test that calling submit against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.submitted_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.submit() + application.submit() def test_in_review_transition_allowed(self): """ Test that calling in_review from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.submitted_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.in_review() + application.in_review() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -283,33 +283,33 @@ class TestDomainRequest(TestCase): Test that calling in_review against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.in_review_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.in_review() + application.in_review() def test_action_needed_transition_allowed(self): """ Test that calling action_needed from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.in_review_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.action_needed() + application.action_needed() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -318,34 +318,34 @@ class TestDomainRequest(TestCase): Test that calling action_needed against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.submitted_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), ] with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.action_needed() + application.action_needed() def test_approved_transition_allowed(self): """ Test that calling action_needed from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.submitted_domain_request, TransitionNotAllowed), - (self.in_review_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.approve() + application.approve() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -357,7 +357,7 @@ class TestDomainRequest(TestCase): with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - self.submitted_domain_request.approve(send_email=False) + self.submitted_application.approve(send_email=False) # Assert that no emails were sent self.assertEqual(len(self.mock_client.EMAILS_SENT), 0) @@ -367,35 +367,35 @@ class TestDomainRequest(TestCase): Test that calling action_needed against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.approve() + application.approve() def test_withdraw_transition_allowed(self): """ Test that calling action_needed from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.submitted_domain_request, TransitionNotAllowed), - (self.in_review_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.withdraw() + application.withdraw() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -404,36 +404,36 @@ class TestDomainRequest(TestCase): Test that calling action_needed against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.withdraw() + application.withdraw() def test_reject_transition_allowed(self): """ Test that calling action_needed from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.in_review_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.reject() + application.reject() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -442,37 +442,37 @@ class TestDomainRequest(TestCase): Test that calling action_needed against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.submitted_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.reject() + application.reject() def test_reject_with_prejudice_transition_allowed(self): """ Test that calling action_needed from allowable statuses does raises TransitionNotAllowed. """ test_cases = [ - (self.in_review_domain_request, TransitionNotAllowed), - (self.action_needed_domain_request, TransitionNotAllowed), - (self.approved_domain_request, TransitionNotAllowed), - (self.rejected_domain_request, TransitionNotAllowed), + (self.in_review_application, TransitionNotAllowed), + (self.action_needed_application, TransitionNotAllowed), + (self.approved_application, TransitionNotAllowed), + (self.rejected_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): try: - domain_request.reject_with_prejudice() + application.reject_with_prejudice() except TransitionNotAllowed: self.fail("TransitionNotAllowed was raised, but it was not expected.") @@ -481,26 +481,26 @@ class TestDomainRequest(TestCase): Test that calling action_needed against transition rules raises TransitionNotAllowed. """ test_cases = [ - (self.started_domain_request, TransitionNotAllowed), - (self.submitted_domain_request, TransitionNotAllowed), - (self.withdrawn_domain_request, TransitionNotAllowed), - (self.ineligible_domain_request, TransitionNotAllowed), + (self.started_application, TransitionNotAllowed), + (self.submitted_application, TransitionNotAllowed), + (self.withdrawn_application, TransitionNotAllowed), + (self.ineligible_application, TransitionNotAllowed), ] with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): - for domain_request, exception_type in test_cases: - with self.subTest(domain_request=domain_request, exception_type=exception_type): + for application, exception_type in test_cases: + with self.subTest(application=application, exception_type=exception_type): with self.assertRaises(exception_type): - domain_request.reject_with_prejudice() + application.reject_with_prejudice() def test_transition_not_allowed_approved_in_review_when_domain_is_active(self): - """Create a domain request with status approved, create a matching domain that + """Create an application with status approved, create a matching domain that is active, and call in_review against transition rules""" - domain = Domain.objects.create(name=self.approved_domain_request.requested_domain.name) - self.approved_domain_request.approved_domain = domain - self.approved_domain_request.save() + domain = Domain.objects.create(name=self.approved_application.requested_domain.name) + self.approved_application.approved_domain = domain + self.approved_application.save() # Define a custom implementation for is_active def custom_is_active(self): @@ -512,15 +512,15 @@ class TestDomainRequest(TestCase): with patch.object(Domain, "is_active", custom_is_active): # Now, when you call is_active on Domain, it will return True with self.assertRaises(TransitionNotAllowed): - self.approved_domain_request.in_review() + self.approved_application.in_review() def test_transition_not_allowed_approved_action_needed_when_domain_is_active(self): - """Create a domain request with status approved, create a matching domain that + """Create an application with status approved, create a matching domain that is active, and call action_needed against transition rules""" - domain = Domain.objects.create(name=self.approved_domain_request.requested_domain.name) - self.approved_domain_request.approved_domain = domain - self.approved_domain_request.save() + domain = Domain.objects.create(name=self.approved_application.requested_domain.name) + self.approved_application.approved_domain = domain + self.approved_application.save() # Define a custom implementation for is_active def custom_is_active(self): @@ -532,15 +532,15 @@ class TestDomainRequest(TestCase): with patch.object(Domain, "is_active", custom_is_active): # Now, when you call is_active on Domain, it will return True with self.assertRaises(TransitionNotAllowed): - self.approved_domain_request.action_needed() + self.approved_application.action_needed() def test_transition_not_allowed_approved_rejected_when_domain_is_active(self): - """Create a domain request with status approved, create a matching domain that + """Create an application with status approved, create a matching domain that is active, and call reject against transition rules""" - domain = Domain.objects.create(name=self.approved_domain_request.requested_domain.name) - self.approved_domain_request.approved_domain = domain - self.approved_domain_request.save() + domain = Domain.objects.create(name=self.approved_application.requested_domain.name) + self.approved_application.approved_domain = domain + self.approved_application.save() # Define a custom implementation for is_active def custom_is_active(self): @@ -552,15 +552,15 @@ class TestDomainRequest(TestCase): with patch.object(Domain, "is_active", custom_is_active): # Now, when you call is_active on Domain, it will return True with self.assertRaises(TransitionNotAllowed): - self.approved_domain_request.reject() + self.approved_application.reject() def test_transition_not_allowed_approved_ineligible_when_domain_is_active(self): - """Create a domain request with status approved, create a matching domain that + """Create an application with status approved, create a matching domain that is active, and call reject_with_prejudice against transition rules""" - domain = Domain.objects.create(name=self.approved_domain_request.requested_domain.name) - self.approved_domain_request.approved_domain = domain - self.approved_domain_request.save() + domain = Domain.objects.create(name=self.approved_application.requested_domain.name) + self.approved_application.approved_domain = domain + self.approved_application.save() # Define a custom implementation for is_active def custom_is_active(self): @@ -572,83 +572,83 @@ class TestDomainRequest(TestCase): with patch.object(Domain, "is_active", custom_is_active): # Now, when you call is_active on Domain, it will return True with self.assertRaises(TransitionNotAllowed): - self.approved_domain_request.reject_with_prejudice() + self.approved_application.reject_with_prejudice() def test_approve_from_rejected_clears_rejection_reason(self): """When transitioning from rejected to approved on a domain request, the rejection_reason is cleared.""" with less_console_noise(): - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.REJECTED) - domain_request.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.REJECTED) + application.rejection_reason = DomainApplication.RejectionReasons.DOMAIN_PURPOSE # Approve with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - domain_request.approve() + application.approve() - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.APPROVED) - self.assertEqual(domain_request.rejection_reason, None) + self.assertEqual(application.status, DomainApplication.ApplicationStatus.APPROVED) + self.assertEqual(application.rejection_reason, None) def test_in_review_from_rejected_clears_rejection_reason(self): """When transitioning from rejected to in_review on a domain request, the rejection_reason is cleared.""" with less_console_noise(): - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.REJECTED) - domain_request.domain_is_not_active = True - domain_request.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.REJECTED) + application.domain_is_not_active = True + application.rejection_reason = DomainApplication.RejectionReasons.DOMAIN_PURPOSE # Approve with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - domain_request.in_review() + application.in_review() - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.IN_REVIEW) - self.assertEqual(domain_request.rejection_reason, None) + self.assertEqual(application.status, DomainApplication.ApplicationStatus.IN_REVIEW) + self.assertEqual(application.rejection_reason, None) def test_action_needed_from_rejected_clears_rejection_reason(self): """When transitioning from rejected to action_needed on a domain request, the rejection_reason is cleared.""" with less_console_noise(): - # Create a sample domain request - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.REJECTED) - domain_request.domain_is_not_active = True - domain_request.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE + # Create a sample application + application = completed_application(status=DomainApplication.ApplicationStatus.REJECTED) + application.domain_is_not_active = True + application.rejection_reason = DomainApplication.RejectionReasons.DOMAIN_PURPOSE # Approve with boto3_mocking.clients.handler_for("sesv2", self.mock_client): - domain_request.action_needed() + application.action_needed() - self.assertEqual(domain_request.status, DomainRequest.DomainRequestStatus.ACTION_NEEDED) - self.assertEqual(domain_request.rejection_reason, None) + self.assertEqual(application.status, DomainApplication.ApplicationStatus.ACTION_NEEDED) + self.assertEqual(application.rejection_reason, None) def test_has_rationale_returns_true(self): - """has_rationale() returns true when a domain request has no_other_contacts_rationale""" + """has_rationale() returns true when an application has no_other_contacts_rationale""" with less_console_noise(): - self.started_domain_request.no_other_contacts_rationale = "You talkin' to me?" - self.started_domain_request.save() - self.assertEquals(self.started_domain_request.has_rationale(), True) + self.started_application.no_other_contacts_rationale = "You talkin' to me?" + self.started_application.save() + self.assertEquals(self.started_application.has_rationale(), True) def test_has_rationale_returns_false(self): - """has_rationale() returns false when a domain request has no no_other_contacts_rationale""" + """has_rationale() returns false when an application has no no_other_contacts_rationale""" with less_console_noise(): - self.assertEquals(self.started_domain_request.has_rationale(), False) + self.assertEquals(self.started_application.has_rationale(), False) def test_has_other_contacts_returns_true(self): - """has_other_contacts() returns true when a domain request has other_contacts""" + """has_other_contacts() returns true when an application has other_contacts""" with less_console_noise(): - # completed_domain_request has other contacts by default - self.assertEquals(self.started_domain_request.has_other_contacts(), True) + # completed_application has other contacts by default + self.assertEquals(self.started_application.has_other_contacts(), True) def test_has_other_contacts_returns_false(self): - """has_other_contacts() returns false when a domain request has no other_contacts""" + """has_other_contacts() returns false when an application has no other_contacts""" with less_console_noise(): - domain_request = completed_domain_request( - status=DomainRequest.DomainRequestStatus.STARTED, name="no-others.gov", has_other_contacts=False + application = completed_application( + status=DomainApplication.ApplicationStatus.STARTED, name="no-others.gov", has_other_contacts=False ) - self.assertEquals(domain_request.has_other_contacts(), False) + self.assertEquals(application.has_other_contacts(), False) class TestPermissions(TestCase): @@ -666,13 +666,13 @@ class TestPermissions(TestCase): def test_approval_creates_role(self): draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov") user, _ = User.objects.get_or_create() - domain_request = DomainRequest.objects.create(creator=user, requested_domain=draft_domain) + application = DomainApplication.objects.create(creator=user, requested_domain=draft_domain) with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): # skip using the submit method - domain_request.status = DomainRequest.DomainRequestStatus.SUBMITTED - domain_request.approve() + application.status = DomainApplication.ApplicationStatus.SUBMITTED + application.approve() # should be a role for this user domain = Domain.objects.get(name="igorville.gov") @@ -691,7 +691,7 @@ class TestDomainInformation(TestCase): self.mock_client.EMAILS_SENT.clear() Domain.objects.all().delete() DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() User.objects.all().delete() DraftDomain.objects.all().delete() @@ -700,13 +700,13 @@ class TestDomainInformation(TestCase): self.maxDiff = None draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov") user, _ = User.objects.get_or_create() - domain_request = DomainRequest.objects.create(creator=user, requested_domain=draft_domain, notes="test notes") + application = DomainApplication.objects.create(creator=user, requested_domain=draft_domain, notes="test notes") with boto3_mocking.clients.handler_for("sesv2", self.mock_client): with less_console_noise(): # skip using the submit method - domain_request.status = DomainRequest.DomainRequestStatus.SUBMITTED - domain_request.approve() + application.status = DomainApplication.ApplicationStatus.SUBMITTED + application.approve() # should be an information present for this domain domain = Domain.objects.get(name="igorville.gov") @@ -719,7 +719,7 @@ class TestDomainInformation(TestCase): creator=user, domain=domain, notes="test notes", - domain_request=domain_request, + domain_application=application, ).__dict__ # Test the two records for consistency @@ -852,11 +852,11 @@ class TestContact(TestCase): self.contact, _ = Contact.objects.get_or_create(user=self.user) self.contact_as_ao, _ = Contact.objects.get_or_create(email="newguy@igorville.gov") - self.domain_request = DomainRequest.objects.create(creator=self.user, authorizing_official=self.contact_as_ao) + self.application = DomainApplication.objects.create(creator=self.user, authorizing_official=self.contact_as_ao) def tearDown(self): super().tearDown() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() Contact.objects.all().delete() User.objects.all().delete() @@ -936,6 +936,6 @@ class TestContact(TestCase): # test for a contact which has one user defined self.assertFalse(self.contact.has_more_than_one_join("user")) self.assertTrue(self.contact.has_more_than_one_join("authorizing_official")) - # test for a contact which is assigned as an authorizing official on a domain request + # test for a contact which is assigned as an authorizing official on an application self.assertFalse(self.contact_as_ao.has_more_than_one_join("authorizing_official")) - self.assertTrue(self.contact_as_ao.has_more_than_one_join("submitted_domain_requests")) + self.assertTrue(self.contact_as_ao.has_more_than_one_join("submitted_applications")) diff --git a/src/registrar/tests/test_models_domain.py b/src/registrar/tests/test_models_domain.py index fd47d907f..d99eaa25c 100644 --- a/src/registrar/tests/test_models_domain.py +++ b/src/registrar/tests/test_models_domain.py @@ -12,7 +12,7 @@ from django.utils.timezone import make_aware from registrar.models import Domain, Host, HostIP from unittest import skip -from registrar.models.domain_request import DomainRequest +from registrar.models.domain_application import DomainApplication from registrar.models.domain_information import DomainInformation from registrar.models.draft_domain import DraftDomain from registrar.models.public_contact import PublicContact @@ -311,27 +311,27 @@ class TestDomainCache(MockEppLib): class TestDomainCreation(MockEppLib): - """Rule: An approved domain request must result in a domain""" + """Rule: An approved domain application must result in a domain""" @boto3_mocking.patching - def test_approved_domain_request_creates_domain_locally(self): + def test_approved_application_creates_domain_locally(self): """ - Scenario: Analyst approves a domain request - When the DomainRequest transitions to approved + Scenario: Analyst approves a domain application + When the DomainApplication transitions to approved Then a Domain exists in the database with the same `name` But a domain object does not exist in the registry """ with less_console_noise(): draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov") user, _ = User.objects.get_or_create() - domain_request = DomainRequest.objects.create(creator=user, requested_domain=draft_domain) + application = DomainApplication.objects.create(creator=user, requested_domain=draft_domain) mock_client = MockSESClient() with boto3_mocking.clients.handler_for("sesv2", mock_client): # skip using the submit method - domain_request.status = DomainRequest.DomainRequestStatus.SUBMITTED + application.status = DomainApplication.ApplicationStatus.SUBMITTED # transition to approve state - domain_request.approve() + application.approve() # should have information present for this domain domain = Domain.objects.get(name="igorville.gov") self.assertTrue(domain) @@ -395,7 +395,7 @@ class TestDomainCreation(MockEppLib): def tearDown(self) -> None: DomainInformation.objects.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() PublicContact.objects.all().delete() Domain.objects.all().delete() User.objects.all().delete() diff --git a/src/registrar/tests/test_transition_domain_migrations.py b/src/registrar/tests/test_transition_domain_migrations.py index 9008a4f94..e9453bd03 100644 --- a/src/registrar/tests/test_transition_domain_migrations.py +++ b/src/registrar/tests/test_transition_domain_migrations.py @@ -27,7 +27,7 @@ logger = logging.getLogger(__name__) class TestProcessedMigrations(TestCase): """This test case class is designed to verify the idempotency of migrations - related to domain transitions in the domain_request.""" + related to domain transitions in the application.""" def setUp(self): """Defines the file name of migration_json and the folder its contained in""" diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index eec12e463..8f9a8e4fc 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -5,7 +5,7 @@ from .common import MockEppLib # type: ignore from registrar.models import ( - DomainRequest, + DomainApplication, DomainInformation, ) import logging @@ -26,8 +26,8 @@ class TestViews(TestCase): response = self.client.get("/") self.assertEqual(response.status_code, 302) - def test_domain_request_form_not_logged_in(self): - """Domain request form not accessible without a logged-in user.""" + def test_application_form_not_logged_in(self): + """Application form not accessible without a logged-in user.""" response = self.client.get("/request/") self.assertEqual(response.status_code, 302) self.assertIn("/login?next=/request/", response.headers["Location"]) @@ -45,9 +45,9 @@ class TestWithUser(MockEppLib): ) def tearDown(self): - # delete any domain requests too + # delete any applications too super().tearDown() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() DomainInformation.objects.all().delete() self.user.delete() diff --git a/src/registrar/tests/test_views_application.py b/src/registrar/tests/test_views_application.py index 1414d4525..7da906a8f 100644 --- a/src/registrar/tests/test_views_application.py +++ b/src/registrar/tests/test_views_application.py @@ -5,12 +5,12 @@ from django.conf import settings from django.urls import reverse from datetime import date -from .common import MockSESClient, completed_domain_request # type: ignore +from .common import MockSESClient, completed_application # type: ignore from django_webtest import WebTest # type: ignore import boto3_mocking # type: ignore from registrar.models import ( - DomainRequest, + DomainApplication, DraftDomain, Domain, DomainInformation, @@ -19,7 +19,7 @@ from registrar.models import ( Website, UserDomainRole, ) -from registrar.views.domain_request import DomainRequestWizard, Step +from registrar.views.application import ApplicationWizard, Step from .common import less_console_noise from .test_views import TestWithUser @@ -29,8 +29,8 @@ import logging logger = logging.getLogger(__name__) -class DomainRequestTests(TestWithUser, WebTest): - """Webtests for domain request to test filling and submitting.""" +class DomainApplicationTests(TestWithUser, WebTest): + """Webtests for domain application to test filling and submitting.""" # Doesn't work with CSRF checking # hypothesis is that CSRF_USE_SESSIONS is incompatible with WebTest @@ -39,16 +39,16 @@ class DomainRequestTests(TestWithUser, WebTest): def setUp(self): super().setUp() self.app.set_user(self.user.username) - self.TITLES = DomainRequestWizard.TITLES + self.TITLES = ApplicationWizard.TITLES - def test_domain_request_form_intro_acknowledgement(self): + def test_application_form_intro_acknowledgement(self): """Tests that user is presented with intro acknowledgement page""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) self.assertContains(intro_page, "You’re about to start your .gov domain request") - def test_domain_request_form_intro_is_skipped_when_edit_access(self): + def test_application_form_intro_is_skipped_when_edit_access(self): """Tests that user is NOT presented with intro acknowledgement page when accessed through 'edit'""" - completed_domain_request(status=DomainRequest.DomainRequestStatus.STARTED, user=self.user) + completed_application(status=DomainApplication.ApplicationStatus.STARTED, user=self.user) home_page = self.app.get("/") self.assertContains(home_page, "city.gov") # click the "Edit" link @@ -59,9 +59,9 @@ class DomainRequestTests(TestWithUser, WebTest): redirect_url = detail_page.url self.assertEqual(redirect_url, "/request/organization_type/") - def test_domain_request_form_empty_submit(self): + def test_application_form_empty_submit(self): """Tests empty submit on the first page after the acknowledgement page""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -81,19 +81,19 @@ class DomainRequestTests(TestWithUser, WebTest): result = type_page.forms[0].submit() self.assertIn("What kind of U.S.-based government organization do you represent?", result) - def test_domain_request_multiple_domain_requests_exist(self): - """Test that an info message appears when user has multiple domain requests already""" - # create and submit a domain request - domain_request = completed_domain_request(user=self.user) + def test_application_multiple_applications_exist(self): + """Test that an info message appears when user has multiple applications already""" + # create and submit an application + application = completed_application(user=self.user) mock_client = MockSESClient() with boto3_mocking.clients.handler_for("sesv2", mock_client): with less_console_noise(): - domain_request.submit() - domain_request.save() + application.submit() + application.save() # now, attempt to create another one with less_console_noise(): - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] intro_form = intro_page.forms[0] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) @@ -107,7 +107,7 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertContains(type_page, "You cannot submit this request yet") @boto3_mocking.patching - def test_domain_request_form_submission(self): + def test_application_form_submission(self): """ Can fill out the entire form and submit. As we add additional form pages, we need to include them here to make @@ -123,7 +123,7 @@ class DomainRequestTests(TestWithUser, WebTest): SKIPPED_PAGES = 3 num_pages = len(self.TITLES) - SKIPPED_PAGES - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -146,10 +146,10 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) type_result = type_form.submit() # should see results in db - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.organization_type, "federal") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.organization_type, "federal") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(type_result.status_code, 302) self.assertEqual(type_result["Location"], "/request/organization_federal/") num_pages_tested += 1 @@ -166,10 +166,10 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) federal_result = federal_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.federal_type, "executive") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.federal_type, "executive") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(federal_result.status_code, 302) self.assertEqual(federal_result["Location"], "/request/organization_contact/") num_pages_tested += 1 @@ -193,16 +193,16 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) org_contact_result = org_contact_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.organization_name, "Testorg") - self.assertEqual(domain_request.address_line1, "address 1") - self.assertEqual(domain_request.address_line2, "address 2") - self.assertEqual(domain_request.city, "NYC") - self.assertEqual(domain_request.state_territory, "NY") - self.assertEqual(domain_request.zipcode, "10002") - self.assertEqual(domain_request.urbanization, "URB Royal Oaks") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.organization_name, "Testorg") + self.assertEqual(application.address_line1, "address 1") + self.assertEqual(application.address_line2, "address 2") + self.assertEqual(application.city, "NYC") + self.assertEqual(application.state_territory, "NY") + self.assertEqual(application.zipcode, "10002") + self.assertEqual(application.urbanization, "URB Royal Oaks") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(org_contact_result.status_code, 302) self.assertEqual(org_contact_result["Location"], "/request/authorizing_official/") num_pages_tested += 1 @@ -221,13 +221,13 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) ao_result = ao_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.authorizing_official.first_name, "Testy ATO") - self.assertEqual(domain_request.authorizing_official.last_name, "Tester ATO") - self.assertEqual(domain_request.authorizing_official.title, "Chief Tester") - self.assertEqual(domain_request.authorizing_official.email, "testy@town.com") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.authorizing_official.first_name, "Testy ATO") + self.assertEqual(application.authorizing_official.last_name, "Tester ATO") + self.assertEqual(application.authorizing_official.title, "Chief Tester") + self.assertEqual(application.authorizing_official.email, "testy@town.com") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(ao_result.status_code, 302) self.assertEqual(ao_result["Location"], "/request/current_sites/") num_pages_tested += 1 @@ -243,13 +243,13 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) current_sites_result = current_sites_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one + application = DomainApplication.objects.get() # there's only one self.assertEqual( - domain_request.current_websites.filter(website="http://www.city.com").count(), + application.current_websites.filter(website="http://www.city.com").count(), 1, ) # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(current_sites_result.status_code, 302) self.assertEqual(current_sites_result["Location"], "/request/dotgov_domain/") num_pages_tested += 1 @@ -265,11 +265,11 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) dotgov_result = dotgov_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.requested_domain.name, "city.gov") - self.assertEqual(domain_request.alternative_domains.filter(website="city1.gov").count(), 1) + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.requested_domain.name, "city.gov") + self.assertEqual(application.alternative_domains.filter(website="city1.gov").count(), 1) # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(dotgov_result.status_code, 302) self.assertEqual(dotgov_result["Location"], "/request/purpose/") num_pages_tested += 1 @@ -285,10 +285,10 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) purpose_result = purpose_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.purpose, "For all kinds of things.") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.purpose, "For all kinds of things.") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(purpose_result.status_code, 302) self.assertEqual(purpose_result["Location"], "/request/your_contact/") num_pages_tested += 1 @@ -309,14 +309,14 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) your_contact_result = your_contact_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.submitter.first_name, "Testy you") - self.assertEqual(domain_request.submitter.last_name, "Tester you") - self.assertEqual(domain_request.submitter.title, "Admin Tester") - self.assertEqual(domain_request.submitter.email, "testy-admin@town.com") - self.assertEqual(domain_request.submitter.phone, "(201) 555 5556") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.submitter.first_name, "Testy you") + self.assertEqual(application.submitter.last_name, "Tester you") + self.assertEqual(application.submitter.title, "Admin Tester") + self.assertEqual(application.submitter.email, "testy-admin@town.com") + self.assertEqual(application.submitter.phone, "(201) 555 5556") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(your_contact_result.status_code, 302) self.assertEqual(your_contact_result["Location"], "/request/other_contacts/") num_pages_tested += 1 @@ -342,9 +342,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_result = other_contacts_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one + application = DomainApplication.objects.get() # there's only one self.assertEqual( - domain_request.other_contacts.filter( + application.other_contacts.filter( first_name="Testy2", last_name="Tester2", title="Another Tester", @@ -354,7 +354,7 @@ class DomainRequestTests(TestWithUser, WebTest): 1, ) # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(other_contacts_result.status_code, 302) self.assertEqual(other_contacts_result["Location"], "/request/anything_else/") num_pages_tested += 1 @@ -371,10 +371,10 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) anything_else_result = anything_else_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.anything_else, "Nothing else.") + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.anything_else, "Nothing else.") # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(anything_else_result.status_code, 302) self.assertEqual(anything_else_result["Location"], "/request/requirements/") num_pages_tested += 1 @@ -391,10 +391,10 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) requirements_result = requirements_form.submit() # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.is_policy_acknowledged, True) + application = DomainApplication.objects.get() # there's only one + self.assertEqual(application.is_policy_acknowledged, True) # the post request should return a redirect to the next form in - # the domain request page + # the application self.assertEqual(requirements_result.status_code, 302) self.assertEqual(requirements_result["Location"], "/request/review/") num_pages_tested += 1 @@ -441,7 +441,7 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertContains(review_page, "toggle-submit-domain-request") # And the existence of the modal's data parked and ready for the js init. # The next assert also tests for the passed requested domain context from - # the view > domain_request_form > modal + # the view > application_form > modal self.assertContains(review_page, "You are about to submit a domain request for city.gov") # final submission results in a redirect to the "finished" URL @@ -463,31 +463,31 @@ class DomainRequestTests(TestWithUser, WebTest): # check that any new pages are added to this test self.assertEqual(num_pages, num_pages_tested) - # This is the start of a test to check an existing domain_request, it currently + # This is the start of a test to check an existing application, it currently # does not work and results in errors as noted in: # https://github.com/cisagov/getgov/pull/728 @skip("WIP") - def test_domain_request_form_started_allsteps(self): + def test_application_form_started_allsteps(self): num_pages_tested = 0 # elections, type_of_work, tribal_government SKIPPED_PAGES = 3 DASHBOARD_PAGE = 1 num_pages = len(self.TITLES) - SKIPPED_PAGES + DASHBOARD_PAGE - domain_request = completed_domain_request(user=self.user) - domain_request.save() + application = completed_application(user=self.user) + application.save() home_page = self.app.get("/") self.assertContains(home_page, "city.gov") self.assertContains(home_page, "Started") num_pages_tested += 1 - # TODO: For some reason this click results in a new domain request being generated + # TODO: For some reason this click results in a new application being generated # This appraoch is an alternatie to using get as is being done below # # type_page = home_page.click("Edit") session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] - url = reverse("edit-domain-request", kwargs={"id": domain_request.pk}) + url = reverse("edit-application", kwargs={"id": application.pk}) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # TODO: The following line results in a django error on middleware @@ -498,9 +498,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertEqual(num_pages, num_pages_tested) - def test_domain_request_form_conditional_federal(self): + def test_application_form_conditional_federal(self): """Federal branch question is shown for federal organizations.""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -553,9 +553,9 @@ class DomainRequestTests(TestWithUser, WebTest): contact_page = federal_result.follow() self.assertContains(contact_page, "Federal agency") - def test_domain_request_form_conditional_elections(self): + def test_application_form_conditional_elections(self): """Election question is shown for other organizations.""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -607,9 +607,9 @@ class DomainRequestTests(TestWithUser, WebTest): contact_page = election_result.follow() self.assertNotContains(contact_page, "Federal agency") - def test_domain_request_form_section_skipping(self): + def test_application_form_section_skipping(self): """Can skip forward and back in sections""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -644,9 +644,9 @@ class DomainRequestTests(TestWithUser, WebTest): 0, ) - def test_domain_request_form_nonfederal(self): + def test_application_form_nonfederal(self): """Non-federal organizations don't have to provide their federal agency.""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -663,7 +663,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] type_form = type_page.forms[0] - type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.INTERSTATE + type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.INTERSTATE self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) type_result = type_form.submit() @@ -689,9 +689,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertEqual(contact_result.status_code, 302) self.assertEqual(contact_result["Location"], "/request/about_your_organization/") - def test_domain_request_about_your_organization_special(self): + def test_application_about_your_organization_special(self): """Special districts have to answer an additional question.""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -708,7 +708,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] type_form = type_page.forms[0] - type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.SPECIAL_DISTRICT + type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.SPECIAL_DISTRICT self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) type_result = type_page.forms[0].submit() # follow first redirect @@ -717,20 +717,20 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION]) - def test_yes_no_form_inits_blank_for_new_domain_request(self): + def test_yes_no_form_inits_blank_for_new_application(self): """On the Other Contacts page, the yes/no form gets initialized with nothing selected for - new domain requests""" - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + new applications""" + other_contacts_page = self.app.get(reverse("application:other_contacts")) other_contacts_form = other_contacts_page.forms[0] self.assertEquals(other_contacts_form["other_contacts-has_other_contacts"].value, None) - def test_yes_no_form_inits_yes_for_domain_request_with_other_contacts(self): + def test_yes_no_form_inits_yes_for_application_with_other_contacts(self): """On the Other Contacts page, the yes/no form gets initialized with YES selected if the - domain request has other contacts""" - # Domain Request has other contacts by default - domain_request = completed_domain_request(user=self.user) + application has other contacts""" + # Application has other contacts by default + application = completed_application(user=self.user) # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -738,21 +738,21 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] self.assertEquals(other_contacts_form["other_contacts-has_other_contacts"].value, "True") - def test_yes_no_form_inits_no_for_domain_request_with_no_other_contacts_rationale(self): + def test_yes_no_form_inits_no_for_application_with_no_other_contacts_rationale(self): """On the Other Contacts page, the yes/no form gets initialized with NO selected if the - domain request has no other contacts""" - # Domain request has other contacts by default - domain_request = completed_domain_request(user=self.user, has_other_contacts=False) - domain_request.no_other_contacts_rationale = "Hello!" - domain_request.save() + application has no other contacts""" + # Application has other contacts by default + application = completed_application(user=self.user, has_other_contacts=False) + application.no_other_contacts_rationale = "Hello!" + application.save() # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -760,21 +760,21 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] self.assertEquals(other_contacts_form["other_contacts-has_other_contacts"].value, "False") def test_submitting_other_contacts_deletes_no_other_contacts_rationale(self): - """When a user submits the Other Contacts form with other contacts selected, the domain request's + """When a user submits the Other Contacts form with other contacts selected, the application's no other contacts rationale gets deleted""" - # Domain request has other contacts by default - domain_request = completed_domain_request(user=self.user, has_other_contacts=False) - domain_request.no_other_contacts_rationale = "Hello!" - domain_request.save() + # Application has other contacts by default + application = completed_application(user=self.user, has_other_contacts=False) + application.no_other_contacts_rationale = "Hello!" + application.save() # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -782,7 +782,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -803,25 +803,25 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # Verify that the no_other_contacts_rationale we saved earlier has been removed from the database - domain_request = DomainRequest.objects.get() + application = DomainApplication.objects.get() self.assertEqual( - domain_request.other_contacts.count(), + application.other_contacts.count(), 1, ) self.assertEquals( - domain_request.no_other_contacts_rationale, + application.no_other_contacts_rationale, None, ) def test_submitting_no_other_contacts_rationale_deletes_other_contacts(self): - """When a user submits the Other Contacts form with no other contacts selected, the domain request's + """When a user submits the Other Contacts form with no other contacts selected, the application's other contacts get deleted for other contacts that exist and are not joined to other objects """ - # Domain request has other contacts by default - domain_request = completed_domain_request(user=self.user) + # Application has other contacts by default + application = completed_application(user=self.user) # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -829,7 +829,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -845,21 +845,21 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # Verify that the no_other_contacts_rationale we saved earlier has been removed from the database - domain_request = DomainRequest.objects.get() + application = DomainApplication.objects.get() self.assertEqual( - domain_request.other_contacts.count(), + application.other_contacts.count(), 0, ) self.assertEquals( - domain_request.no_other_contacts_rationale, + application.no_other_contacts_rationale, "Hello again!", ) def test_submitting_no_other_contacts_rationale_removes_reference_other_contacts_when_joined(self): - """When a user submits the Other Contacts form with no other contacts selected, the domain request's + """When a user submits the Other Contacts form with no other contacts selected, the application's other contacts references get removed for other contacts that exist and are joined to other objects""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has 1 "other contact" assigned to it # We'll do it from scratch so we can reuse the other contact ao, _ = Contact.objects.get_or_create( @@ -883,7 +883,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy2@town.com", phone="(555) 555 5557", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -898,14 +898,14 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(other) + application.other_contacts.add(other) # Now let's join the other contact to another object domain_info = DomainInformation.objects.create(creator=self.user) domain_info.other_contacts.set([other]) # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -913,7 +913,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -928,10 +928,10 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - # Verify that the no_other_contacts_rationale we saved earlier is no longer associated with the domain request - domain_request = DomainRequest.objects.get() + # Verify that the no_other_contacts_rationale we saved earlier is no longer associated with the application + application = DomainApplication.objects.get() self.assertEqual( - domain_request.other_contacts.count(), + application.other_contacts.count(), 0, ) @@ -947,13 +947,13 @@ class DomainRequestTests(TestWithUser, WebTest): ) self.assertEquals( - domain_request.no_other_contacts_rationale, + application.no_other_contacts_rationale, "Hello again!", ) def test_if_yes_no_form_is_no_then_no_other_contacts_required(self): """Applicants with no other contacts have to give a reason.""" - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) other_contacts_form = other_contacts_page.forms[0] other_contacts_form["other_contacts-has_other_contacts"] = "False" response = other_contacts_page.forms[0].submit() @@ -968,7 +968,7 @@ class DomainRequestTests(TestWithUser, WebTest): def test_if_yes_no_form_is_yes_then_other_contacts_required(self): """Applicants with other contacts do not have to give a reason.""" - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) other_contacts_form = other_contacts_page.forms[0] other_contacts_form["other_contacts-has_other_contacts"] = "True" response = other_contacts_page.forms[0].submit() @@ -984,9 +984,9 @@ class DomainRequestTests(TestWithUser, WebTest): def test_delete_other_contact(self): """Other contacts can be deleted after being saved to database. - This formset uses the DJANGO DELETE widget. We'll test that by setting 2 contacts on a domain request, + This formset uses the DJANGO DELETE widget. We'll test that by setting 2 contacts on an application, loading the form and marking one contact up for deletion.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has 2 "other contact" assigned to it # We'll do it from scratch so we can reuse the other contact ao, _ = Contact.objects.get_or_create( @@ -1017,7 +1017,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy3@town.com", phone="(201) 555 5557", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1032,11 +1032,11 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(other) - domain_request.other_contacts.add(other2) + application.other_contacts.add(other) + application.other_contacts.add(other2) # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1044,7 +1044,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -1061,13 +1061,13 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # Verify that the first dude was deleted - domain_request = DomainRequest.objects.get() - self.assertEqual(domain_request.other_contacts.count(), 1) - self.assertEqual(domain_request.other_contacts.first().first_name, "Testy3") + application = DomainApplication.objects.get() + self.assertEqual(application.other_contacts.count(), 1) + self.assertEqual(application.other_contacts.first().first_name, "Testy3") def test_delete_other_contact_does_not_allow_zero_contacts(self): """Delete Other Contact does not allow submission with zero contacts.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has 1 "other contact" assigned to it # We'll do it from scratch so we can reuse the other contact ao, _ = Contact.objects.get_or_create( @@ -1091,7 +1091,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy2@town.com", phone="(201) 555 5557", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1106,10 +1106,10 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(other) + application.other_contacts.add(other) # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1117,7 +1117,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -1133,9 +1133,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # Verify that the contact was not deleted - domain_request = DomainRequest.objects.get() - self.assertEqual(domain_request.other_contacts.count(), 1) - self.assertEqual(domain_request.other_contacts.first().first_name, "Testy2") + application = DomainApplication.objects.get() + self.assertEqual(application.other_contacts.count(), 1) + self.assertEqual(application.other_contacts.first().first_name, "Testy2") def test_delete_other_contact_sets_visible_empty_form_as_required_after_failed_submit(self): """When you: @@ -1144,7 +1144,7 @@ class DomainRequestTests(TestWithUser, WebTest): 3. then submit, The forms on page reload shows all the required fields and their errors.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has 1 "other contact" assigned to it # We'll do it from scratch so we can reuse the other contact ao, _ = Contact.objects.get_or_create( @@ -1168,7 +1168,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy2@town.com", phone="(201) 555 5557", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1183,10 +1183,10 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(other) + application.other_contacts.add(other) # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1194,7 +1194,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -1218,9 +1218,9 @@ class DomainRequestTests(TestWithUser, WebTest): """When you: 1. edit an existing contact which is not joined to another model, 2. then submit, - the domain request is linked to the existing contact, and the existing contact updated.""" + The application is linked to the existing contact, and the existing contact updated.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has 1 "other contact" assigned to it # We'll do it from scratch ao, _ = Contact.objects.get_or_create( @@ -1244,7 +1244,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy2@town.com", phone="(201) 555 5557", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1259,14 +1259,14 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(other) + application.other_contacts.add(other) # other_contact_pk is the initial pk of the other contact. set it before update # to be able to verify after update that the same contact object is in place other_contact_pk = other.id # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1274,7 +1274,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -1288,10 +1288,10 @@ class DomainRequestTests(TestWithUser, WebTest): # Submit the updated form other_contacts_form.submit() - domain_request.refresh_from_db() + application.refresh_from_db() # assert that the Other Contact is updated "in place" - other_contact = domain_request.other_contacts.all()[0] + other_contact = application.other_contacts.all()[0] self.assertEquals(other_contact_pk, other_contact.id) self.assertEquals("Testy3", other_contact.first_name) @@ -1299,9 +1299,9 @@ class DomainRequestTests(TestWithUser, WebTest): """When you: 1. edit an existing contact which IS joined to another model, 2. then submit, - the domain request is linked to a new contact, and the new contact is updated.""" + The application is linked to a new contact, and the new contact is updated.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has 1 "other contact" assigned to it, the other contact is also # the authorizing official initially # We'll do it from scratch @@ -1319,7 +1319,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy-admin@town.com", phone="(201) 555 5556", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1334,7 +1334,7 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(ao) + application.other_contacts.add(ao) # other_contact_pk is the initial pk of the other contact. set it before update # to be able to verify after update that the ao contact is still in place @@ -1342,7 +1342,7 @@ class DomainRequestTests(TestWithUser, WebTest): other_contact_pk = ao.id # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1350,7 +1350,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = self.app.get(reverse("domain-request:other_contacts")) + other_contacts_page = self.app.get(reverse("application:other_contacts")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) other_contacts_form = other_contacts_page.forms[0] @@ -1364,24 +1364,24 @@ class DomainRequestTests(TestWithUser, WebTest): # Submit the updated form other_contacts_form.submit() - domain_request.refresh_from_db() + application.refresh_from_db() # assert that other contact info is updated, and that a new Contact # is created for the other contact - other_contact = domain_request.other_contacts.all()[0] + other_contact = application.other_contacts.all()[0] self.assertNotEquals(other_contact_pk, other_contact.id) self.assertEquals("Testy2", other_contact.first_name) # assert that the authorizing official is not updated - authorizing_official = domain_request.authorizing_official + authorizing_official = application.authorizing_official self.assertEquals("Testy", authorizing_official.first_name) def test_edit_authorizing_official_in_place(self): """When you: 1. edit an authorizing official which is not joined to another model, 2. then submit, - the domain request is linked to the existing ao, and the ao updated.""" + The application is linked to the existing ao, and the ao updated.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has an authorizing_official (ao) # We'll do it from scratch ao, _ = Contact.objects.get_or_create( @@ -1391,7 +1391,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy@town.com", phone="(201) 555 5555", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1411,7 +1411,7 @@ class DomainRequestTests(TestWithUser, WebTest): ao_pk = ao.id # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1419,7 +1419,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - ao_page = self.app.get(reverse("domain-request:authorizing_official")) + ao_page = self.app.get(reverse("application:authorizing_official")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) ao_form = ao_page.forms[0] @@ -1433,10 +1433,10 @@ class DomainRequestTests(TestWithUser, WebTest): # Submit the updated form ao_form.submit() - domain_request.refresh_from_db() + application.refresh_from_db() # assert AO is updated "in place" - updated_ao = domain_request.authorizing_official + updated_ao = application.authorizing_official self.assertEquals(ao_pk, updated_ao.id) self.assertEquals("Testy2", updated_ao.first_name) @@ -1444,9 +1444,9 @@ class DomainRequestTests(TestWithUser, WebTest): """When you: 1. edit an existing authorizing official which IS joined to another model, 2. then submit, - the domain request is linked to a new Contact, and the new Contact is updated.""" + The application is linked to a new Contact, and the new Contact is updated.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has authorizing official assigned to it, the authorizing offical is also # an other contact initially # We'll do it from scratch @@ -1457,7 +1457,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy@town.com", phone="(201) 555 5555", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1471,7 +1471,7 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(ao) + application.other_contacts.add(ao) # ao_pk is the initial pk of the authorizing official. set it before update # to be able to verify after update that the other contact is still in place @@ -1479,7 +1479,7 @@ class DomainRequestTests(TestWithUser, WebTest): ao_pk = ao.id # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1487,7 +1487,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - ao_page = self.app.get(reverse("domain-request:authorizing_official")) + ao_page = self.app.get(reverse("application:authorizing_official")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) ao_form = ao_page.forms[0] @@ -1501,24 +1501,24 @@ class DomainRequestTests(TestWithUser, WebTest): # Submit the updated form ao_form.submit() - domain_request.refresh_from_db() + application.refresh_from_db() # assert that the other contact is not updated - other_contacts = domain_request.other_contacts.all() + other_contacts = application.other_contacts.all() other_contact = other_contacts[0] self.assertEquals(ao_pk, other_contact.id) self.assertEquals("Testy", other_contact.first_name) # assert that the authorizing official is updated - authorizing_official = domain_request.authorizing_official + authorizing_official = application.authorizing_official self.assertEquals("Testy2", authorizing_official.first_name) def test_edit_submitter_in_place(self): """When you: 1. edit a submitter (your contact) which is not joined to another model, 2. then submit, - the domain request is linked to the existing submitter, and the submitter updated.""" + The application is linked to the existing submitter, and the submitter updated.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has a submitter # We'll do it from scratch you, _ = Contact.objects.get_or_create( @@ -1528,7 +1528,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy@town.com", phone="(201) 555 5555", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1548,7 +1548,7 @@ class DomainRequestTests(TestWithUser, WebTest): submitter_pk = you.id # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1556,7 +1556,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - your_contact_page = self.app.get(reverse("domain-request:your_contact")) + your_contact_page = self.app.get(reverse("application:your_contact")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) your_contact_form = your_contact_page.forms[0] @@ -1570,9 +1570,9 @@ class DomainRequestTests(TestWithUser, WebTest): # Submit the updated form your_contact_form.submit() - domain_request.refresh_from_db() + application.refresh_from_db() - updated_submitter = domain_request.submitter + updated_submitter = application.submitter self.assertEquals(submitter_pk, updated_submitter.id) self.assertEquals("Testy2", updated_submitter.first_name) @@ -1580,9 +1580,9 @@ class DomainRequestTests(TestWithUser, WebTest): """When you: 1. edit an existing your contact which IS joined to another model, 2. then submit, - the domain request is linked to a new Contact, and the new Contact is updated.""" + The application is linked to a new Contact, and the new Contact is updated.""" - # Populate the database with a domain request that + # Populate the database with a domain application that # has submitter assigned to it, the submitter is also # an other contact initially # We'll do it from scratch @@ -1593,7 +1593,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy@town.com", phone="(201) 555 5555", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1607,7 +1607,7 @@ class DomainRequestTests(TestWithUser, WebTest): creator=self.user, status="started", ) - domain_request.other_contacts.add(submitter) + application.other_contacts.add(submitter) # submitter_pk is the initial pk of the your contact. set it before update # to be able to verify after update that the other contact is still in place @@ -1615,7 +1615,7 @@ class DomainRequestTests(TestWithUser, WebTest): submitter_pk = submitter.id # prime the form by visiting /edit - self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk})) + self.app.get(reverse("edit-application", kwargs={"id": application.pk})) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1623,7 +1623,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - your_contact_page = self.app.get(reverse("domain-request:your_contact")) + your_contact_page = self.app.get(reverse("application:your_contact")) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) your_contact_form = your_contact_page.forms[0] @@ -1637,20 +1637,20 @@ class DomainRequestTests(TestWithUser, WebTest): # Submit the updated form your_contact_form.submit() - domain_request.refresh_from_db() + application.refresh_from_db() # assert that the other contact is not updated - other_contacts = domain_request.other_contacts.all() + other_contacts = application.other_contacts.all() other_contact = other_contacts[0] self.assertEquals(submitter_pk, other_contact.id) self.assertEquals("Testy", other_contact.first_name) # assert that the submitter is updated - submitter = domain_request.submitter + submitter = application.submitter self.assertEquals("Testy2", submitter.first_name) - def test_domain_request_about_your_organiztion_interstate(self): + def test_application_about_your_organiztion_interstate(self): """Special districts have to answer an additional question.""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1667,7 +1667,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] type_form = type_page.forms[0] - type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.INTERSTATE + type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.INTERSTATE self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) type_result = type_form.submit() # follow first redirect @@ -1676,9 +1676,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION]) - def test_domain_request_tribal_government(self): + def test_application_tribal_government(self): """Tribal organizations have to answer an additional question.""" - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1695,7 +1695,7 @@ class DomainRequestTests(TestWithUser, WebTest): session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] type_form = type_page.forms[0] - type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.TRIBAL + type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.TRIBAL self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) type_result = type_form.submit() # the tribal government page comes immediately afterwards @@ -1707,8 +1707,8 @@ class DomainRequestTests(TestWithUser, WebTest): # and the step is on the sidebar list. self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT]) - def test_domain_request_ao_dynamic_text(self): - intro_page = self.app.get(reverse("domain-request:")) + def test_application_ao_dynamic_text(self): + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1778,8 +1778,8 @@ class DomainRequestTests(TestWithUser, WebTest): ao_page = election_page.click(str(self.TITLES["authorizing_official"]), index=0) self.assertContains(ao_page, "Domain requests from cities") - def test_domain_request_dotgov_domain_dynamic_text(self): - intro_page = self.app.get(reverse("domain-request:")) + def test_application_dotgov_domain_dynamic_text(self): + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -1879,9 +1879,9 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertContains(dotgov_page, "CityofEudoraKS.gov") self.assertNotContains(dotgov_page, "medicare.gov") - def test_domain_request_formsets(self): + def test_application_formsets(self): """Users are able to add more than one of some fields.""" - current_sites_page = self.app.get(reverse("domain-request:current_sites")) + current_sites_page = self.app.get(reverse("application:current_sites")) session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] # fill in the form field current_sites_form = current_sites_page.forms[0] @@ -1900,16 +1900,16 @@ class DomainRequestTests(TestWithUser, WebTest): self.assertEqual(value, "https://example.com") self.assertIn("current_sites-1-website", current_sites_form.fields) # and it is correctly referenced in the ManyToOne relationship - domain_request = DomainRequest.objects.get() # there's only one + application = DomainApplication.objects.get() # there's only one self.assertEqual( - domain_request.current_websites.filter(website="https://example.com").count(), + application.current_websites.filter(website="https://example.com").count(), 1, ) @skip("WIP") - def test_domain_request_edit_restore(self): + def test_application_edit_restore(self): """ - Test that a previously saved domain request is available at the /edit endpoint. + Test that a previously saved application is available at the /edit endpoint. """ ao, _ = Contact.objects.get_or_create( first_name="Testy", @@ -1935,7 +1935,7 @@ class DomainRequestTests(TestWithUser, WebTest): email="testy2@town.com", phone="(555) 555 5557", ) - domain_request, _ = DomainRequest.objects.get_or_create( + application, _ = DomainApplication.objects.get_or_create( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -1950,12 +1950,12 @@ class DomainRequestTests(TestWithUser, WebTest): submitter=you, creator=self.user, ) - domain_request.other_contacts.add(other) - domain_request.current_websites.add(current) - domain_request.alternative_domains.add(alt) + application.other_contacts.add(other) + application.current_websites.add(current) + application.alternative_domains.add(alt) # prime the form by visiting /edit - url = reverse("edit-domain-request", kwargs={"id": domain_request.pk}) + url = reverse("edit-application", kwargs={"id": application.pk}) response = self.client.get(url) # TODO: this is a sketch of each page in the wizard which needs to be tested @@ -1965,7 +1965,7 @@ class DomainRequestTests(TestWithUser, WebTest): # -- the best that can/should be done here is to ensure the correct values # are being passed to the templating engine - url = reverse("domain-request:organization_type") + url = reverse("application:organization_type") response = self.client.get(url, follow=True) self.assertContains(response, "") # choices = response.context['wizard']['form']['organization_type'].subwidgets @@ -1973,72 +1973,72 @@ class DomainRequestTests(TestWithUser, WebTest): # checked = radio.data["selected"] # self.assertTrue(checked) - # url = reverse("domain-request:organization_federal") + # url = reverse("application:organization_federal") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:organization_contact") + # url = reverse("application:organization_contact") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:authorizing_official") + # url = reverse("application:authorizing_official") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:current_sites") + # url = reverse("application:current_sites") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:dotgov_domain") + # url = reverse("application:dotgov_domain") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:purpose") + # url = reverse("application:purpose") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:your_contact") + # url = reverse("application:your_contact") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:other_contacts") + # url = reverse("application:other_contacts") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:other_contacts") + # url = reverse("application:other_contacts") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:security_email") + # url = reverse("application:security_email") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:anything_else") + # url = reverse("application:anything_else") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - # url = reverse("domain-request:requirements") + # url = reverse("application:requirements") # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) # page = self.app.get(url) # self.assertNotContains(page, "VALUE") - def test_long_org_name_in_domain_request(self): + def test_long_org_name_in_application(self): """ - Make sure the long name is displaying in the domain request form, + Make sure the long name is displaying in the application form, org step """ - intro_page = self.app.get(reverse("domain-request:")) + intro_page = self.app.get(reverse("application:")) # django-webtest does not handle cookie-based sessions well because it keeps # resetting the session key on each new request, thus destroying the concept # of a "session". We are going to do it manually, saving the session ID here @@ -2063,21 +2063,21 @@ class DomainRequestTests(TestWithUser, WebTest): NOTE: This may be a moot point if we implement a more solid pattern in the future, like not a submit action at all on the review page.""" - review_page = self.app.get(reverse("domain-request:review")) + review_page = self.app.get(reverse("application:review")) self.assertContains(review_page, "toggle-submit-domain-request") self.assertContains(review_page, "You are about to submit an incomplete request") -class DomainRequestTestDifferentStatuses(TestWithUser, WebTest): +class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest): def setUp(self): super().setUp() self.app.set_user(self.user.username) self.client.force_login(self.user) - def test_domain_request_status(self): - """Checking domain request status page""" - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user) - domain_request.save() + def test_application_status(self): + """Checking application status page""" + application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user) + application.save() home_page = self.app.get("/") self.assertContains(home_page, "city.gov") @@ -2090,14 +2090,14 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest): self.assertContains(detail_page, "Admin Tester") self.assertContains(detail_page, "Status:") - def test_domain_request_status_with_ineligible_user(self): - """Checking domain request status page whith a blocked user. + def test_application_status_with_ineligible_user(self): + """Checking application status page whith a blocked user. The user should still have access to view.""" self.user.status = "ineligible" self.user.save() - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user) - domain_request.save() + application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user) + application.save() home_page = self.app.get("/") self.assertContains(home_page, "city.gov") @@ -2109,10 +2109,10 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest): self.assertContains(detail_page, "Admin Tester") self.assertContains(detail_page, "Status:") - def test_domain_request_withdraw(self): - """Checking domain request status page""" - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user) - domain_request.save() + def test_application_withdraw(self): + """Checking application status page""" + application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user) + application.save() home_page = self.app.get("/") self.assertContains(home_page, "city.gov") @@ -2142,12 +2142,12 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest): home_page = self.app.get("/") self.assertContains(home_page, "Withdrawn") - def test_domain_request_withdraw_no_permissions(self): - """Can't withdraw domain requests as a restricted user.""" + def test_application_withdraw_no_permissions(self): + """Can't withdraw applications as a restricted user.""" self.user.status = User.RESTRICTED self.user.save() - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user) - domain_request.save() + application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user) + application.save() home_page = self.app.get("/") self.assertContains(home_page, "city.gov") @@ -2162,41 +2162,41 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest): # Restricted user trying to withdraw results in 403 error with less_console_noise(): for url_name in [ - "domain-request-withdraw-confirmation", - "domain-request-withdrawn", + "application-withdraw-confirmation", + "application-withdrawn", ]: with self.subTest(url_name=url_name): - page = self.client.get(reverse(url_name, kwargs={"pk": domain_request.pk})) + page = self.client.get(reverse(url_name, kwargs={"pk": application.pk})) self.assertEqual(page.status_code, 403) - def test_domain_request_status_no_permissions(self): - """Can't access domain requests without being the creator.""" - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user) + def test_application_status_no_permissions(self): + """Can't access applications without being the creator.""" + application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user) other_user = User() other_user.save() - domain_request.creator = other_user - domain_request.save() + application.creator = other_user + application.save() # PermissionDeniedErrors make lots of noise in test output with less_console_noise(): for url_name in [ - "domain-request-status", - "domain-request-withdraw-confirmation", - "domain-request-withdrawn", + "application-status", + "application-withdraw-confirmation", + "application-withdrawn", ]: with self.subTest(url_name=url_name): - page = self.client.get(reverse(url_name, kwargs={"pk": domain_request.pk})) + page = self.client.get(reverse(url_name, kwargs={"pk": application.pk})) self.assertEqual(page.status_code, 403) - def test_approved_domain_request_not_in_active_requests(self): - """An approved domain request is not shown in the Active + def test_approved_application_not_in_active_requests(self): + """An approved application is not shown in the Active Requests table on home.html.""" - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED, user=self.user) - domain_request.save() + application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED, user=self.user) + application.save() home_page = self.app.get("/") # This works in our test environment because creating - # an approved domain request here does not generate a + # an approved application here does not generate a # domain object, so we do not expect to see 'city.gov' # in either the Domains or Requests tables. self.assertNotContains(home_page, "city.gov") @@ -2206,23 +2206,23 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest): def setUp(self): super().setUp() self.app.set_user(self.user.username) - self.wizard = DomainRequestWizard() + self.wizard = ApplicationWizard() # Mock the request object, its user, and session attributes appropriately self.wizard.request = Mock(user=self.user, session={}) def tearDown(self): super().tearDown() - def test_unlocked_steps_empty_domain_request(self): - """Test when all fields in the domain request are empty.""" + def test_unlocked_steps_empty_application(self): + """Test when all fields in the application are empty.""" unlocked_steps = self.wizard.db_check_for_unlocking_steps() expected_dict = [] self.assertEqual(unlocked_steps, expected_dict) - def test_unlocked_steps_full_domain_request(self): - """Test when all fields in the domain request are filled.""" + def test_unlocked_steps_full_application(self): + """Test when all fields in the application are filled.""" - completed_domain_request(status=DomainRequest.DomainRequestStatus.STARTED, user=self.user) + completed_application(status=DomainApplication.ApplicationStatus.STARTED, user=self.user) # Make a request to the home page home_page = self.app.get("/") # django-webtest does not handle cookie-based sessions well because it keeps @@ -2262,8 +2262,8 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest): else: self.fail(f"Expected a redirect, but got a different response: {response}") - def test_unlocked_steps_partial_domain_request(self): - """Test when some fields in the domain request are filled.""" + def test_unlocked_steps_partial_application(self): + """Test when some fields in the application are filled.""" # Create the site and contacts to delete (orphaned) contact = Contact.objects.create( @@ -2280,14 +2280,14 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest): contact_user, _ = Contact.objects.get_or_create(user=self.user) site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create( + application = DomainApplication.objects.create( creator=self.user, requested_domain=site, - status=DomainRequest.DomainRequestStatus.WITHDRAWN, + status=DomainApplication.ApplicationStatus.WITHDRAWN, authorizing_official=contact, submitter=contact_user, ) - domain_request.other_contacts.set([contact_2]) + application.other_contacts.set([contact_2]) # Make a request to the home page home_page = self.app.get("/") @@ -2341,18 +2341,18 @@ class HomeTests(TestWithUser): super().tearDown() Contact.objects.all().delete() - def test_home_lists_domain_requests(self): + def test_home_lists_domain_applications(self): response = self.client.get("/") self.assertNotContains(response, "igorville.gov") site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create(creator=self.user, requested_domain=site) + application = DomainApplication.objects.create(creator=self.user, requested_domain=site) response = self.client.get("/") # count = 7 because of screenreader content self.assertContains(response, "igorville.gov", count=7) # clean up - domain_request.delete() + application.delete() def test_state_help_text(self): """Tests if each domain state has help text""" @@ -2464,12 +2464,12 @@ class HomeTests(TestWithUser): # Check that we have the right text content. self.assertContains(response, unknown_text, count=1) - def test_home_deletes_withdrawn_domain_request(self): - """Tests if the user can delete a DomainRequest in the 'withdrawn' status""" + def test_home_deletes_withdrawn_domain_application(self): + """Tests if the user can delete a DomainApplication in the 'withdrawn' status""" site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create( - creator=self.user, requested_domain=site, status=DomainRequest.DomainRequestStatus.WITHDRAWN + application = DomainApplication.objects.create( + creator=self.user, requested_domain=site, status=DomainApplication.ApplicationStatus.WITHDRAWN ) # Ensure that igorville.gov exists on the page @@ -2481,19 +2481,19 @@ class HomeTests(TestWithUser): self.assertContains(home_page, "button-toggle-delete-domain-alert-1") # Trigger the delete logic - response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True) + response = self.client.post(reverse("application-delete", kwargs={"pk": application.pk}), follow=True) self.assertNotContains(response, "igorville.gov") # clean up - domain_request.delete() + application.delete() - def test_home_deletes_started_domain_request(self): - """Tests if the user can delete a DomainRequest in the 'started' status""" + def test_home_deletes_started_domain_application(self): + """Tests if the user can delete a DomainApplication in the 'started' status""" site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create( - creator=self.user, requested_domain=site, status=DomainRequest.DomainRequestStatus.STARTED + application = DomainApplication.objects.create( + creator=self.user, requested_domain=site, status=DomainApplication.ApplicationStatus.STARTED ) # Ensure that igorville.gov exists on the page @@ -2505,48 +2505,48 @@ class HomeTests(TestWithUser): self.assertContains(home_page, "button-toggle-delete-domain-alert-1") # Trigger the delete logic - response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True) + response = self.client.post(reverse("application-delete", kwargs={"pk": application.pk}), follow=True) self.assertNotContains(response, "igorville.gov") # clean up - domain_request.delete() + application.delete() - def test_home_doesnt_delete_other_domain_requests(self): - """Tests to ensure the user can't delete domain requests not in the status of STARTED or WITHDRAWN""" + def test_home_doesnt_delete_other_domain_applications(self): + """Tests to ensure the user can't delete Applications not in the status of STARTED or WITHDRAWN""" # Given that we are including a subset of items that can be deleted while excluding the rest, # subTest is appropriate here as otherwise we would need many duplicate tests for the same reason. with less_console_noise(): draft_domain = DraftDomain.objects.create(name="igorville.gov") - for status in DomainRequest.DomainRequestStatus: + for status in DomainApplication.ApplicationStatus: if status not in [ - DomainRequest.DomainRequestStatus.STARTED, - DomainRequest.DomainRequestStatus.WITHDRAWN, + DomainApplication.ApplicationStatus.STARTED, + DomainApplication.ApplicationStatus.WITHDRAWN, ]: with self.subTest(status=status): - domain_request = DomainRequest.objects.create( + application = DomainApplication.objects.create( creator=self.user, requested_domain=draft_domain, status=status ) # Trigger the delete logic response = self.client.post( - reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True + reverse("application-delete", kwargs={"pk": application.pk}), follow=True ) # Check for a 403 error - the end user should not be allowed to do this self.assertEqual(response.status_code, 403) - desired_domain_request = DomainRequest.objects.filter(requested_domain=draft_domain) + desired_application = DomainApplication.objects.filter(requested_domain=draft_domain) - # Make sure the DomainRequest wasn't deleted - self.assertEqual(desired_domain_request.count(), 1) + # Make sure the DomainApplication wasn't deleted + self.assertEqual(desired_application.count(), 1) # clean up - domain_request.delete() + application.delete() - def test_home_deletes_domain_request_and_orphans(self): - """Tests if delete for DomainRequest deletes orphaned Contact objects""" + def test_home_deletes_domain_application_and_orphans(self): + """Tests if delete for DomainApplication deletes orphaned Contact objects""" # Create the site and contacts to delete (orphaned) contact = Contact.objects.create( @@ -2568,32 +2568,32 @@ class HomeTests(TestWithUser): contact_user, _ = Contact.objects.get_or_create(user=self.user) site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create( + application = DomainApplication.objects.create( creator=self.user, requested_domain=site, - status=DomainRequest.DomainRequestStatus.WITHDRAWN, + status=DomainApplication.ApplicationStatus.WITHDRAWN, authorizing_official=contact, submitter=contact_user, ) - domain_request.other_contacts.set([contact_2]) + application.other_contacts.set([contact_2]) - # Create a second domain request to attach contacts to + # Create a second application to attach contacts to site_2 = DraftDomain.objects.create(name="teaville.gov") - domain_request_2 = DomainRequest.objects.create( + application_2 = DomainApplication.objects.create( creator=self.user, requested_domain=site_2, - status=DomainRequest.DomainRequestStatus.STARTED, + status=DomainApplication.ApplicationStatus.STARTED, authorizing_official=contact_2, submitter=contact_shared, ) - domain_request_2.other_contacts.set([contact_shared]) + application_2.other_contacts.set([contact_shared]) # Ensure that igorville.gov exists on the page home_page = self.client.get("/") self.assertContains(home_page, "igorville.gov") # Trigger the delete logic - response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True) + response = self.client.post(reverse("application-delete", kwargs={"pk": application.pk}), follow=True) # igorville is now deleted self.assertNotContains(response, "igorville.gov") @@ -2616,7 +2616,7 @@ class HomeTests(TestWithUser): self.assertEqual(edge_case, contact_2) - def test_home_deletes_domain_request_and_shared_orphans(self): + def test_home_deletes_domain_application_and_shared_orphans(self): """Test the edge case for an object that will become orphaned after a delete (but is not an orphan at the time of deletion)""" @@ -2640,31 +2640,31 @@ class HomeTests(TestWithUser): contact_user, _ = Contact.objects.get_or_create(user=self.user) site = DraftDomain.objects.create(name="igorville.gov") - domain_request = DomainRequest.objects.create( + application = DomainApplication.objects.create( creator=self.user, requested_domain=site, - status=DomainRequest.DomainRequestStatus.WITHDRAWN, + status=DomainApplication.ApplicationStatus.WITHDRAWN, authorizing_official=contact, submitter=contact_user, ) - domain_request.other_contacts.set([contact_2]) + application.other_contacts.set([contact_2]) - # Create a second domain request to attach contacts to + # Create a second application to attach contacts to site_2 = DraftDomain.objects.create(name="teaville.gov") - domain_request_2 = DomainRequest.objects.create( + application_2 = DomainApplication.objects.create( creator=self.user, requested_domain=site_2, - status=DomainRequest.DomainRequestStatus.STARTED, + status=DomainApplication.ApplicationStatus.STARTED, authorizing_official=contact_2, submitter=contact_shared, ) - domain_request_2.other_contacts.set([contact_shared]) + application_2.other_contacts.set([contact_shared]) home_page = self.client.get("/") self.assertContains(home_page, "teaville.gov") # Trigger the delete logic - response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request_2.pk}), follow=True) + response = self.client.post(reverse("application-delete", kwargs={"pk": application_2.pk}), follow=True) self.assertNotContains(response, "teaville.gov") @@ -2672,16 +2672,16 @@ class HomeTests(TestWithUser): orphan = Contact.objects.filter(id=contact_shared.id) self.assertFalse(orphan.exists()) - def test_domain_request_form_view(self): + def test_application_form_view(self): response = self.client.get("/request/", follow=True) self.assertContains( response, "You’re about to start your .gov domain request.", ) - def test_domain_request_form_with_ineligible_user(self): - """Domain request form not accessible for an ineligible user. - This test should be solid enough since all domain request wizard + def test_domain_application_form_with_ineligible_user(self): + """Application form not accessible for an ineligible user. + This test should be solid enough since all application wizard views share the same permissions class""" self.user.status = User.RESTRICTED self.user.save() diff --git a/src/registrar/tests/test_views_domain.py b/src/registrar/tests/test_views_domain.py index 9b71da02e..59b5faaa9 100644 --- a/src/registrar/tests/test_views_domain.py +++ b/src/registrar/tests/test_views_domain.py @@ -21,7 +21,7 @@ from registrar.utility.errors import ( ) from registrar.models import ( - DomainRequest, + DomainApplication, Domain, DomainInformation, DomainInvitation, @@ -120,7 +120,7 @@ class TestWithDomainPermissions(TestWithUser): UserDomainRole.objects.all().delete() if hasattr(self.domain, "contacts"): self.domain.contacts.all().delete() - DomainRequest.objects.all().delete() + DomainApplication.objects.all().delete() DomainInformation.objects.all().delete() PublicContact.objects.all().delete() HostIP.objects.all().delete() @@ -309,9 +309,9 @@ class TestDomainDetail(TestDomainOverview): self.assertContains(detail_page, "(1.2.3.4,") self.assertContains(detail_page, "2.3.4.5)") - def test_domain_detail_with_no_information_or_domain_request(self): + def test_domain_detail_with_no_information_or_application(self): """Test that domain management page returns 200 and displays error - when no domain information or domain request exist""" + when no domain information or domain application exist""" with less_console_noise(): # have to use staff user for this test staff_user = create_user() diff --git a/src/registrar/views/__init__.py b/src/registrar/views/__init__.py index bd15196d4..8785c9076 100644 --- a/src/registrar/views/__init__.py +++ b/src/registrar/views/__init__.py @@ -1,4 +1,4 @@ -from .domain_request import * +from .application import * from .domain import ( DomainView, DomainAuthorizingOfficialView, diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/application.py similarity index 68% rename from src/registrar/views/domain_request.py rename to src/registrar/views/application.py index da5d717f4..b71018d81 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/application.py @@ -8,18 +8,18 @@ from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView from django.contrib import messages -from registrar.forms import domain_request_wizard as forms -from registrar.models import DomainRequest +from registrar.forms import application_wizard as forms +from registrar.models import DomainApplication from registrar.models.contact import Contact from registrar.models.user import User from registrar.utility import StrEnum from registrar.views.utility import StepsHelper -from registrar.views.utility.permission_views import DomainRequestPermissionDeleteView +from registrar.views.utility.permission_views import DomainApplicationPermissionDeleteView from .utility import ( - DomainRequestPermissionView, - DomainRequestPermissionWithdrawView, - DomainRequestWizardPermissionView, + DomainApplicationPermissionView, + DomainApplicationPermissionWithdrawView, + ApplicationWizardPermissionView, ) logger = logging.getLogger(__name__) @@ -27,7 +27,7 @@ logger = logging.getLogger(__name__) class Step(StrEnum): """ - Names for each page of the domain request wizard. + Names for each page of the application wizard. As with Django's own `TextChoices` class, steps will appear in the order they are defined. (Order matters.) @@ -50,15 +50,15 @@ class Step(StrEnum): REVIEW = "review" -class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): +class ApplicationWizard(ApplicationWizardPermissionView, TemplateView): """ A common set of methods and configuration. - The registrar's domain request is several pages of "steps". + The registrar's domain application is several pages of "steps". Together, these steps constitute a "wizard". This base class sets up a shared state (stored in the user's session) - between pages of the domain request and provides common methods for + between pages of the application and provides common methods for processing form data. Views for each step should inherit from this base class. @@ -73,9 +73,9 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): # (this is not seen _in_ urls, only for Django's internal naming) # NB: this is included here for reference. Do not change it without # also changing the many places it is hardcoded in the HTML templates - URL_NAMESPACE = "domain-request" - # name for accessing /domain-request//edit - EDIT_URL_NAME = "edit-domain-request" + URL_NAMESPACE = "application" + # name for accessing /application//edit + EDIT_URL_NAME = "edit-application" NEW_URL_NAME = "/request/" # We need to pass our human-readable step titles as context to the templates. TITLES = { @@ -108,28 +108,28 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): def __init__(self): super().__init__() self.steps = StepsHelper(self) - self._domain_request = None # for caching + self._application = None # for caching def has_pk(self): - """Does this wizard know about a DomainRequest database record?""" - return "domain_request_id" in self.storage + """Does this wizard know about a DomainApplication database record?""" + return "application_id" in self.storage @property def prefix(self): """Namespace the wizard to avoid clashes in session variable names.""" # this is a string literal but can be made dynamic if we'd like - # users to have multiple domain requests open for editing simultaneously - return "wizard_domain_request" + # users to have multiple applications open for editing simultaneously + return "wizard_application" @property - def domain_request(self) -> DomainRequest: + def application(self) -> DomainApplication: """ - Attempt to match the current wizard with a DomainRequest. + Attempt to match the current wizard with a DomainApplication. - Will create a domain request if none exists. + Will create an application if none exists. """ - if self._domain_request: - return self._domain_request + if self._application: + return self._application # For linter. The else block should never be hit, but if it does, # there may be a UI consideration. That will need to be handled in another ticket. @@ -140,20 +140,20 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): raise ValueError("Invalid value for User") if self.has_pk(): - id = self.storage["domain_request_id"] + id = self.storage["application_id"] try: - self._domain_request = DomainRequest.objects.get( + self._application = DomainApplication.objects.get( creator=creator, pk=id, ) - return self._domain_request - except DomainRequest.DoesNotExist: - logger.debug("DomainRequest id %s did not have a DomainRequest" % id) + return self._application + except DomainApplication.DoesNotExist: + logger.debug("Application id %s did not have a DomainApplication" % id) - self._domain_request = DomainRequest.objects.create(creator=self.request.user) + self._application = DomainApplication.objects.create(creator=self.request.user) - self.storage["domain_request_id"] = self._domain_request.id - return self._domain_request + self.storage["application_id"] = self._application.id + return self._application @property def storage(self): @@ -179,9 +179,9 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): def done(self): """Called when the user clicks the submit button, if all forms are valid.""" - self.domain_request.submit() # change the status to submitted - self.domain_request.save() - logger.debug("Domain Request object saved: %s", self.domain_request.id) + self.application.submit() # change the status to submitted + self.application.save() + logger.debug("Application object saved: %s", self.application.id) return redirect(reverse(f"{self.URL_NAMESPACE}:finished")) def from_model(self, attribute: str, default, *args, **kwargs): @@ -194,8 +194,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): in the database before the wizard has been saved. """ if self.has_pk(): - if hasattr(self.domain_request, attribute): - attr = getattr(self.domain_request, attribute) + if hasattr(self.application, attribute): + attr = getattr(self.application, attribute) if callable(attr): return attr(*args, **kwargs) else: @@ -210,24 +210,24 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): current_url = resolve(request.path_info).url_name # if user visited via an "edit" url, associate the id of the - # domain request they are trying to edit to this wizard instance + # application they are trying to edit to this wizard instance # and remove any prior wizard data from their session if current_url == self.EDIT_URL_NAME and "id" in kwargs: del self.storage - self.storage["domain_request_id"] = kwargs["id"] + self.storage["application_id"] = kwargs["id"] self.storage["step_history"] = self.db_check_for_unlocking_steps() # if accessing this class directly, redirect to the first step - # in other words, if `DomainRequestWizard` is called as view + # in other words, if `ApplicationWizard` is called as view # directly by some redirect or url handler, we'll send users # either to an acknowledgement page or to the first step in # the processes (if an edit rather than a new request); subclasses # will NOT be redirected. The purpose of this is to allow code to - # send users "to the domain request wizard" without needing to + # send users "to the application wizard" without needing to # know which view is first in the list of steps. - if self.__class__ == DomainRequestWizard: + if self.__class__ == ApplicationWizard: if request.path_info == self.NEW_URL_NAME: - return render(request, "domain_request_intro.html") + return render(request, "application_intro.html") else: return self.goto(self.steps.first) @@ -236,7 +236,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): context["forms"] = self.get_forms() # if pending requests exist and user does not have approved domains, - # present message that domain request cannot be submitted + # present message that domain application cannot be submitted pending_requests = self.pending_requests() if len(pending_requests) > 0: message_header = "You cannot submit this request yet" @@ -278,7 +278,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): kwargs = { "files": files, "prefix": self.steps.current, - "domain_request": self.domain_request, # this is a property, not an object + "application": self.application, # this is a property, not an object } if step is None: @@ -290,7 +290,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): instantiated = [] for form in forms: - data = form.from_database(self.domain_request) if self.has_pk() else None + data = form.from_database(self.application) if self.has_pk() else None if use_post: instantiated.append(form(self.request.POST, **kwargs)) elif use_db: @@ -303,73 +303,72 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): def pending_requests(self): """return an array of pending requests if user has pending requests and no approved requests""" - if self.approved_domain_requests_exist() or self.approved_domains_exist(): + if self.approved_applications_exist() or self.approved_domains_exist(): return [] else: - return self.pending_domain_requests() + return self.pending_applications() - def approved_domain_requests_exist(self): - """Checks if user is creator of domain requests with DomainRequestStatus.APPROVED status""" - approved_domain_request_count = DomainRequest.objects.filter( - creator=self.request.user, status=DomainRequest.DomainRequestStatus.APPROVED + def approved_applications_exist(self): + """Checks if user is creator of applications with ApplicationStatus.APPROVED status""" + approved_application_count = DomainApplication.objects.filter( + creator=self.request.user, status=DomainApplication.ApplicationStatus.APPROVED ).count() - return approved_domain_request_count > 0 + return approved_application_count > 0 def approved_domains_exist(self): """Checks if user has permissions on approved domains This additional check is necessary to account for domains which were migrated - and do not have a domain request""" + and do not have an application""" return self.request.user.permissions.count() > 0 - def pending_domain_requests(self): - """Returns a List of user's domain requests with one of the following states: - DomainRequestStatus.SUBMITTED, DomainRequestStatus.IN_REVIEW, DomainRequestStatus.ACTION_NEEDED""" - # if the current domain request has DomainRequestStatus.ACTION_NEEDED status, this check should not be performed - if self.domain_request.status == DomainRequest.DomainRequestStatus.ACTION_NEEDED: + def pending_applications(self): + """Returns a List of user's applications with one of the following states: + ApplicationStatus.SUBMITTED, ApplicationStatus.IN_REVIEW, ApplicationStatus.ACTION_NEEDED""" + # if the current application has ApplicationStatus.ACTION_NEEDED status, this check should not be performed + if self.application.status == DomainApplication.ApplicationStatus.ACTION_NEEDED: return [] check_statuses = [ - DomainRequest.DomainRequestStatus.SUBMITTED, - DomainRequest.DomainRequestStatus.IN_REVIEW, - DomainRequest.DomainRequestStatus.ACTION_NEEDED, + DomainApplication.ApplicationStatus.SUBMITTED, + DomainApplication.ApplicationStatus.IN_REVIEW, + DomainApplication.ApplicationStatus.ACTION_NEEDED, ] - return DomainRequest.objects.filter(creator=self.request.user, status__in=check_statuses) + return DomainApplication.objects.filter(creator=self.request.user, status__in=check_statuses) def db_check_for_unlocking_steps(self): """Helper for get_context_data - Queries the DB for a domain request and returns a list of unlocked steps.""" + Queries the DB for an application and returns a list of unlocked steps.""" history_dict = { - "organization_type": self.domain_request.organization_type is not None, - "tribal_government": self.domain_request.tribe_name is not None, - "organization_federal": self.domain_request.federal_type is not None, - "organization_election": self.domain_request.is_election_board is not None, + "organization_type": self.application.organization_type is not None, + "tribal_government": self.application.tribe_name is not None, + "organization_federal": self.application.federal_type is not None, + "organization_election": self.application.is_election_board is not None, "organization_contact": ( - self.domain_request.federal_agency is not None - or self.domain_request.organization_name is not None - or self.domain_request.address_line1 is not None - or self.domain_request.city is not None - or self.domain_request.state_territory is not None - or self.domain_request.zipcode is not None - or self.domain_request.urbanization is not None + self.application.federal_agency is not None + or self.application.organization_name is not None + or self.application.address_line1 is not None + or self.application.city is not None + or self.application.state_territory is not None + or self.application.zipcode is not None + or self.application.urbanization is not None ), - "about_your_organization": self.domain_request.about_your_organization is not None, - "authorizing_official": self.domain_request.authorizing_official is not None, + "about_your_organization": self.application.about_your_organization is not None, + "authorizing_official": self.application.authorizing_official is not None, "current_sites": ( - self.domain_request.current_websites.exists() or self.domain_request.requested_domain is not None + self.application.current_websites.exists() or self.application.requested_domain is not None ), - "dotgov_domain": self.domain_request.requested_domain is not None, - "purpose": self.domain_request.purpose is not None, - "your_contact": self.domain_request.submitter is not None, + "dotgov_domain": self.application.requested_domain is not None, + "purpose": self.application.purpose is not None, + "your_contact": self.application.submitter is not None, "other_contacts": ( - self.domain_request.other_contacts.exists() - or self.domain_request.no_other_contacts_rationale is not None + self.application.other_contacts.exists() or self.application.no_other_contacts_rationale is not None ), "anything_else": ( - self.domain_request.anything_else is not None or self.domain_request.is_policy_acknowledged is not None + self.application.anything_else is not None or self.application.is_policy_acknowledged is not None ), - "requirements": self.domain_request.is_policy_acknowledged is not None, - "review": self.domain_request.is_policy_acknowledged is not None, + "requirements": self.application.is_policy_acknowledged is not None, + "review": self.application.is_policy_acknowledged is not None, } return [key for key, value in history_dict.items() if value] @@ -378,8 +377,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): # Build the submit button that we'll pass to the modal. modal_button = '" # Concatenate the modal header that we'll pass to the modal. - if self.domain_request.requested_domain: - modal_heading = "You are about to submit a domain request for " + str(self.domain_request.requested_domain) + if self.application.requested_domain: + modal_heading = "You are about to submit a domain request for " + str(self.application.requested_domain) else: modal_heading = "You are about to submit an incomplete request" @@ -388,7 +387,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "steps": self.steps, # Add information about which steps should be unlocked "visited": self.storage.get("step_history", []), - "is_federal": self.domain_request.is_federal(), + "is_federal": self.application.is_federal(), "modal_button": modal_button, "modal_heading": modal_heading, } @@ -435,7 +434,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): return self.goto(self.steps.first) # if accessing this class directly, redirect to the first step - if self.__class__ == DomainRequestWizard: + if self.__class__ == ApplicationWizard: return self.goto(self.steps.first) forms = self.get_forms(use_post=True) @@ -463,86 +462,86 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): """ Unpack the form responses onto the model object properties. - Saves the domain request to the database. + Saves the application to the database. """ for form in forms: if form is not None and hasattr(form, "to_database"): - form.to_database(self.domain_request) + form.to_database(self.application) -class OrganizationType(DomainRequestWizard): - template_name = "domain_request_org_type.html" +class OrganizationType(ApplicationWizard): + template_name = "application_org_type.html" forms = [forms.OrganizationTypeForm] -class TribalGovernment(DomainRequestWizard): - template_name = "domain_request_tribal_government.html" +class TribalGovernment(ApplicationWizard): + template_name = "application_tribal_government.html" forms = [forms.TribalGovernmentForm] -class OrganizationFederal(DomainRequestWizard): - template_name = "domain_request_org_federal.html" +class OrganizationFederal(ApplicationWizard): + template_name = "application_org_federal.html" forms = [forms.OrganizationFederalForm] -class OrganizationElection(DomainRequestWizard): - template_name = "domain_request_org_election.html" +class OrganizationElection(ApplicationWizard): + template_name = "application_org_election.html" forms = [forms.OrganizationElectionForm] -class OrganizationContact(DomainRequestWizard): - template_name = "domain_request_org_contact.html" +class OrganizationContact(ApplicationWizard): + template_name = "application_org_contact.html" forms = [forms.OrganizationContactForm] -class AboutYourOrganization(DomainRequestWizard): - template_name = "domain_request_about_your_organization.html" +class AboutYourOrganization(ApplicationWizard): + template_name = "application_about_your_organization.html" forms = [forms.AboutYourOrganizationForm] -class AuthorizingOfficial(DomainRequestWizard): - template_name = "domain_request_authorizing_official.html" +class AuthorizingOfficial(ApplicationWizard): + template_name = "application_authorizing_official.html" forms = [forms.AuthorizingOfficialForm] def get_context_data(self): context = super().get_context_data() - context["organization_type"] = self.domain_request.organization_type - context["federal_type"] = self.domain_request.federal_type + context["organization_type"] = self.application.organization_type + context["federal_type"] = self.application.federal_type return context -class CurrentSites(DomainRequestWizard): - template_name = "domain_request_current_sites.html" +class CurrentSites(ApplicationWizard): + template_name = "application_current_sites.html" forms = [forms.CurrentSitesFormSet] -class DotgovDomain(DomainRequestWizard): - template_name = "domain_request_dotgov_domain.html" +class DotgovDomain(ApplicationWizard): + template_name = "application_dotgov_domain.html" forms = [forms.DotGovDomainForm, forms.AlternativeDomainFormSet] def get_context_data(self): context = super().get_context_data() - context["organization_type"] = self.domain_request.organization_type - context["federal_type"] = self.domain_request.federal_type + context["organization_type"] = self.application.organization_type + context["federal_type"] = self.application.federal_type return context -class Purpose(DomainRequestWizard): - template_name = "domain_request_purpose.html" +class Purpose(ApplicationWizard): + template_name = "application_purpose.html" forms = [forms.PurposeForm] -class YourContact(DomainRequestWizard): - template_name = "domain_request_your_contact.html" +class YourContact(ApplicationWizard): + template_name = "application_your_contact.html" forms = [forms.YourContactForm] -class OtherContacts(DomainRequestWizard): - template_name = "domain_request_other_contacts.html" +class OtherContacts(ApplicationWizard): + template_name = "application_other_contacts.html" forms = [forms.OtherContactsYesNoForm, forms.OtherContactsFormSet, forms.NoOtherContactsForm] def is_valid(self, forms: list) -> bool: - """Overrides default behavior defined in DomainRequestWizard. + """Overrides default behavior defined in ApplicationWizard. Depending on value in other_contacts_yes_no_form, marks forms in other_contacts or no_other_contacts for deletion. Then validates all forms. @@ -581,24 +580,24 @@ class OtherContacts(DomainRequestWizard): return all_forms_valid -class AnythingElse(DomainRequestWizard): - template_name = "domain_request_anything_else.html" +class AnythingElse(ApplicationWizard): + template_name = "application_anything_else.html" forms = [forms.AnythingElseForm] -class Requirements(DomainRequestWizard): - template_name = "domain_request_requirements.html" +class Requirements(ApplicationWizard): + template_name = "application_requirements.html" forms = [forms.RequirementsForm] -class Review(DomainRequestWizard): - template_name = "domain_request_review.html" +class Review(ApplicationWizard): + template_name = "application_review.html" forms = [] # type: ignore def get_context_data(self): context = super().get_context_data() context["Step"] = Step.__members__ - context["domain_request"] = self.domain_request + context["application"] = self.application return context def goto_next_step(self): @@ -624,33 +623,33 @@ class Review(DomainRequestWizard): # return self.goto(self.steps.current) -class Finished(DomainRequestWizard): - template_name = "domain_request_done.html" +class Finished(ApplicationWizard): + template_name = "application_done.html" forms = [] # type: ignore def get(self, request, *args, **kwargs): context = self.get_context_data() - context["domain_request_id"] = self.domain_request.id + context["application_id"] = self.application.id # clean up this wizard session, because we are done with it del self.storage return render(self.request, self.template_name, context) -class DomainRequestStatus(DomainRequestPermissionView): - template_name = "domain_request_status.html" +class ApplicationStatus(DomainApplicationPermissionView): + template_name = "application_status.html" -class DomainRequestWithdrawConfirmation(DomainRequestPermissionWithdrawView): +class ApplicationWithdrawConfirmation(DomainApplicationPermissionWithdrawView): """This page will ask user to confirm if they want to withdraw - The DomainRequestPermissionView restricts access so that only the - `creator` of the domain request may withdraw it. + The DomainApplicationPermissionView restricts access so that only the + `creator` of the application may withdraw it. """ - template_name = "domain_request_withdraw_confirmation.html" + template_name = "application_withdraw_confirmation.html" -class DomainRequestWithdrawn(DomainRequestPermissionWithdrawView): +class ApplicationWithdrawn(DomainApplicationPermissionWithdrawView): # this view renders no template template_name = "" @@ -660,16 +659,16 @@ class DomainRequestWithdrawn(DomainRequestPermissionWithdrawView): If user click on withdraw confirm button, this view updates the status to withdraw and send back to homepage. """ - domain_request = DomainRequest.objects.get(id=self.kwargs["pk"]) - domain_request.withdraw() - domain_request.save() + application = DomainApplication.objects.get(id=self.kwargs["pk"]) + application.withdraw() + application.save() return HttpResponseRedirect(reverse("home")) -class DomainRequestDeleteView(DomainRequestPermissionDeleteView): - """Delete view for home that allows the end user to delete DomainRequests""" +class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView): + """Delete view for home that allows the end user to delete DomainApplications""" - object: DomainRequest # workaround for type mismatch in DeleteView + object: DomainApplication # workaround for type mismatch in DeleteView def has_permission(self): """Custom override for has_permission to exclude all statuses, except WITHDRAWN and STARTED""" @@ -678,7 +677,7 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView): return False status = self.get_object().status - valid_statuses = [DomainRequest.DomainRequestStatus.WITHDRAWN, DomainRequest.DomainRequestStatus.STARTED] + valid_statuses = [DomainApplication.ApplicationStatus.WITHDRAWN, DomainApplication.ApplicationStatus.STARTED] if status not in valid_statuses: return False @@ -690,10 +689,10 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView): def post(self, request, *args, **kwargs): # Grab all orphaned contacts - domain_request: DomainRequest = self.get_object() - contacts_to_delete, duplicates = self._get_orphaned_contacts(domain_request) + application: DomainApplication = self.get_object() + contacts_to_delete, duplicates = self._get_orphaned_contacts(application) - # Delete the DomainRequest + # Delete the DomainApplication response = super().post(request, *args, **kwargs) # Delete orphaned contacts - but only for if they are not associated with a user @@ -703,21 +702,21 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView): # This determines if any of these three fields share a contact, which is used for # the edge case where the same user may be an AO, and a submitter, for example. if len(duplicates) > 0: - duplicates_to_delete, _ = self._get_orphaned_contacts(domain_request, check_db=True) + duplicates_to_delete, _ = self._get_orphaned_contacts(application, check_db=True) Contact.objects.filter(id__in=duplicates_to_delete, user=None).delete() return response - def _get_orphaned_contacts(self, domain_request: DomainRequest, check_db=False): + def _get_orphaned_contacts(self, application: DomainApplication, check_db=False): """ - Collects all orphaned contacts associated with a given DomainRequest object. + Collects all orphaned contacts associated with a given DomainApplication object. - An orphaned contact is defined as a contact that is associated with the domain request, - but not with any other domain_request. This includes the authorizing official, the submitter, - and any other contacts linked to the domain_request. + An orphaned contact is defined as a contact that is associated with the application, + but not with any other application. This includes the authorizing official, the submitter, + and any other contacts linked to the application. Parameters: - domain_request (DomainRequest): The DomainRequest object for which to find orphaned contacts. + application (DomainApplication): The DomainApplication object for which to find orphaned contacts. check_db (bool, optional): A flag indicating whether to check the database for the existence of the contacts. Defaults to False. @@ -727,11 +726,11 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView): """ contacts_to_delete = [] - # Get each contact object on the DomainRequest object - ao = domain_request.authorizing_official - submitter = domain_request.submitter - other_contacts = list(domain_request.other_contacts.all()) - other_contact_ids = domain_request.other_contacts.all().values_list("id", flat=True) + # Get each contact object on the DomainApplication object + ao = application.authorizing_official + submitter = application.submitter + other_contacts = list(application.other_contacts.all()) + other_contact_ids = application.other_contacts.all().values_list("id", flat=True) # Check if the desired item still exists in the DB if check_db: @@ -740,8 +739,8 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView): other_contacts = self._get_contacts_by_id(other_contact_ids) # Pair each contact with its db related name for use in checking if it has joins - checked_contacts = [(ao, "authorizing_official"), (submitter, "submitted_domain_requests")] - checked_contacts.extend((contact, "contact_domain_requests") for contact in other_contacts) + checked_contacts = [(ao, "authorizing_official"), (submitter, "submitted_applications")] + checked_contacts.extend((contact, "contact_applications") for contact in other_contacts) for contact, related_name in checked_contacts: if contact is not None and not contact.has_more_than_one_join(related_name): diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py index cb170078a..367e5c315 100644 --- a/src/registrar/views/index.py +++ b/src/registrar/views/index.py @@ -1,56 +1,56 @@ from django.shortcuts import render -from registrar.models import DomainRequest, Domain, UserDomainRole +from registrar.models import DomainApplication, Domain, UserDomainRole def index(request): """This page is available to anyone without logging in.""" context = {} if request.user.is_authenticated: - # Get all domain requests the user has access to - domain_requests, deletable_domain_requests = _get_domain_requests(request) + # Get all domain applications the user has access to + applications, deletable_applications = _get_applications(request) - context["domain_requests"] = domain_requests + context["domain_applications"] = applications # Get all domains the user has access to domains = _get_domains(request) context["domains"] = domains - # Determine if the user will see domain requests that they can delete - has_deletable_domain_requests = deletable_domain_requests.exists() - context["has_deletable_domain_requests"] = has_deletable_domain_requests + # Determine if the user will see applications that they can delete + has_deletable_applications = deletable_applications.exists() + context["has_deletable_applications"] = has_deletable_applications - # If they can delete domain requests, add the delete button to the context - if has_deletable_domain_requests: + # If they can delete applications, add the delete button to the context + if has_deletable_applications: # Add the delete modal button to the context modal_button = ( '' + 'name="delete-application">Yes, delete request' ) context["modal_button"] = modal_button return render(request, "home.html", context) -def _get_domain_requests(request): +def _get_applications(request): """Given the current request, - get all DomainRequests that are associated with the UserDomainRole object. + get all DomainApplications that are associated with the UserDomainRole object. - Returns a tuple of all domain requests, and those that are deletable by the user. + Returns a tuple of all applications, and those that are deletable by the user. """ - # Let's exclude the approved domain requests since our - # domain_requests context will be used to populate - # the active domain requests table - domain_requests = DomainRequest.objects.filter(creator=request.user).exclude( - status=DomainRequest.DomainRequestStatus.APPROVED + # Let's exclude the approved applications since our + # domain_applications context will be used to populate + # the active applications table + applications = DomainApplication.objects.filter(creator=request.user).exclude( + status=DomainApplication.ApplicationStatus.APPROVED ) # Create a placeholder DraftDomain for each incomplete draft - valid_statuses = [DomainRequest.DomainRequestStatus.STARTED, DomainRequest.DomainRequestStatus.WITHDRAWN] - deletable_domain_requests = domain_requests.filter(status__in=valid_statuses) + valid_statuses = [DomainApplication.ApplicationStatus.STARTED, DomainApplication.ApplicationStatus.WITHDRAWN] + deletable_applications = applications.filter(status__in=valid_statuses) - return (domain_requests, deletable_domain_requests) + return (applications, deletable_applications) def _get_domains(request): diff --git a/src/registrar/views/utility/__init__.py b/src/registrar/views/utility/__init__.py index 7299c0368..3d1a64628 100644 --- a/src/registrar/views/utility/__init__.py +++ b/src/registrar/views/utility/__init__.py @@ -3,8 +3,8 @@ from .always_404 import always_404 from .permission_views import ( DomainPermissionView, - DomainRequestPermissionView, - DomainRequestPermissionWithdrawView, + DomainApplicationPermissionView, + DomainApplicationPermissionWithdrawView, DomainInvitationPermissionDeleteView, - DomainRequestWizardPermissionView, + ApplicationWizardPermissionView, ) diff --git a/src/registrar/views/utility/mixins.py b/src/registrar/views/utility/mixins.py index aa0c9cd6b..8de75e151 100644 --- a/src/registrar/views/utility/mixins.py +++ b/src/registrar/views/utility/mixins.py @@ -4,7 +4,7 @@ from django.contrib.auth.mixins import PermissionRequiredMixin from registrar.models import ( Domain, - DomainRequest, + DomainApplication, DomainInvitation, DomainInformation, UserDomainRole, @@ -230,10 +230,10 @@ class DomainPermission(PermissionsLoginMixin): # Analysts may manage domains, when they are in these statuses: valid_domain_statuses = [ - DomainRequest.DomainRequestStatus.APPROVED, - DomainRequest.DomainRequestStatus.IN_REVIEW, - DomainRequest.DomainRequestStatus.REJECTED, - DomainRequest.DomainRequestStatus.ACTION_NEEDED, + DomainApplication.ApplicationStatus.APPROVED, + DomainApplication.ApplicationStatus.IN_REVIEW, + DomainApplication.ApplicationStatus.REJECTED, + DomainApplication.ApplicationStatus.ACTION_NEEDED, # Edge case - some domains do not have # a status or DomainInformation... aka a status of 'None'. # It is necessary to access those to correct errors. @@ -244,14 +244,14 @@ class DomainPermission(PermissionsLoginMixin): if DomainInformation.objects.filter(id=pk).exists(): requested_domain = DomainInformation.objects.get(id=pk) - # if no domain information or domain request exist, the user + # if no domain information or application exist, the user # should be able to manage the domain; however, if domain information - # and domain request exist, and domain request is not in valid status, + # and domain application exist, and application is not in valid status, # user should not be able to manage domain if ( requested_domain - and requested_domain.domain_request - and requested_domain.domain_request.status not in valid_domain_statuses + and requested_domain.domain_application + and requested_domain.domain_application.status not in valid_domain_statuses ): return False @@ -261,12 +261,12 @@ class DomainPermission(PermissionsLoginMixin): return True -class DomainRequestPermission(PermissionsLoginMixin): - """Permission mixin that redirects to domain request if user +class DomainApplicationPermission(PermissionsLoginMixin): + """Permission mixin that redirects to domain application if user has access, otherwise 403""" def has_permission(self): - """Check if this user has access to this domain request. + """Check if this user has access to this domain application. The user is in self.request.user and the domain needs to be looked up from the domain's primary key in self.kwargs["pk"] @@ -274,10 +274,10 @@ class DomainRequestPermission(PermissionsLoginMixin): if not self.request.user.is_authenticated: return False - # user needs to be the creator of the domain request - # this query is empty if there isn't a domain request with this + # user needs to be the creator of the application + # this query is empty if there isn't a domain application with this # id and this user as creator - if not DomainRequest.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists(): + if not DomainApplication.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists(): return False return True @@ -288,7 +288,7 @@ class UserDeleteDomainRolePermission(PermissionsLoginMixin): has access, otherwise 403""" def has_permission(self): - """Check if this user has access to this domain request. + """Check if this user has access to this domain application. The user is in self.request.user and the domain needs to be looked up from the domain's primary key in self.kwargs["pk"] @@ -319,19 +319,19 @@ class UserDeleteDomainRolePermission(PermissionsLoginMixin): return True -class DomainRequestPermissionWithdraw(PermissionsLoginMixin): - """Permission mixin that redirects to withdraw action on domain request +class DomainApplicationPermissionWithdraw(PermissionsLoginMixin): + """Permission mixin that redirects to withdraw action on domain application if user has access, otherwise 403""" def has_permission(self): - """Check if this user has access to withdraw this domain request.""" + """Check if this user has access to withdraw this domain application.""" if not self.request.user.is_authenticated: return False - # user needs to be the creator of the domain request - # this query is empty if there isn't a domain request with this + # user needs to be the creator of the application + # this query is empty if there isn't a domain application with this # id and this user as creator - if not DomainRequest.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists(): + if not DomainApplication.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists(): return False # Restricted users should not be able to withdraw domain requests @@ -341,12 +341,12 @@ class DomainRequestPermissionWithdraw(PermissionsLoginMixin): return True -class DomainRequestWizardPermission(PermissionsLoginMixin): - """Permission mixin that redirects to start or edit domain request if +class ApplicationWizardPermission(PermissionsLoginMixin): + """Permission mixin that redirects to start or edit domain application if user has access, otherwise 403""" def has_permission(self): - """Check if this user has permission to start or edit a domain request. + """Check if this user has permission to start or edit an application. The user is in self.request.user """ diff --git a/src/registrar/views/utility/permission_views.py b/src/registrar/views/utility/permission_views.py index f2752c3b5..02d3db96d 100644 --- a/src/registrar/views/utility/permission_views.py +++ b/src/registrar/views/utility/permission_views.py @@ -3,15 +3,15 @@ import abc # abstract base class from django.views.generic import DetailView, DeleteView, TemplateView -from registrar.models import Domain, DomainRequest, DomainInvitation +from registrar.models import Domain, DomainApplication, DomainInvitation from registrar.models.user_domain_role import UserDomainRole from .mixins import ( DomainPermission, - DomainRequestPermission, - DomainRequestPermissionWithdraw, + DomainApplicationPermission, + DomainApplicationPermissionWithdraw, DomainInvitationPermission, - DomainRequestWizardPermission, + ApplicationWizardPermission, UserDeleteDomainRolePermission, ) import logging @@ -56,17 +56,17 @@ class DomainPermissionView(DomainPermission, DetailView, abc.ABC): raise NotImplementedError -class DomainRequestPermissionView(DomainRequestPermission, DetailView, abc.ABC): - """Abstract base view for domain requests that enforces permissions +class DomainApplicationPermissionView(DomainApplicationPermission, DetailView, abc.ABC): + """Abstract base view for domain applications that enforces permissions This abstract view cannot be instantiated. Actual views must specify `template_name`. """ # DetailView property for what model this is viewing - model = DomainRequest + model = DomainApplication # variable name in template context for the model object - context_object_name = "DomainRequest" + context_object_name = "domainapplication" # Abstract property enforces NotImplementedError on an attribute. @property @@ -75,17 +75,17 @@ class DomainRequestPermissionView(DomainRequestPermission, DetailView, abc.ABC): raise NotImplementedError -class DomainRequestPermissionWithdrawView(DomainRequestPermissionWithdraw, DetailView, abc.ABC): - """Abstract base view for domain request withdraw function +class DomainApplicationPermissionWithdrawView(DomainApplicationPermissionWithdraw, DetailView, abc.ABC): + """Abstract base view for domain application withdraw function This abstract view cannot be instantiated. Actual views must specify `template_name`. """ # DetailView property for what model this is viewing - model = DomainRequest + model = DomainApplication # variable name in template context for the model object - context_object_name = "DomainRequest" + context_object_name = "domainapplication" # Abstract property enforces NotImplementedError on an attribute. @property @@ -94,8 +94,8 @@ class DomainRequestPermissionWithdrawView(DomainRequestPermissionWithdraw, Detai raise NotImplementedError -class DomainRequestWizardPermissionView(DomainRequestWizardPermission, TemplateView, abc.ABC): - """Abstract base view for the domain request form that enforces permissions +class ApplicationWizardPermissionView(ApplicationWizardPermission, TemplateView, abc.ABC): + """Abstract base view for the application form that enforces permissions This abstract view cannot be instantiated. Actual views must specify `template_name`. @@ -121,11 +121,11 @@ class DomainInvitationPermissionDeleteView(DomainInvitationPermission, DeleteVie object: DomainInvitation # workaround for type mismatch in DeleteView -class DomainRequestPermissionDeleteView(DomainRequestPermission, DeleteView, abc.ABC): - """Abstract view for deleting a DomainRequest.""" +class DomainApplicationPermissionDeleteView(DomainApplicationPermission, DeleteView, abc.ABC): + """Abstract view for deleting a DomainApplication.""" - model = DomainRequest - object: DomainRequest + model = DomainApplication + object: DomainApplication class UserDomainRolePermissionDeleteView(UserDeleteDomainRolePermission, DeleteView, abc.ABC):
Your domain requests
Date submitted Status ActionDelete Action
- {% if domain_request.requested_domain is None %} + {% if application.requested_domain is None %} New domain request {# Add a breakpoint #} - ({{ domain_request.created_at }} UTC) + ({{ application.created_at }} UTC) {% else %} - {{ domain_request.requested_domain.name }} + {{ application.requested_domain.name }} {% endif %} - {% if domain_request.submission_date %} - {{ domain_request.submission_date|date }} + + {% if application.submission_date %} + {{ application.submission_date|date }} {% else %} Not submitted {% endif %} {{ domain_request.get_status_display }}{{ application.get_status_display }} {% with prefix="New domain request ("%} - {% with date=domain_request.created_at|date:"DATETIME_FORMAT"%} + {% with date=application.created_at|date:"DATETIME_FORMAT"%} {% with name_default=prefix|add:date|add:" UTC)"%} - {% if domain_request.status == domain_request.DomainRequestStatus.STARTED or domain_request.status == domain_request.DomainRequestStatus.ACTION_NEEDED or domain_request.status == domain_request.DomainRequestStatus.WITHDRAWN %} - + {% if application.status == application.ApplicationStatus.STARTED or application.status == application.ApplicationStatus.ACTION_NEEDED or application.status == application.ApplicationStatus.WITHDRAWN %} + - {% if domain_request.requested_domain is not None%} - Edit {{ domain_request.requested_domain.name }} + {% if application.requested_domain is not None%} + Edit {{ application.requested_domain.name }} {% else %} Edit {{ name_default }} {% endif %} {% else %} - + - Manage {{ domain_request.requested_domain.name|default:name_default }} + Manage {{ application.requested_domain.name|default:name_default }} {% endif %} {% endwith %} {% endwith %} {% endwith %} - {% if domain_request.status == "started" or domain_request.status == "withdrawn" %} + {% if application.status == "started" or application.status == "withdrawn" %} {% with prefix="New domain request ("%} - {% with date=domain_request.created_at|date:"DATETIME_FORMAT"%} + {% with date=application.created_at|date:"DATETIME_FORMAT"%} {% with name_default=prefix|add:date|add:" UTC)"%} - {% if domain_request.requested_domain is not None %} - Delete {{ domain_request.requested_domain.name }} + {% if application.requested_domain is not None %} + Delete {{ application.requested_domain.name }} {% else %} Delete {{ name_default }} {% endif %} @@ -198,11 +198,11 @@ aria-describedby="Domain will be removed" data-force-action > -
- {% if domain_request.requested_domain is None %} - {% if domain_request.created_at %} + + {% if application.requested_domain is None %} + {% if application.created_at %} {% with prefix="(created " %} - {% with formatted_date=domain_request.created_at|date:"DATETIME_FORMAT" %} + {% with formatted_date=application.created_at|date:"DATETIME_FORMAT" %} {% with modal_content=prefix|add:formatted_date|add:" UTC)" %} {% include 'includes/modal.html' with modal_heading="Are you sure you want to delete this domain request?" modal_description="This will remove the domain request "|add:modal_content|add:" from the .gov registrar. This action cannot be undone." modal_button=modal_button|safe %} {% endwith %} @@ -212,7 +212,7 @@ {% include 'includes/modal.html' with modal_heading="Are you sure you want to delete New domain request?" modal_description="This will remove the domain request from the .gov registrar. This action cannot be undone." modal_button=modal_button|safe %} {% endif %} {% else %} - {% with modal_heading_value=domain_request.requested_domain.name|add:"?" %} + {% with modal_heading_value=application.requested_domain.name|add:"?" %} {% include 'includes/modal.html' with modal_heading="Are you sure you want to delete" heading_value=modal_heading_value modal_description="This will remove the domain request from the .gov registrar. This action cannot be undone." modal_button=modal_button|safe %} {% endwith %} {% endif %} @@ -231,7 +231,7 @@ > {% else %}

You haven't requested any domains.

- + {% endif %} diff --git a/src/registrar/templates/includes/domain_request.html b/src/registrar/templates/includes/domain_application.html similarity index 100% rename from src/registrar/templates/includes/domain_request.html rename to src/registrar/templates/includes/domain_application.html diff --git a/src/registrar/templatetags/custom_filters.py b/src/registrar/templatetags/custom_filters.py index ff7a6258c..de2051989 100644 --- a/src/registrar/templatetags/custom_filters.py +++ b/src/registrar/templatetags/custom_filters.py @@ -1,7 +1,7 @@ import logging from django import template import re -from registrar.models.domain_request import DomainRequest +from registrar.models.domain_application import DomainApplication register = template.Library() logger = logging.getLogger(__name__) @@ -55,7 +55,7 @@ def contains_checkbox(html_list): @register.filter def get_organization_long_name(organization_type): - organization_choices_dict = dict(DomainRequest.OrganizationChoicesVerbose.choices) + organization_choices_dict = dict(DomainApplication.OrganizationChoicesVerbose.choices) long_form_type = organization_choices_dict[organization_type] if long_form_type is None: logger.error("Organization type error, triggered by a template's custom filter") diff --git a/src/registrar/tests/common.py b/src/registrar/tests/common.py index adb1a2142..be3643a51 100644 --- a/src/registrar/tests/common.py +++ b/src/registrar/tests/common.py @@ -18,7 +18,7 @@ from registrar.models import ( Contact, DraftDomain, Website, - DomainRequest, + DomainApplication, DomainInvitation, User, UserGroup, @@ -221,7 +221,7 @@ class AuditedAdminMockData: # Constants for different domain object types INFORMATION = "information" - DOMAIN_REQUEST = "domain_request" + APPLICATION = "application" INVITATION = "invitation" def dummy_user(self, item_name, short_hand): @@ -365,24 +365,24 @@ class AuditedAdminMockData: self, domain_type, item_name, - status=DomainRequest.DomainRequestStatus.STARTED, + status=DomainApplication.ApplicationStatus.STARTED, org_type="federal", federal_type="executive", purpose="Purpose of the site", ): """ - Returns a prebuilt kwarg dictionary for DomainRequest, + Returns a prebuilt kwarg dictionary for DomainApplication, DomainInformation, or DomainInvitation. Args: - domain_type (str): is either 'domain_request', 'information', + domain_type (str): is either 'application', 'information', or 'invitation'. item_name (str): A shared str value appended to first_name, last_name, organization_name, address_line1, address_line2, title, email, and username. - status (str - optional): Defines the status for DomainRequest, - e.g. DomainRequest.DomainRequestStatus.STARTED + status (str - optional): Defines the status for DomainApplication, + e.g. DomainApplication.ApplicationStatus.STARTED org_type (str - optional): Sets a domains org_type @@ -391,13 +391,13 @@ class AuditedAdminMockData: purpose (str - optional): Sets a domains purpose Returns: dict: Returns a dictionary structurally consistent with the expected input - of either DomainRequest, DomainInvitation, or DomainInformation + of either DomainApplication, DomainInvitation, or DomainInformation based on the 'domain_type' field. """ # noqa common_args = self.get_common_domain_arg_dictionary(item_name, org_type, federal_type, purpose) full_arg_dict = None match domain_type: - case self.DOMAIN_REQUEST: + case self.APPLICATION: full_arg_dict = dict( **common_args, requested_domain=self.dummy_draft_domain(item_name), @@ -405,11 +405,11 @@ class AuditedAdminMockData: status=status, ) case self.INFORMATION: - domain_req = self.create_full_dummy_domain_request(item_name) + domain_app = self.create_full_dummy_domain_application(item_name) full_arg_dict = dict( **common_args, domain=self.dummy_domain(item_name, True), - domain_request=domain_req, + domain_application=domain_app, ) case self.INVITATION: full_arg_dict = dict( @@ -419,24 +419,24 @@ class AuditedAdminMockData: ) return full_arg_dict - def create_full_dummy_domain_request(self, item_name, status=DomainRequest.DomainRequestStatus.STARTED): - """Creates a dummy domain request object""" - domain_request_kwargs = self.dummy_kwarg_boilerplate(self.DOMAIN_REQUEST, item_name, status) - domain_request = DomainRequest.objects.get_or_create(**domain_request_kwargs)[0] - return domain_request + def create_full_dummy_domain_application(self, item_name, status=DomainApplication.ApplicationStatus.STARTED): + """Creates a dummy domain application object""" + domain_application_kwargs = self.dummy_kwarg_boilerplate(self.APPLICATION, item_name, status) + application = DomainApplication.objects.get_or_create(**domain_application_kwargs)[0] + return application - def create_full_dummy_domain_information(self, item_name, status=DomainRequest.DomainRequestStatus.STARTED): + def create_full_dummy_domain_information(self, item_name, status=DomainApplication.ApplicationStatus.STARTED): """Creates a dummy domain information object""" - domain_request_kwargs = self.dummy_kwarg_boilerplate(self.INFORMATION, item_name, status) - domain_request = DomainInformation.objects.get_or_create(**domain_request_kwargs)[0] - return domain_request + domain_application_kwargs = self.dummy_kwarg_boilerplate(self.INFORMATION, item_name, status) + application = DomainInformation.objects.get_or_create(**domain_application_kwargs)[0] + return application - def create_full_dummy_domain_invitation(self, item_name, status=DomainRequest.DomainRequestStatus.STARTED): + def create_full_dummy_domain_invitation(self, item_name, status=DomainApplication.ApplicationStatus.STARTED): """Creates a dummy domain invitation object""" - domain_request_kwargs = self.dummy_kwarg_boilerplate(self.INVITATION, item_name, status) - domain_request = DomainInvitation.objects.get_or_create(**domain_request_kwargs)[0] + domain_application_kwargs = self.dummy_kwarg_boilerplate(self.INVITATION, item_name, status) + application = DomainInvitation.objects.get_or_create(**domain_application_kwargs)[0] - return domain_request + return application def create_full_dummy_domain_object( self, @@ -445,31 +445,31 @@ class AuditedAdminMockData: has_other_contacts=True, has_current_website=True, has_alternative_gov_domain=True, - status=DomainRequest.DomainRequestStatus.STARTED, + status=DomainApplication.ApplicationStatus.STARTED, ): - """A helper to create a dummy domain request object""" - domain_request = None + """A helper to create a dummy domain application object""" + application = None match domain_type: - case self.DOMAIN_REQUEST: - domain_request = self.create_full_dummy_domain_request(item_name, status) + case self.APPLICATION: + application = self.create_full_dummy_domain_application(item_name, status) case self.INVITATION: - domain_request = self.create_full_dummy_domain_invitation(item_name, status) + application = self.create_full_dummy_domain_invitation(item_name, status) case self.INFORMATION: - domain_request = self.create_full_dummy_domain_information(item_name, status) + application = self.create_full_dummy_domain_information(item_name, status) case _: raise ValueError("Invalid domain_type, must conform to given constants") if has_other_contacts and domain_type != self.INVITATION: other = self.dummy_contact(item_name, "other") - domain_request.other_contacts.add(other) - if has_current_website and domain_type == self.DOMAIN_REQUEST: + application.other_contacts.add(other) + if has_current_website and domain_type == self.APPLICATION: current = self.dummy_current(item_name) - domain_request.current_websites.add(current) - if has_alternative_gov_domain and domain_type == self.DOMAIN_REQUEST: + application.current_websites.add(current) + if has_alternative_gov_domain and domain_type == self.APPLICATION: alt = self.dummy_alt(item_name) - domain_request.alternative_domains.add(alt) + application.alternative_domains.add(alt) - return domain_request + return application def mock_user(): @@ -519,18 +519,18 @@ def create_ready_domain(): return domain -def completed_domain_request( +def completed_application( has_other_contacts=True, has_current_website=True, has_alternative_gov_domain=True, has_about_your_organization=True, has_anything_else=True, - status=DomainRequest.DomainRequestStatus.STARTED, + status=DomainApplication.ApplicationStatus.STARTED, user=False, submitter=False, name="city.gov", ): - """A completed domain request.""" + """A completed domain application.""" if not user: user = get_user_model().objects.create(username="username" + str(uuid.uuid4())[:8]) ao, _ = Contact.objects.get_or_create( @@ -558,7 +558,7 @@ def completed_domain_request( email="testy2@town.com", phone="(555) 555 5557", ) - domain_request_kwargs = dict( + domain_application_kwargs = dict( organization_type="federal", federal_type="executive", purpose="Purpose of the site", @@ -575,43 +575,43 @@ def completed_domain_request( status=status, ) if has_about_your_organization: - domain_request_kwargs["about_your_organization"] = "e-Government" + domain_application_kwargs["about_your_organization"] = "e-Government" if has_anything_else: - domain_request_kwargs["anything_else"] = "There is more" + domain_application_kwargs["anything_else"] = "There is more" - domain_request, _ = DomainRequest.objects.get_or_create(**domain_request_kwargs) + application, _ = DomainApplication.objects.get_or_create(**domain_application_kwargs) if has_other_contacts: - domain_request.other_contacts.add(other) + application.other_contacts.add(other) if has_current_website: - domain_request.current_websites.add(current) + application.current_websites.add(current) if has_alternative_gov_domain: - domain_request.alternative_domains.add(alt) + application.alternative_domains.add(alt) - return domain_request + return application def multiple_unalphabetical_domain_objects( - domain_type=AuditedAdminMockData.DOMAIN_REQUEST, + domain_type=AuditedAdminMockData.APPLICATION, ): """Returns a list of generic domain objects for testing purposes""" - domain_requests = [] + applications = [] list_of_letters = list(ascii_uppercase) random.shuffle(list_of_letters) mock = AuditedAdminMockData() for object_name in list_of_letters: - domain_request = mock.create_full_dummy_domain_object(domain_type, object_name) - domain_requests.append(domain_request) - return domain_requests + application = mock.create_full_dummy_domain_object(domain_type, object_name) + applications.append(application) + return applications def generic_domain_object(domain_type, object_name): """Returns a generic domain object of - domain_type 'domain_request', 'information', or 'invitation'""" + domain_type 'application', 'information', or 'invitation'""" mock = AuditedAdminMockData() - domain_request = mock.create_full_dummy_domain_object(domain_type, object_name) - return domain_request + application = mock.create_full_dummy_domain_object(domain_type, object_name) + return application class MockEppLib(TestCase): diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py index 2b85627ca..3010247e7 100644 --- a/src/registrar/tests/test_admin.py +++ b/src/registrar/tests/test_admin.py @@ -7,8 +7,8 @@ from django.contrib import messages from django.urls import reverse from registrar.admin import ( DomainAdmin, - DomainRequestAdmin, - DomainRequestAdminForm, + DomainApplicationAdmin, + DomainApplicationAdminForm, DomainInvitationAdmin, ListHeaderAdmin, MyUserAdmin, @@ -18,13 +18,13 @@ from registrar.admin import ( UserDomainRoleAdmin, VerifiedByStaffAdmin, ) -from registrar.models import Domain, DomainRequest, DomainInformation, User, DomainInvitation, Contact, Website +from registrar.models import Domain, DomainApplication, DomainInformation, User, DomainInvitation, Contact, Website from registrar.models.user_domain_role import UserDomainRole from registrar.models.verified_by_staff import VerifiedByStaff from .common import ( MockSESClient, AuditedAdminMockData, - completed_domain_request, + completed_application, generic_domain_object, less_console_noise, mock_user, @@ -236,15 +236,15 @@ class TestDomainAdmin(MockEppLib, WebTest): """ with less_console_noise(): self.client.force_login(self.superuser) - domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW) + application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW) mock_client = MockSESClient() with boto3_mocking.clients.handler_for("sesv2", mock_client): - domain_request.approve() + application.approve() response = self.client.get("/admin/registrar/domain/") # There are 4 template references to Federal (4) plus four references in the table - # for our actual domain_request + # for our actual application self.assertContains(response, "Federal", count=8) # This may be a bit more robust self.assertContains(response, '
FederalFederal