mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 00:57:02 +02:00
Find-replace "domain application", "domain_application", "domain-application" with "domain request", "domain_request", "domain-request". Preserved camel-cases through strict find-replace conditions.
This commit is contained in:
parent
b355f1813d
commit
0ce03d21c7
80 changed files with 721 additions and 721 deletions
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
|
@ -22,7 +22,7 @@ body:
|
||||||
attributes:
|
attributes:
|
||||||
label: Expected Behavior
|
label: Expected Behavior
|
||||||
description: "Please add a concise description of the behavior you would expect if this issue were not occurring"
|
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 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"
|
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"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
|
8
.github/ISSUE_TEMPLATE/story.yml
vendored
8
.github/ISSUE_TEMPLATE/story.yml
vendored
|
@ -19,7 +19,7 @@ body:
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
As an analyst
|
As an analyst
|
||||||
I want the ability to approve a domain application
|
I want the ability to approve a domain request
|
||||||
so that a request can be fulfilled and a new .gov domain can be provisioned
|
so that a request can be fulfilled and a new .gov domain can be provisioned
|
||||||
value: |
|
value: |
|
||||||
As a
|
As a
|
||||||
|
@ -36,11 +36,11 @@ body:
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
- Application sends an email when analysts approve domain requests
|
- Application sends an email when analysts approve domain requests
|
||||||
- Domain application status is "approved"
|
- Domain request status is "approved"
|
||||||
|
|
||||||
Example ("given, when, then" format):
|
Example ("given, when, then" format):
|
||||||
Given that I am an analyst who has finished reviewing a domain application
|
Given that I am an analyst who has finished reviewing a domain request
|
||||||
When I click to approve a domain application
|
When I click to approve a domain request
|
||||||
Then the domain provisioning process should be initiated, and the applicant should receive an email update.
|
Then the domain provisioning process should be initiated, and the applicant should receive an email update.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# 15. Use Django-FSM library for domain application state
|
# 15. Use Django-FSM library for domain request state
|
||||||
|
|
||||||
Date: 2022-11-03
|
Date: 2022-11-03
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Accepted
|
||||||
|
|
||||||
The applications that registrants submit for domains move through a variety of
|
The applications that registrants submit for domains move through a variety of
|
||||||
different states or stages as they are processed by CISA staff. Traditionally,
|
different states or stages as they are processed by CISA staff. Traditionally,
|
||||||
there would be a “domain application” data model with a “status” field. The
|
there would be a “domain request” data model with a “status” field. The
|
||||||
rules in the application code that control what changes are permitted to the
|
rules in the application code that control what changes are permitted to the
|
||||||
statuses are called “domain logic”.
|
statuses are called “domain logic”.
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ However, a significant portion of the user workflow had already been coded, so i
|
||||||
|
|
||||||
## Decision
|
## Decision
|
||||||
|
|
||||||
To maintain each page of the domain application as its own Django view class, inheriting common code from a parent class.
|
To maintain each page of the domain request 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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ Accepted
|
||||||
|
|
||||||
## Context
|
## 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 application 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 request or existing domain.
|
||||||
|
|
||||||
## Considered Options
|
## Considered Options
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
This diagram connects the data models along with various workflow stages.
|
This diagram connects the data models along with various workflow stages.
|
||||||
|
|
||||||
1. The applicant starts the process at `/request` interacting with the
|
1. The applicant starts the process at `/request` interacting with the
|
||||||
`DomainApplication` object.
|
`DomainRequest` object.
|
||||||
|
|
||||||
2. The analyst approves the application using the `DomainApplication`'s
|
2. The analyst approves the application using the `DomainRequest`'s
|
||||||
`approve()` method which creates many related objects: `UserDomainRole`,
|
`approve()` method which creates many related objects: `UserDomainRole`,
|
||||||
`Domain`, and `DomainInformation`.
|
`Domain`, and `DomainInformation`.
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ $ docker run -v $(pwd):$(pwd) -w $(pwd) -it plantuml/plantuml -tsvg model_timeli
|
||||||
allowmixing
|
allowmixing
|
||||||
left to right direction
|
left to right direction
|
||||||
|
|
||||||
class DomainApplication {
|
class DomainRequest {
|
||||||
Application for a domain
|
Application for a domain
|
||||||
--
|
--
|
||||||
creator (User)
|
creator (User)
|
||||||
|
@ -66,7 +66,7 @@ note left of User
|
||||||
<b>username</b> is the Login UUID
|
<b>username</b> is the Login UUID
|
||||||
end note
|
end note
|
||||||
|
|
||||||
DomainApplication -l- User : creator, investigator
|
DomainRequest -l- User : creator, investigator
|
||||||
|
|
||||||
class Contact {
|
class Contact {
|
||||||
Contact info for a person
|
Contact info for a person
|
||||||
|
@ -80,7 +80,7 @@ class Contact {
|
||||||
--
|
--
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainApplication *-r-* Contact : authorizing_official, submitter, other_contacts
|
DomainRequest *-r-* Contact : authorizing_official, submitter, other_contacts
|
||||||
|
|
||||||
class DraftDomain {
|
class DraftDomain {
|
||||||
Requested domain
|
Requested domain
|
||||||
|
@ -89,7 +89,7 @@ class DraftDomain {
|
||||||
--
|
--
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainApplication -l- DraftDomain : requested_domain
|
DomainRequest -l- DraftDomain : requested_domain
|
||||||
|
|
||||||
class Domain {
|
class Domain {
|
||||||
Approved domain
|
Approved domain
|
||||||
|
@ -99,21 +99,21 @@ class Domain {
|
||||||
<b>EPP methods</b>
|
<b>EPP methods</b>
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainApplication .right[#blue].> Domain : approve()
|
DomainRequest .right[#blue].> Domain : approve()
|
||||||
|
|
||||||
class DomainInformation {
|
class DomainInformation {
|
||||||
Registrar information on a domain
|
Registrar information on a domain
|
||||||
--
|
--
|
||||||
domain (Domain)
|
domain (Domain)
|
||||||
domain_application (DomainApplication)
|
domain_request (DomainRequest)
|
||||||
security_email
|
security_email
|
||||||
--
|
--
|
||||||
Request information...
|
Request information...
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainInformation -- Domain
|
DomainInformation -- Domain
|
||||||
DomainInformation -- DomainApplication
|
DomainInformation -- DomainRequest
|
||||||
DomainApplication .[#blue].> DomainInformation : approve()
|
DomainRequest .[#blue].> DomainInformation : approve()
|
||||||
|
|
||||||
class UserDomainRole {
|
class UserDomainRole {
|
||||||
Permissions
|
Permissions
|
||||||
|
@ -125,7 +125,7 @@ class UserDomainRole {
|
||||||
}
|
}
|
||||||
UserDomainRole -- User
|
UserDomainRole -- User
|
||||||
UserDomainRole -- Domain
|
UserDomainRole -- Domain
|
||||||
DomainApplication .[#blue].> UserDomainRole : approve()
|
DomainRequest .[#blue].> UserDomainRole : approve()
|
||||||
|
|
||||||
class DomainInvitation {
|
class DomainInvitation {
|
||||||
Email invitations sent
|
Email invitations sent
|
||||||
|
@ -139,10 +139,10 @@ DomainInvitation -- Domain
|
||||||
DomainInvitation .[#green].> UserDomainRole : User.on_each_login()
|
DomainInvitation .[#green].> UserDomainRole : User.on_each_login()
|
||||||
|
|
||||||
actor applicant #Red
|
actor applicant #Red
|
||||||
applicant -d-> DomainApplication : **/request**
|
applicant -d-> DomainRequest : **/request**
|
||||||
|
|
||||||
actor analyst #Blue
|
actor analyst #Blue
|
||||||
analyst -[#blue]-> DomainApplication : **approve()**
|
analyst -[#blue]-> DomainRequest : **approve()**
|
||||||
|
|
||||||
actor user1 #Green
|
actor user1 #Green
|
||||||
user1 -[#green]-> Domain : **/domain/<id>/nameservers**
|
user1 -[#green]-> Domain : **/domain/<id>/nameservers**
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
@ -39,8 +39,8 @@ class "registrar.Contact <Registrar>" as registrar.Contact #d6f4e9 {
|
||||||
registrar.Contact -- registrar.User
|
registrar.Contact -- registrar.User
|
||||||
|
|
||||||
|
|
||||||
class "registrar.DomainApplication <Registrar>" as registrar.DomainApplication #d6f4e9 {
|
class "registrar.DomainRequest <Registrar>" as registrar.DomainRequest #d6f4e9 {
|
||||||
domain application
|
domain request
|
||||||
--
|
--
|
||||||
+ id (BigAutoField)
|
+ id (BigAutoField)
|
||||||
+ created_at (DateTimeField)
|
+ created_at (DateTimeField)
|
||||||
|
@ -77,15 +77,15 @@ class "registrar.DomainApplication <Registrar>" as registrar.DomainApplication #
|
||||||
# other_contacts (ManyToManyField)
|
# other_contacts (ManyToManyField)
|
||||||
--
|
--
|
||||||
}
|
}
|
||||||
registrar.DomainApplication -- registrar.User
|
registrar.DomainRequest -- registrar.User
|
||||||
registrar.DomainApplication -- registrar.User
|
registrar.DomainRequest -- registrar.User
|
||||||
registrar.DomainApplication -- registrar.Contact
|
registrar.DomainRequest -- registrar.Contact
|
||||||
registrar.DomainApplication -- registrar.DraftDomain
|
registrar.DomainRequest -- registrar.DraftDomain
|
||||||
registrar.DomainApplication -- registrar.Domain
|
registrar.DomainRequest -- registrar.Domain
|
||||||
registrar.DomainApplication -- registrar.Contact
|
registrar.DomainRequest -- registrar.Contact
|
||||||
registrar.DomainApplication *--* registrar.Website
|
registrar.DomainRequest *--* registrar.Website
|
||||||
registrar.DomainApplication *--* registrar.Website
|
registrar.DomainRequest *--* registrar.Website
|
||||||
registrar.DomainApplication *--* registrar.Contact
|
registrar.DomainRequest *--* registrar.Contact
|
||||||
|
|
||||||
|
|
||||||
class "registrar.DomainInformation <Registrar>" as registrar.DomainInformation #d6f4e9 {
|
class "registrar.DomainInformation <Registrar>" as registrar.DomainInformation #d6f4e9 {
|
||||||
|
@ -95,7 +95,7 @@ class "registrar.DomainInformation <Registrar>" as registrar.DomainInformation #
|
||||||
+ created_at (DateTimeField)
|
+ created_at (DateTimeField)
|
||||||
+ updated_at (DateTimeField)
|
+ updated_at (DateTimeField)
|
||||||
~ creator (ForeignKey)
|
~ creator (ForeignKey)
|
||||||
~ domain_application (OneToOneField)
|
~ domain_request (OneToOneField)
|
||||||
+ organization_type (CharField)
|
+ organization_type (CharField)
|
||||||
+ federally_recognized_tribe (BooleanField)
|
+ federally_recognized_tribe (BooleanField)
|
||||||
+ state_recognized_tribe (BooleanField)
|
+ state_recognized_tribe (BooleanField)
|
||||||
|
@ -124,7 +124,7 @@ class "registrar.DomainInformation <Registrar>" as registrar.DomainInformation #
|
||||||
--
|
--
|
||||||
}
|
}
|
||||||
registrar.DomainInformation -- registrar.User
|
registrar.DomainInformation -- registrar.User
|
||||||
registrar.DomainInformation -- registrar.DomainApplication
|
registrar.DomainInformation -- registrar.DomainRequest
|
||||||
registrar.DomainInformation -- registrar.Contact
|
registrar.DomainInformation -- registrar.Contact
|
||||||
registrar.DomainInformation -- registrar.Domain
|
registrar.DomainInformation -- registrar.Domain
|
||||||
registrar.DomainInformation -- registrar.Contact
|
registrar.DomainInformation -- registrar.Contact
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
@ -14,7 +14,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from dateutil.relativedelta import relativedelta # type: ignore
|
from dateutil.relativedelta import relativedelta # type: ignore
|
||||||
from epplibwrapper.errors import ErrorCode, RegistryError
|
from epplibwrapper.errors import ErrorCode, RegistryError
|
||||||
from registrar.models import Contact, Domain, DomainApplication, DraftDomain, User, Website
|
from registrar.models import Contact, Domain, DomainRequest, DraftDomain, User, Website
|
||||||
from registrar.utility import csv_export
|
from registrar.utility import csv_export
|
||||||
from registrar.views.utility.mixins import OrderableFieldsMixin
|
from registrar.views.utility.mixins import OrderableFieldsMixin
|
||||||
from django.contrib.admin.views.main import ORDER_VAR
|
from django.contrib.admin.views.main import ORDER_VAR
|
||||||
|
@ -69,12 +69,12 @@ class DomainInformationInlineForm(forms.ModelForm):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationAdminForm(forms.ModelForm):
|
class DomainRequestAdminForm(forms.ModelForm):
|
||||||
"""Custom form to limit transitions to available transitions.
|
"""Custom form to limit transitions to available transitions.
|
||||||
This form utilizes the custom widget for its class's ManyToMany UIs."""
|
This form utilizes the custom widget for its class's ManyToMany UIs."""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.DomainApplication
|
model = models.DomainRequest
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
widgets = {
|
widgets = {
|
||||||
"current_websites": NoAutocompleteFilteredSelectMultiple("current_websites", False),
|
"current_websites": NoAutocompleteFilteredSelectMultiple("current_websites", False),
|
||||||
|
@ -93,14 +93,14 @@ class DomainApplicationAdminForm(forms.ModelForm):
|
||||||
available_transitions = [(current_state, application.get_status_display())]
|
available_transitions = [(current_state, application.get_status_display())]
|
||||||
|
|
||||||
transitions = get_available_FIELD_transitions(
|
transitions = get_available_FIELD_transitions(
|
||||||
application, models.DomainApplication._meta.get_field("status")
|
application, models.DomainRequest._meta.get_field("status")
|
||||||
)
|
)
|
||||||
|
|
||||||
for transition in transitions:
|
for transition in transitions:
|
||||||
available_transitions.append((transition.target, transition.target.label))
|
available_transitions.append((transition.target, transition.target.label))
|
||||||
|
|
||||||
# only set the available transitions if the user is not restricted
|
# only set the available transitions if the user is not restricted
|
||||||
# from editing the domain application; otherwise, the form will be
|
# from editing the domain request; otherwise, the form will be
|
||||||
# readonly and the status field will not have a widget
|
# readonly and the status field will not have a widget
|
||||||
if not application.creator.is_restricted():
|
if not application.creator.is_restricted():
|
||||||
self.fields["status"].widget.choices = available_transitions
|
self.fields["status"].widget.choices = available_transitions
|
||||||
|
@ -218,8 +218,8 @@ class AdminSortFields:
|
||||||
"alternative_domains": (Website, "website"),
|
"alternative_domains": (Website, "website"),
|
||||||
# == DraftDomain == #
|
# == DraftDomain == #
|
||||||
"requested_domain": (DraftDomain, "name"),
|
"requested_domain": (DraftDomain, "name"),
|
||||||
# == DomainApplication == #
|
# == DomainRequest == #
|
||||||
"domain_application": (DomainApplication, "requested_domain__name"),
|
"domain_request": (DomainRequest, "requested_domain__name"),
|
||||||
# == Domain == #
|
# == Domain == #
|
||||||
"domain": (Domain, "name"),
|
"domain": (Domain, "name"),
|
||||||
"approved_domain": (Domain, "name"),
|
"approved_domain": (Domain, "name"),
|
||||||
|
@ -466,7 +466,7 @@ class MyUserAdmin(BaseUserAdmin):
|
||||||
def get_search_results(self, request, queryset, search_term):
|
def get_search_results(self, request, queryset, search_term):
|
||||||
"""
|
"""
|
||||||
Override for get_search_results. This affects any upstream model using autocomplete_fields,
|
Override for get_search_results. This affects any upstream model using autocomplete_fields,
|
||||||
such as DomainApplication. This is because autocomplete_fields uses an API call to fetch data,
|
such as DomainRequest. This is because autocomplete_fields uses an API call to fetch data,
|
||||||
and this fetch comes from this method.
|
and this fetch comes from this method.
|
||||||
"""
|
"""
|
||||||
# Custom filtering logic
|
# Custom filtering logic
|
||||||
|
@ -480,13 +480,13 @@ class MyUserAdmin(BaseUserAdmin):
|
||||||
request_get = request.GET
|
request_get = request.GET
|
||||||
|
|
||||||
# The request defines model name and field name.
|
# The request defines model name and field name.
|
||||||
# For instance, model_name could be "DomainApplication"
|
# For instance, model_name could be "DomainRequest"
|
||||||
# and field_name could be "investigator".
|
# and field_name could be "investigator".
|
||||||
model_name = request_get.get("model_name", None)
|
model_name = request_get.get("model_name", None)
|
||||||
field_name = request_get.get("field_name", None)
|
field_name = request_get.get("field_name", None)
|
||||||
|
|
||||||
# Make sure we're only modifying requests from these models.
|
# Make sure we're only modifying requests from these models.
|
||||||
models_to_target = {"domainapplication"}
|
models_to_target = {"DomainRequest"}
|
||||||
if model_name in models_to_target:
|
if model_name in models_to_target:
|
||||||
# Define rules per field
|
# Define rules per field
|
||||||
match field_name:
|
match field_name:
|
||||||
|
@ -777,7 +777,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
||||||
search_help_text = "Search by domain."
|
search_help_text = "Search by domain."
|
||||||
|
|
||||||
fieldsets = [
|
fieldsets = [
|
||||||
(None, {"fields": ["creator", "domain_application", "notes"]}),
|
(None, {"fields": ["creator", "domain_request", "notes"]}),
|
||||||
(
|
(
|
||||||
"Type of organization",
|
"Type of organization",
|
||||||
{
|
{
|
||||||
|
@ -828,7 +828,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
||||||
"type_of_work",
|
"type_of_work",
|
||||||
"more_organization_information",
|
"more_organization_information",
|
||||||
"domain",
|
"domain",
|
||||||
"domain_application",
|
"domain_request",
|
||||||
"submitter",
|
"submitter",
|
||||||
"no_other_contacts_rationale",
|
"no_other_contacts_rationale",
|
||||||
"anything_else",
|
"anything_else",
|
||||||
|
@ -841,7 +841,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
||||||
|
|
||||||
autocomplete_fields = [
|
autocomplete_fields = [
|
||||||
"creator",
|
"creator",
|
||||||
"domain_application",
|
"domain_request",
|
||||||
"authorizing_official",
|
"authorizing_official",
|
||||||
"domain",
|
"domain",
|
||||||
"submitter",
|
"submitter",
|
||||||
|
@ -866,10 +866,10 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
||||||
return readonly_fields # Read-only fields for analysts
|
return readonly_fields # Read-only fields for analysts
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationAdmin(ListHeaderAdmin):
|
class DomainRequestAdmin(ListHeaderAdmin):
|
||||||
"""Custom domain applications admin class."""
|
"""Custom domain applications admin class."""
|
||||||
|
|
||||||
form = DomainApplicationAdminForm
|
form = DomainRequestAdminForm
|
||||||
|
|
||||||
class InvestigatorFilter(admin.SimpleListFilter):
|
class InvestigatorFilter(admin.SimpleListFilter):
|
||||||
"""Custom investigator filter that only displays users with the manager role"""
|
"""Custom investigator filter that only displays users with the manager role"""
|
||||||
|
@ -884,7 +884,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
||||||
"""
|
"""
|
||||||
# Select all investigators that are staff, then order by name and email
|
# Select all investigators that are staff, then order by name and email
|
||||||
privileged_users = (
|
privileged_users = (
|
||||||
DomainApplication.objects.select_related("investigator")
|
DomainRequest.objects.select_related("investigator")
|
||||||
.filter(investigator__is_staff=True)
|
.filter(investigator__is_staff=True)
|
||||||
.order_by("investigator__first_name", "investigator__last_name", "investigator__email")
|
.order_by("investigator__first_name", "investigator__last_name", "investigator__email")
|
||||||
)
|
)
|
||||||
|
@ -1057,12 +1057,12 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
||||||
if obj and obj.creator.status != models.User.RESTRICTED:
|
if obj and obj.creator.status != models.User.RESTRICTED:
|
||||||
if change: # Check if the application is being edited
|
if change: # Check if the application is being edited
|
||||||
# Get the original application from the database
|
# Get the original application from the database
|
||||||
original_obj = models.DomainApplication.objects.get(pk=obj.pk)
|
original_obj = models.DomainRequest.objects.get(pk=obj.pk)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
obj
|
obj
|
||||||
and original_obj.status == models.DomainApplication.ApplicationStatus.APPROVED
|
and original_obj.status == models.DomainRequest.ApplicationStatus.APPROVED
|
||||||
and obj.status != models.DomainApplication.ApplicationStatus.APPROVED
|
and obj.status != models.DomainRequest.ApplicationStatus.APPROVED
|
||||||
and not obj.domain_is_not_active()
|
and not obj.domain_is_not_active()
|
||||||
):
|
):
|
||||||
# If an admin tried to set an approved application to
|
# If an admin tried to set an approved application to
|
||||||
|
@ -1082,7 +1082,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
||||||
|
|
||||||
elif (
|
elif (
|
||||||
obj
|
obj
|
||||||
and obj.status == models.DomainApplication.ApplicationStatus.REJECTED
|
and obj.status == models.DomainRequest.ApplicationStatus.REJECTED
|
||||||
and not obj.rejection_reason
|
and not obj.rejection_reason
|
||||||
):
|
):
|
||||||
# This condition should never be triggered.
|
# This condition should never be triggered.
|
||||||
|
@ -1100,14 +1100,14 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
||||||
else:
|
else:
|
||||||
if obj.status != original_obj.status:
|
if obj.status != original_obj.status:
|
||||||
status_method_mapping = {
|
status_method_mapping = {
|
||||||
models.DomainApplication.ApplicationStatus.STARTED: None,
|
models.DomainRequest.ApplicationStatus.STARTED: None,
|
||||||
models.DomainApplication.ApplicationStatus.SUBMITTED: obj.submit,
|
models.DomainRequest.ApplicationStatus.SUBMITTED: obj.submit,
|
||||||
models.DomainApplication.ApplicationStatus.IN_REVIEW: obj.in_review,
|
models.DomainRequest.ApplicationStatus.IN_REVIEW: obj.in_review,
|
||||||
models.DomainApplication.ApplicationStatus.ACTION_NEEDED: obj.action_needed,
|
models.DomainRequest.ApplicationStatus.ACTION_NEEDED: obj.action_needed,
|
||||||
models.DomainApplication.ApplicationStatus.APPROVED: obj.approve,
|
models.DomainRequest.ApplicationStatus.APPROVED: obj.approve,
|
||||||
models.DomainApplication.ApplicationStatus.WITHDRAWN: obj.withdraw,
|
models.DomainRequest.ApplicationStatus.WITHDRAWN: obj.withdraw,
|
||||||
models.DomainApplication.ApplicationStatus.REJECTED: obj.reject,
|
models.DomainRequest.ApplicationStatus.REJECTED: obj.reject,
|
||||||
models.DomainApplication.ApplicationStatus.INELIGIBLE: (obj.reject_with_prejudice),
|
models.DomainRequest.ApplicationStatus.INELIGIBLE: (obj.reject_with_prejudice),
|
||||||
}
|
}
|
||||||
selected_method = status_method_mapping.get(obj.status)
|
selected_method = status_method_mapping.get(obj.status)
|
||||||
if selected_method is None:
|
if selected_method is None:
|
||||||
|
@ -1202,7 +1202,7 @@ class DomainInformationInline(admin.StackedInline):
|
||||||
|
|
||||||
autocomplete_fields = [
|
autocomplete_fields = [
|
||||||
"creator",
|
"creator",
|
||||||
"domain_application",
|
"domain_request",
|
||||||
"authorizing_official",
|
"authorizing_official",
|
||||||
"domain",
|
"domain",
|
||||||
"submitter",
|
"submitter",
|
||||||
|
@ -1712,6 +1712,6 @@ admin.site.register(models.DraftDomain, DraftDomainAdmin)
|
||||||
admin.site.register(models.Host, MyHostAdmin)
|
admin.site.register(models.Host, MyHostAdmin)
|
||||||
admin.site.register(models.Website, WebsiteAdmin)
|
admin.site.register(models.Website, WebsiteAdmin)
|
||||||
admin.site.register(models.PublicContact, AuditedAdmin)
|
admin.site.register(models.PublicContact, AuditedAdmin)
|
||||||
admin.site.register(models.DomainApplication, DomainApplicationAdmin)
|
admin.site.register(models.DomainRequest, DomainRequestAdmin)
|
||||||
admin.site.register(models.TransitionDomain, TransitionDomainAdmin)
|
admin.site.register(models.TransitionDomain, TransitionDomainAdmin)
|
||||||
admin.site.register(models.VerifiedByStaff, VerifiedByStaffAdmin)
|
admin.site.register(models.VerifiedByStaff, VerifiedByStaffAdmin)
|
||||||
|
|
|
@ -139,7 +139,7 @@ urlpatterns = [
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"application/<int:pk>/delete",
|
"application/<int:pk>/delete",
|
||||||
views.DomainApplicationDeleteView.as_view(http_method_names=["post"]),
|
views.DomainRequestDeleteView.as_view(http_method_names=["post"]),
|
||||||
name="application-delete",
|
name="application-delete",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
|
|
|
@ -4,7 +4,7 @@ from faker import Faker
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
User,
|
User,
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
DraftDomain,
|
DraftDomain,
|
||||||
Contact,
|
Contact,
|
||||||
Website,
|
Website,
|
||||||
|
@ -14,7 +14,7 @@ fake = Faker()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationFixture:
|
class DomainRequestFixture:
|
||||||
"""
|
"""
|
||||||
Load domain applications into the database.
|
Load domain applications into the database.
|
||||||
|
|
||||||
|
@ -49,27 +49,27 @@ class DomainApplicationFixture:
|
||||||
# },
|
# },
|
||||||
DA = [
|
DA = [
|
||||||
{
|
{
|
||||||
"status": DomainApplication.ApplicationStatus.STARTED,
|
"status": DomainRequest.ApplicationStatus.STARTED,
|
||||||
"organization_name": "Example - Finished but not submitted",
|
"organization_name": "Example - Finished but not submitted",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"status": DomainApplication.ApplicationStatus.SUBMITTED,
|
"status": DomainRequest.ApplicationStatus.SUBMITTED,
|
||||||
"organization_name": "Example - Submitted but pending investigation",
|
"organization_name": "Example - Submitted but pending investigation",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"status": DomainApplication.ApplicationStatus.IN_REVIEW,
|
"status": DomainRequest.ApplicationStatus.IN_REVIEW,
|
||||||
"organization_name": "Example - In investigation",
|
"organization_name": "Example - In investigation",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"status": DomainApplication.ApplicationStatus.IN_REVIEW,
|
"status": DomainRequest.ApplicationStatus.IN_REVIEW,
|
||||||
"organization_name": "Example - Approved",
|
"organization_name": "Example - Approved",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"status": DomainApplication.ApplicationStatus.WITHDRAWN,
|
"status": DomainRequest.ApplicationStatus.WITHDRAWN,
|
||||||
"organization_name": "Example - Withdrawn",
|
"organization_name": "Example - Withdrawn",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"status": DomainApplication.ApplicationStatus.ACTION_NEEDED,
|
"status": DomainRequest.ApplicationStatus.ACTION_NEEDED,
|
||||||
"organization_name": "Example - Action needed",
|
"organization_name": "Example - Action needed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ class DomainApplicationFixture:
|
||||||
return f"{fake.slug()}.gov"
|
return f"{fake.slug()}.gov"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _set_non_foreign_key_fields(cls, da: DomainApplication, app: dict):
|
def _set_non_foreign_key_fields(cls, da: DomainRequest, app: dict):
|
||||||
"""Helper method used by `load`."""
|
"""Helper method used by `load`."""
|
||||||
da.status = app["status"] if "status" in app else "started"
|
da.status = app["status"] if "status" in app else "started"
|
||||||
da.organization_type = app["organization_type"] if "organization_type" in app else "federal"
|
da.organization_type = app["organization_type"] if "organization_type" in app else "federal"
|
||||||
|
@ -102,7 +102,7 @@ class DomainApplicationFixture:
|
||||||
app["federal_agency"]
|
app["federal_agency"]
|
||||||
if "federal_agency" in app
|
if "federal_agency" in app
|
||||||
# Random choice of agency for selects, used as placeholders for testing.
|
# Random choice of agency for selects, used as placeholders for testing.
|
||||||
else random.choice(DomainApplication.AGENCIES) # nosec
|
else random.choice(DomainRequest.AGENCIES) # nosec
|
||||||
)
|
)
|
||||||
da.submission_date = fake.date()
|
da.submission_date = fake.date()
|
||||||
da.federal_type = (
|
da.federal_type = (
|
||||||
|
@ -121,7 +121,7 @@ class DomainApplicationFixture:
|
||||||
da.is_policy_acknowledged = app["is_policy_acknowledged"] if "is_policy_acknowledged" in app else True
|
da.is_policy_acknowledged = app["is_policy_acknowledged"] if "is_policy_acknowledged" in app else True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _set_foreign_key_fields(cls, da: DomainApplication, app: dict, user: User):
|
def _set_foreign_key_fields(cls, da: DomainRequest, app: dict, user: User):
|
||||||
"""Helper method used by `load`."""
|
"""Helper method used by `load`."""
|
||||||
if not da.investigator:
|
if not da.investigator:
|
||||||
da.investigator = User.objects.get(username=user.username) if "investigator" in app else None
|
da.investigator = User.objects.get(username=user.username) if "investigator" in app else None
|
||||||
|
@ -145,7 +145,7 @@ class DomainApplicationFixture:
|
||||||
da.requested_domain = DraftDomain.objects.create(name=cls.fake_dot_gov())
|
da.requested_domain = DraftDomain.objects.create(name=cls.fake_dot_gov())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _set_many_to_many_relations(cls, da: DomainApplication, app: dict):
|
def _set_many_to_many_relations(cls, da: DomainRequest, app: dict):
|
||||||
"""Helper method used by `load`."""
|
"""Helper method used by `load`."""
|
||||||
if "other_contacts" in app:
|
if "other_contacts" in app:
|
||||||
for contact in app["other_contacts"]:
|
for contact in app["other_contacts"]:
|
||||||
|
@ -188,7 +188,7 @@ class DomainApplicationFixture:
|
||||||
logger.debug("Loading domain applications for %s" % user)
|
logger.debug("Loading domain applications for %s" % user)
|
||||||
for app in cls.DA:
|
for app in cls.DA:
|
||||||
try:
|
try:
|
||||||
da, _ = DomainApplication.objects.get_or_create(
|
da, _ = DomainRequest.objects.get_or_create(
|
||||||
creator=user,
|
creator=user,
|
||||||
organization_name=app["organization_name"],
|
organization_name=app["organization_name"],
|
||||||
)
|
)
|
||||||
|
@ -200,7 +200,7 @@ class DomainApplicationFixture:
|
||||||
logger.warning(e)
|
logger.warning(e)
|
||||||
|
|
||||||
|
|
||||||
class DomainFixture(DomainApplicationFixture):
|
class DomainFixture(DomainRequestFixture):
|
||||||
"""Create one domain and permissions on it for each user."""
|
"""Create one domain and permissions on it for each user."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -213,8 +213,8 @@ class DomainFixture(DomainApplicationFixture):
|
||||||
|
|
||||||
for user in users:
|
for user in users:
|
||||||
# approve one of each users in review status domains
|
# approve one of each users in review status domains
|
||||||
application = DomainApplication.objects.filter(
|
application = DomainRequest.objects.filter(
|
||||||
creator=user, status=DomainApplication.ApplicationStatus.IN_REVIEW
|
creator=user, status=DomainRequest.ApplicationStatus.IN_REVIEW
|
||||||
).last()
|
).last()
|
||||||
logger.debug(f"Approving {application} for {user}")
|
logger.debug(f"Approving {application} for {user}")
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.core.validators import RegexValidator, MaxLengthValidator
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.db.models.fields.related import ForeignObjectRel
|
from django.db.models.fields.related import ForeignObjectRel
|
||||||
|
|
||||||
from registrar.models import Contact, DomainApplication, DraftDomain, Domain
|
from registrar.models import Contact, DomainRequest, DraftDomain, Domain
|
||||||
from registrar.templatetags.url_helpers import public_site_url
|
from registrar.templatetags.url_helpers import public_site_url
|
||||||
from registrar.utility.enums import ValidationReturnType
|
from registrar.utility.enums import ValidationReturnType
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class RegistrarForm(forms.Form):
|
||||||
"""
|
"""
|
||||||
A common set of methods and configuration.
|
A common set of methods and configuration.
|
||||||
|
|
||||||
The registrar's domain application is several pages of "steps".
|
The registrar's domain request is several pages of "steps".
|
||||||
Each step is an HTML form containing one or more Django "forms".
|
Each step is an HTML form containing one or more Django "forms".
|
||||||
|
|
||||||
Subclass this class to create new forms.
|
Subclass this class to create new forms.
|
||||||
|
@ -33,7 +33,7 @@ class RegistrarForm(forms.Form):
|
||||||
self.application = kwargs.pop("application", None)
|
self.application = kwargs.pop("application", None)
|
||||||
super(RegistrarForm, self).__init__(*args, **kwargs)
|
super(RegistrarForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def to_database(self, obj: DomainApplication | Contact):
|
def to_database(self, obj: DomainRequest | Contact):
|
||||||
"""
|
"""
|
||||||
Adds this form's cleaned data to `obj` and saves `obj`.
|
Adds this form's cleaned data to `obj` and saves `obj`.
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class RegistrarForm(forms.Form):
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_database(cls, obj: DomainApplication | Contact | None):
|
def from_database(cls, obj: DomainRequest | Contact | None):
|
||||||
"""Returns a dict of form field values gotten from `obj`."""
|
"""Returns a dict of form field values gotten from `obj`."""
|
||||||
if obj is None:
|
if obj is None:
|
||||||
return {}
|
return {}
|
||||||
|
@ -85,7 +85,7 @@ class RegistrarFormSet(forms.BaseFormSet):
|
||||||
"""Code to run before an item in the formset is created in the database."""
|
"""Code to run before an item in the formset is created in the database."""
|
||||||
return cleaned
|
return cleaned
|
||||||
|
|
||||||
def to_database(self, obj: DomainApplication):
|
def to_database(self, obj: DomainRequest):
|
||||||
"""
|
"""
|
||||||
Adds this form's cleaned data to `obj` and saves `obj`.
|
Adds this form's cleaned data to `obj` and saves `obj`.
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class RegistrarFormSet(forms.BaseFormSet):
|
||||||
|
|
||||||
def _to_database(
|
def _to_database(
|
||||||
self,
|
self,
|
||||||
obj: DomainApplication,
|
obj: DomainRequest,
|
||||||
join: str,
|
join: str,
|
||||||
should_delete: Callable,
|
should_delete: Callable,
|
||||||
pre_update: Callable,
|
pre_update: Callable,
|
||||||
|
@ -163,7 +163,7 @@ class RegistrarFormSet(forms.BaseFormSet):
|
||||||
return query.values()
|
return query.values()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_database(cls, obj: DomainApplication, join: str, on_fetch: Callable):
|
def from_database(cls, obj: DomainRequest, join: str, on_fetch: Callable):
|
||||||
"""Returns a dict of form field values gotten from `obj`."""
|
"""Returns a dict of form field values gotten from `obj`."""
|
||||||
return on_fetch(getattr(obj, join).order_by("created_at")) # order matters
|
return on_fetch(getattr(obj, join).order_by("created_at")) # order matters
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ class RegistrarFormSet(forms.BaseFormSet):
|
||||||
class OrganizationTypeForm(RegistrarForm):
|
class OrganizationTypeForm(RegistrarForm):
|
||||||
organization_type = forms.ChoiceField(
|
organization_type = forms.ChoiceField(
|
||||||
# use the long names in the application form
|
# use the long names in the application form
|
||||||
choices=DomainApplication.OrganizationChoicesVerbose.choices,
|
choices=DomainRequest.OrganizationChoicesVerbose.choices,
|
||||||
widget=forms.RadioSelect,
|
widget=forms.RadioSelect,
|
||||||
error_messages={"required": "Select the type of organization you represent."},
|
error_messages={"required": "Select the type of organization you represent."},
|
||||||
)
|
)
|
||||||
|
@ -215,7 +215,7 @@ class TribalGovernmentForm(RegistrarForm):
|
||||||
|
|
||||||
class OrganizationFederalForm(RegistrarForm):
|
class OrganizationFederalForm(RegistrarForm):
|
||||||
federal_type = forms.ChoiceField(
|
federal_type = forms.ChoiceField(
|
||||||
choices=DomainApplication.BranchChoices.choices,
|
choices=DomainRequest.BranchChoices.choices,
|
||||||
widget=forms.RadioSelect,
|
widget=forms.RadioSelect,
|
||||||
error_messages={"required": ("Select the part of the federal government your organization is in.")},
|
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
|
# it is a federal agency. Use clean to check programatically
|
||||||
# if it has been filled in when required.
|
# if it has been filled in when required.
|
||||||
required=False,
|
required=False,
|
||||||
choices=[("", "--Select--")] + DomainApplication.AGENCY_CHOICES,
|
choices=[("", "--Select--")] + DomainRequest.AGENCY_CHOICES,
|
||||||
)
|
)
|
||||||
organization_name = forms.CharField(
|
organization_name = forms.CharField(
|
||||||
label="Organization name",
|
label="Organization name",
|
||||||
|
@ -271,7 +271,7 @@ class OrganizationContactForm(RegistrarForm):
|
||||||
)
|
)
|
||||||
state_territory = forms.ChoiceField(
|
state_territory = forms.ChoiceField(
|
||||||
label="State, territory, or military post",
|
label="State, territory, or military post",
|
||||||
choices=[("", "--Select--")] + DomainApplication.StateTerritoryChoices.choices,
|
choices=[("", "--Select--")] + DomainRequest.StateTerritoryChoices.choices,
|
||||||
error_messages={
|
error_messages={
|
||||||
"required": ("Select the state, territory, or military post where your organization is located.")
|
"required": ("Select the state, territory, or military post where your organization is located.")
|
||||||
},
|
},
|
||||||
|
@ -390,7 +390,7 @@ class BaseCurrentSitesFormSet(RegistrarFormSet):
|
||||||
website = cleaned.get("website", "")
|
website = cleaned.get("website", "")
|
||||||
return website.strip() == ""
|
return website.strip() == ""
|
||||||
|
|
||||||
def to_database(self, obj: DomainApplication):
|
def to_database(self, obj: DomainRequest):
|
||||||
# If we want to test against multiple joins for a website object, replace the empty array
|
# 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
|
# 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)
|
self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create)
|
||||||
|
@ -444,7 +444,7 @@ class BaseAlternativeDomainFormSet(RegistrarFormSet):
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def to_database(self, obj: DomainApplication):
|
def to_database(self, obj: DomainRequest):
|
||||||
# If we want to test against multiple joins for a website object, replace the empty array and
|
# 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
|
# 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)
|
self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create)
|
||||||
|
@ -722,7 +722,7 @@ class BaseOtherContactsFormSet(RegistrarFormSet):
|
||||||
cleaned.pop("DELETE")
|
cleaned.pop("DELETE")
|
||||||
return cleaned
|
return cleaned
|
||||||
|
|
||||||
def to_database(self, obj: DomainApplication):
|
def to_database(self, obj: DomainRequest):
|
||||||
self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create)
|
self._to_database(obj, self.JOIN, self.should_delete, self.pre_update, self.pre_create)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -5,7 +5,7 @@ from auditlog.context import disable_auditlog # type: ignore
|
||||||
|
|
||||||
|
|
||||||
from registrar.fixtures_users import UserFixture
|
from registrar.fixtures_users import UserFixture
|
||||||
from registrar.fixtures_applications import DomainApplicationFixture, DomainFixture
|
from registrar.fixtures_applications import DomainRequestFixture, DomainFixture
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -16,6 +16,6 @@ class Command(BaseCommand):
|
||||||
# https://github.com/jazzband/django-auditlog/issues/17
|
# https://github.com/jazzband/django-auditlog/issues/17
|
||||||
with disable_auditlog():
|
with disable_auditlog():
|
||||||
UserFixture.load()
|
UserFixture.load()
|
||||||
DomainApplicationFixture.load()
|
DomainRequestFixture.load()
|
||||||
DomainFixture.load()
|
DomainFixture.load()
|
||||||
logger.info("All fixtures loaded.")
|
logger.info("All fixtures loaded.")
|
||||||
|
|
|
@ -15,7 +15,7 @@ from registrar.management.commands.utility.terminal_helper import (
|
||||||
TerminalHelper,
|
TerminalHelper,
|
||||||
)
|
)
|
||||||
from registrar.models.contact import Contact
|
from registrar.models.contact import Contact
|
||||||
from registrar.models.domain_application import DomainApplication
|
from registrar.models.domain_request import DomainRequest
|
||||||
from registrar.models.domain_information import DomainInformation
|
from registrar.models.domain_information import DomainInformation
|
||||||
from registrar.models.user import User
|
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")
|
raise Exception(f"Domain {existing_domain} wants to be added" "but doesn't exist in the DB")
|
||||||
invitation.save()
|
invitation.save()
|
||||||
|
|
||||||
valid_org_choices = [(name, value) for name, value in DomainApplication.OrganizationChoices.choices]
|
valid_org_choices = [(name, value) for name, value in DomainRequest.OrganizationChoices.choices]
|
||||||
valid_fed_choices = [value for name, value in DomainApplication.BranchChoices.choices]
|
valid_fed_choices = [value for name, value in DomainRequest.BranchChoices.choices]
|
||||||
valid_agency_choices = DomainApplication.AGENCIES
|
valid_agency_choices = DomainRequest.AGENCIES
|
||||||
# ======================================================
|
# ======================================================
|
||||||
# ================= DOMAIN INFORMATION =================
|
# ================= DOMAIN INFORMATION =================
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
|
@ -168,7 +168,7 @@ class Migration(migrations.Migration):
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="DomainApplication",
|
name="DomainRequest",
|
||||||
fields=[
|
fields=[
|
||||||
(
|
(
|
||||||
"id",
|
"id",
|
||||||
|
|
|
@ -142,14 +142,14 @@ class Migration(migrations.Migration):
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="requested_domain",
|
name="requested_domain",
|
||||||
field=models.OneToOneField(
|
field=models.OneToOneField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="The requested domain",
|
help_text="The requested domain",
|
||||||
null=True,
|
null=True,
|
||||||
on_delete=django.db.models.deletion.PROTECT,
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
related_name="domain_application",
|
related_name="domain_request",
|
||||||
to="registrar.domain",
|
to="registrar.domain",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -10,48 +10,48 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
old_name="is_election_office",
|
old_name="is_election_office",
|
||||||
new_name="is_election_board",
|
new_name="is_election_board",
|
||||||
),
|
),
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
old_name="acknowledged_policy",
|
old_name="acknowledged_policy",
|
||||||
new_name="is_policy_acknowledged",
|
new_name="is_policy_acknowledged",
|
||||||
),
|
),
|
||||||
migrations.RenameField(
|
migrations.RenameField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
old_name="zip_code",
|
old_name="zip_code",
|
||||||
new_name="zipcode",
|
new_name="zipcode",
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_branch",
|
name="federal_branch",
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="street_address",
|
name="street_address",
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="unit_number",
|
name="unit_number",
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="unit_type",
|
name="unit_type",
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line1",
|
name="address_line1",
|
||||||
field=models.TextField(blank=True, help_text="Address line 1", null=True),
|
field=models.TextField(blank=True, help_text="Address line 1", null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line2",
|
name="address_line2",
|
||||||
field=models.CharField(blank=True, help_text="Address line 2", max_length=15, null=True),
|
field=models.CharField(blank=True, help_text="Address line 2", max_length=15, null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_type",
|
name="federal_type",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -66,7 +66,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="organization_type",
|
name="organization_type",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -7,13 +7,13 @@ class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
(
|
(
|
||||||
"registrar",
|
"registrar",
|
||||||
"0003_rename_is_election_office_domainapplication_is_election_board_and_more",
|
"0003_rename_is_election_office_DomainRequest_is_election_board_and_more",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_agency",
|
name="federal_agency",
|
||||||
field=models.TextField(help_text="Top level federal agency", null=True),
|
field=models.TextField(help_text="Top level federal agency", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,22 +5,22 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0004_domainapplication_federal_agency"),
|
("registrar", "0004_DomainRequest_federal_agency"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="city",
|
name="city",
|
||||||
field=models.TextField(blank=True, help_text="City", null=True),
|
field=models.TextField(blank=True, help_text="City", null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="urbanization",
|
name="urbanization",
|
||||||
field=models.TextField(blank=True, help_text="Urbanization", null=True),
|
field=models.TextField(blank=True, help_text="Urbanization", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_agency",
|
name="federal_agency",
|
||||||
field=models.TextField(blank=True, help_text="Top level federal agency", null=True),
|
field=models.TextField(blank=True, help_text="Top level federal agency", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -6,7 +6,7 @@ import phonenumber_field.modelfields # type: ignore
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0005_domainapplication_city_and_more"),
|
("registrar", "0005_DomainRequest_city_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="more_organization_information",
|
name="more_organization_information",
|
||||||
field=models.TextField(
|
field=models.TextField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -19,27 +19,27 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="type_of_work",
|
name="type_of_work",
|
||||||
field=models.TextField(blank=True, help_text="Type of work of the organization", null=True),
|
field=models.TextField(blank=True, help_text="Type of work of the organization", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line1",
|
name="address_line1",
|
||||||
field=models.TextField(blank=True, help_text="Street address", null=True),
|
field=models.TextField(blank=True, help_text="Street address", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line2",
|
name="address_line2",
|
||||||
field=models.CharField(blank=True, help_text="Street address line 2", max_length=15, null=True),
|
field=models.CharField(blank=True, help_text="Street address line 2", max_length=15, null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_agency",
|
name="federal_agency",
|
||||||
field=models.TextField(blank=True, help_text="Federal agency", null=True),
|
field=models.TextField(blank=True, help_text="Federal agency", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_type",
|
name="federal_type",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -54,7 +54,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="organization_type",
|
name="organization_type",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -89,12 +89,12 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="purpose",
|
name="purpose",
|
||||||
field=models.TextField(blank=True, help_text="Purpose of your domain", null=True),
|
field=models.TextField(blank=True, help_text="Purpose of your domain", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="state_territory",
|
name="state_territory",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -104,12 +104,12 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="urbanization",
|
name="urbanization",
|
||||||
field=models.TextField(blank=True, help_text="Urbanization (Puerto Rico only)", null=True),
|
field=models.TextField(blank=True, help_text="Urbanization (Puerto Rico only)", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="zipcode",
|
name="zipcode",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import django.utils.timezone
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0007_domainapplication_more_organization_information_and_more"),
|
("registrar", "0007_DomainRequest_more_organization_information_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,17 +10,17 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federally_recognized_tribe",
|
name="federally_recognized_tribe",
|
||||||
field=models.BooleanField(help_text="Is the tribe federally recognized", null=True),
|
field=models.BooleanField(help_text="Is the tribe federally recognized", null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="state_recognized_tribe",
|
name="state_recognized_tribe",
|
||||||
field=models.BooleanField(help_text="Is the tribe recognized by a state", null=True),
|
field=models.BooleanField(help_text="Is the tribe recognized by a state", null=True),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="tribe_name",
|
name="tribe_name",
|
||||||
field=models.TextField(blank=True, help_text="Name of tribe", null=True),
|
field=models.TextField(blank=True, help_text="Name of tribe", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,12 +5,12 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0009_domainapplication_federally_recognized_tribe_and_more"),
|
("registrar", "0009_DomainRequest_federally_recognized_tribe_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="no_other_contacts_rationale",
|
name="no_other_contacts_rationale",
|
||||||
field=models.TextField(
|
field=models.TextField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -5,12 +5,12 @@ from django.db import migrations
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0010_domainapplication_no_other_contacts_rationale"),
|
("registrar", "0010_DomainRequest_no_other_contacts_rationale"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="security_email",
|
name="security_email",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -7,7 +7,7 @@ import django.db.models.deletion
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0011_remove_domainapplication_security_email"),
|
("registrar", "0011_remove_DomainRequest_security_email"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="status",
|
name="status",
|
||||||
field=django_fsm.FSMField(
|
field=django_fsm.FSMField(
|
||||||
choices=[
|
choices=[
|
||||||
|
|
|
@ -7,7 +7,7 @@ import django.db.models.deletion
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0017_alter_domainapplication_status_and_more"),
|
("registrar", "0017_alter_DomainRequest_status_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -229,14 +229,14 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"domain_application",
|
"domain_request",
|
||||||
models.OneToOneField(
|
models.OneToOneField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="Associated domain application",
|
help_text="Associated domain request",
|
||||||
null=True,
|
null=True,
|
||||||
on_delete=django.db.models.deletion.PROTECT,
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
related_name="domainapplication_info",
|
related_name="DomainRequest_info",
|
||||||
to="registrar.domainapplication",
|
to="registrar.DomainRequest",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="organization_type",
|
name="organization_type",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0019_alter_domainapplication_organization_type"),
|
("registrar", "0019_alter_DomainRequest_organization_type"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -40,26 +40,26 @@ class Migration(migrations.Migration):
|
||||||
bases=(models.Model, registrar.models.utility.domain_helper.DomainHelper), # type: ignore
|
bases=(models.Model, registrar.models.utility.domain_helper.DomainHelper), # type: ignore
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="approved_domain",
|
name="approved_domain",
|
||||||
field=models.OneToOneField(
|
field=models.OneToOneField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="The approved domain",
|
help_text="The approved domain",
|
||||||
null=True,
|
null=True,
|
||||||
on_delete=django.db.models.deletion.PROTECT,
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
related_name="domain_application",
|
related_name="domain_request",
|
||||||
to="registrar.domain",
|
to="registrar.domain",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="requested_domain",
|
name="requested_domain",
|
||||||
field=models.OneToOneField(
|
field=models.OneToOneField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="The requested domain",
|
help_text="The requested domain",
|
||||||
null=True,
|
null=True,
|
||||||
on_delete=django.db.models.deletion.PROTECT,
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
related_name="domain_application",
|
related_name="domain_request",
|
||||||
to="registrar.draftdomain",
|
to="registrar.draftdomain",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0022_draftdomain_domainapplication_approved_domain_and_more"),
|
("registrar", "0022_draftdomain_DomainRequest_approved_domain_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line2",
|
name="address_line2",
|
||||||
field=models.TextField(blank=True, help_text="Street address line 2", null=True),
|
field=models.TextField(blank=True, help_text="Street address line 2", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0026_alter_domainapplication_address_line2_and_more"),
|
("registrar", "0026_alter_DomainRequest_address_line2_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="status",
|
name="status",
|
||||||
field=django_fsm.FSMField(
|
field=django_fsm.FSMField(
|
||||||
choices=[
|
choices=[
|
||||||
|
|
|
@ -6,7 +6,7 @@ import django_fsm
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0028_alter_domainapplication_status"),
|
("registrar", "0028_alter_DomainRequest_status"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -22,7 +22,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="status",
|
name="status",
|
||||||
field=django_fsm.FSMField(
|
field=django_fsm.FSMField(
|
||||||
choices=[
|
choices=[
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0029_user_status_alter_domainapplication_status"),
|
("registrar", "0029_user_status_alter_DomainRequest_status"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -77,11 +77,11 @@ class Migration(migrations.Migration):
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="more_organization_information",
|
name="more_organization_information",
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="type_of_work",
|
name="type_of_work",
|
||||||
),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
|
@ -93,7 +93,7 @@ class Migration(migrations.Migration):
|
||||||
name="type_of_work",
|
name="type_of_work",
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="about_your_organization",
|
name="about_your_organization",
|
||||||
field=models.TextField(blank=True, help_text="Information about your organization", null=True),
|
field=models.TextField(blank=True, help_text="Information about your organization", null=True),
|
||||||
),
|
),
|
||||||
|
@ -103,14 +103,14 @@ class Migration(migrations.Migration):
|
||||||
field=models.TextField(blank=True, help_text="Information about your organization", null=True),
|
field=models.TextField(blank=True, help_text="Information about your organization", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="approved_domain",
|
name="approved_domain",
|
||||||
field=models.OneToOneField(
|
field=models.OneToOneField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="The approved domain",
|
help_text="The approved domain",
|
||||||
null=True,
|
null=True,
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
related_name="domain_application",
|
related_name="domain_request",
|
||||||
to="registrar.domain",
|
to="registrar.domain",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="organization_type",
|
name="organization_type",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -25,7 +25,7 @@ def create_groups(apps, schema_editor) -> Any:
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0041_alter_domainapplication_organization_type_and_more"),
|
("registrar", "0041_alter_DomainRequest_organization_type_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,14 +10,14 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="current_websites",
|
name="current_websites",
|
||||||
field=models.ManyToManyField(
|
field=models.ManyToManyField(
|
||||||
blank=True, related_name="current+", to="registrar.website", verbose_name="websites"
|
blank=True, related_name="current+", to="registrar.website", verbose_name="websites"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="other_contacts",
|
name="other_contacts",
|
||||||
field=models.ManyToManyField(
|
field=models.ManyToManyField(
|
||||||
blank=True, related_name="contact_applications", to="registrar.contact", verbose_name="contacts"
|
blank=True, related_name="contact_applications", to="registrar.contact", verbose_name="contacts"
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0049_alter_domainapplication_current_websites_and_more"),
|
("registrar", "0049_alter_DomainRequest_current_websites_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
|
||||||
field=models.TextField(blank=True, help_text="Middle name (optional)", null=True),
|
field=models.TextField(blank=True, help_text="Middle name (optional)", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line2",
|
name="address_line2",
|
||||||
field=models.TextField(blank=True, help_text="Street address line 2 (optional)", null=True),
|
field=models.TextField(blank=True, help_text="Street address line 2 (optional)", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="urbanization",
|
name="urbanization",
|
||||||
field=models.TextField(blank=True, help_text="Urbanization (required for Puerto Rico only)", null=True),
|
field=models.TextField(blank=True, help_text="Urbanization (required for Puerto Rico only)", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,12 +5,12 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0051_alter_domainapplication_urbanization_and_more"),
|
("registrar", "0051_alter_DomainRequest_urbanization_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="anything_else",
|
name="anything_else",
|
||||||
field=models.TextField(blank=True, help_text="Anything else?", null=True),
|
field=models.TextField(blank=True, help_text="Anything else?", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -25,7 +25,7 @@ def create_groups(apps, schema_editor) -> Any:
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0052_alter_domainapplication_anything_else_and_more"),
|
("registrar", "0052_alter_DomainRequest_anything_else_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_agency",
|
name="federal_agency",
|
||||||
field=models.TextField(
|
field=models.TextField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -317,7 +317,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="state_territory",
|
name="state_territory",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0054_alter_domainapplication_federal_agency_and_more"),
|
("registrar", "0054_alter_DomainRequest_federal_agency_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="status",
|
name="status",
|
||||||
field=django_fsm.FSMField(
|
field=django_fsm.FSMField(
|
||||||
choices=[
|
choices=[
|
||||||
|
|
|
@ -5,12 +5,12 @@ from django.db import migrations, models
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0056_alter_domain_state_alter_domainapplication_status_and_more"),
|
("registrar", "0056_alter_domain_state_alter_DomainRequest_status_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="submission_date",
|
name="submission_date",
|
||||||
field=models.DateField(blank=True, default=None, help_text="Date submitted", null=True),
|
field=models.DateField(blank=True, default=None, help_text="Date submitted", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0057_domainapplication_submission_date"),
|
("registrar", "0057_DomainRequest_submission_date"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,12 +10,12 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line1",
|
name="address_line1",
|
||||||
field=models.TextField(blank=True, help_text="Street address", null=True, verbose_name="Address line 1"),
|
field=models.TextField(blank=True, help_text="Street address", null=True, verbose_name="Address line 1"),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line2",
|
name="address_line2",
|
||||||
field=models.TextField(
|
field=models.TextField(
|
||||||
blank=True, help_text="Street address line 2 (optional)", null=True, verbose_name="Address line 2"
|
blank=True, help_text="Street address line 2 (optional)", null=True, verbose_name="Address line 2"
|
||||||
|
|
|
@ -25,7 +25,7 @@ def create_groups(apps, schema_editor) -> Any:
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0064_alter_domainapplication_address_line1_and_more"),
|
("registrar", "0064_alter_DomainRequest_address_line1_and_more"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="notes",
|
name="notes",
|
||||||
field=models.TextField(blank=True, help_text="Notes about this request", null=True),
|
field=models.TextField(blank=True, help_text="Notes about this request", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -6,7 +6,7 @@ import phonenumber_field.modelfields
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0068_domainapplication_notes_domaininformation_notes"),
|
("registrar", "0068_DomainRequest_notes_domaininformation_notes"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="rejection_reason",
|
name="rejection_reason",
|
||||||
field=models.TextField(
|
field=models.TextField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import phonenumber_field.modelfields
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("registrar", "0070_domainapplication_rejection_reason"),
|
("registrar", "0070_DomainRequest_rejection_reason"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -32,24 +32,24 @@ class Migration(migrations.Migration):
|
||||||
field=models.CharField(blank=True, null=True, verbose_name="title or role in your organization"),
|
field=models.CharField(blank=True, null=True, verbose_name="title or role in your organization"),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line1",
|
name="address_line1",
|
||||||
field=models.CharField(blank=True, help_text="Street address", null=True, verbose_name="Address line 1"),
|
field=models.CharField(blank=True, help_text="Street address", null=True, verbose_name="Address line 1"),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="address_line2",
|
name="address_line2",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True, help_text="Street address line 2 (optional)", null=True, verbose_name="Address line 2"
|
blank=True, help_text="Street address line 2 (optional)", null=True, verbose_name="Address line 2"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="city",
|
name="city",
|
||||||
field=models.CharField(blank=True, help_text="City", null=True),
|
field=models.CharField(blank=True, help_text="City", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="federal_agency",
|
name="federal_agency",
|
||||||
field=models.CharField(
|
field=models.CharField(
|
||||||
blank=True,
|
blank=True,
|
||||||
|
@ -356,17 +356,17 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="organization_name",
|
name="organization_name",
|
||||||
field=models.CharField(blank=True, db_index=True, help_text="Organization name", null=True),
|
field=models.CharField(blank=True, db_index=True, help_text="Organization name", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="tribe_name",
|
name="tribe_name",
|
||||||
field=models.CharField(blank=True, help_text="Name of tribe", null=True),
|
field=models.CharField(blank=True, help_text="Name of tribe", null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name="domainapplication",
|
model_name="DomainRequest",
|
||||||
name="urbanization",
|
name="urbanization",
|
||||||
field=models.CharField(blank=True, help_text="Urbanization (required for Puerto Rico only)", null=True),
|
field=models.CharField(blank=True, help_text="Urbanization (required for Puerto Rico only)", null=True),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from auditlog.registry import auditlog # type: ignore
|
from auditlog.registry import auditlog # type: ignore
|
||||||
from .contact import Contact
|
from .contact import Contact
|
||||||
from .domain_application import DomainApplication
|
from .domain_request import DomainRequest
|
||||||
from .domain_information import DomainInformation
|
from .domain_information import DomainInformation
|
||||||
from .domain import Domain
|
from .domain import Domain
|
||||||
from .draft_domain import DraftDomain
|
from .draft_domain import DraftDomain
|
||||||
|
@ -17,7 +17,7 @@ from .verified_by_staff import VerifiedByStaff
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Contact",
|
"Contact",
|
||||||
"DomainApplication",
|
"DomainRequest",
|
||||||
"DomainInformation",
|
"DomainInformation",
|
||||||
"Domain",
|
"Domain",
|
||||||
"DraftDomain",
|
"DraftDomain",
|
||||||
|
@ -34,7 +34,7 @@ __all__ = [
|
||||||
]
|
]
|
||||||
|
|
||||||
auditlog.register(Contact)
|
auditlog.register(Contact)
|
||||||
auditlog.register(DomainApplication)
|
auditlog.register(DomainRequest)
|
||||||
auditlog.register(Domain)
|
auditlog.register(Domain)
|
||||||
auditlog.register(DraftDomain)
|
auditlog.register(DraftDomain)
|
||||||
auditlog.register(DomainInvitation)
|
auditlog.register(DomainInvitation)
|
||||||
|
|
|
@ -897,8 +897,8 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
def security_contact(self, contact: PublicContact):
|
def security_contact(self, contact: PublicContact):
|
||||||
"""makes the contact in the registry,
|
"""makes the contact in the registry,
|
||||||
for security the public contact should have the org or registrant information
|
for security the public contact should have the org or registrant information
|
||||||
from domain information (not domain application)
|
from domain information (not domain request)
|
||||||
and should have the security email from DomainApplication"""
|
and should have the security email from DomainRequest"""
|
||||||
logger.info("making security contact in registry")
|
logger.info("making security contact in registry")
|
||||||
self._set_singleton_contact(contact, expectedType=contact.ContactTypeChoices.SECURITY)
|
self._set_singleton_contact(contact, expectedType=contact.ContactTypeChoices.SECURITY)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ from itertools import chain
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DomainApplication(TimeStampedModel):
|
class DomainRequest(TimeStampedModel):
|
||||||
"""A registrant's application for a new domain."""
|
"""A registrant's application for a new domain."""
|
||||||
|
|
||||||
# Constants for choice fields
|
# Constants for choice fields
|
||||||
|
@ -512,7 +512,7 @@ class DomainApplication(TimeStampedModel):
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="The approved domain",
|
help_text="The approved domain",
|
||||||
related_name="domain_application",
|
related_name="domain_request",
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ class DomainApplication(TimeStampedModel):
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="The requested domain",
|
help_text="The requested domain",
|
||||||
related_name="domain_application",
|
related_name="domain_request",
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
)
|
)
|
||||||
alternative_domains = models.ManyToManyField(
|
alternative_domains = models.ManyToManyField(
|
||||||
|
@ -722,7 +722,7 @@ class DomainApplication(TimeStampedModel):
|
||||||
if self.status == self.ApplicationStatus.REJECTED:
|
if self.status == self.ApplicationStatus.REJECTED:
|
||||||
self.rejection_reason = None
|
self.rejection_reason = None
|
||||||
|
|
||||||
literal = DomainApplication.ApplicationStatus.IN_REVIEW
|
literal = DomainRequest.ApplicationStatus.IN_REVIEW
|
||||||
# Check if the tuple exists, then grab its value
|
# Check if the tuple exists, then grab its value
|
||||||
in_review = literal if literal is not None else "In Review"
|
in_review = literal if literal is not None else "In Review"
|
||||||
logger.info(f"A status change occurred. {self} was changed to '{in_review}'")
|
logger.info(f"A status change occurred. {self} was changed to '{in_review}'")
|
||||||
|
@ -754,7 +754,7 @@ class DomainApplication(TimeStampedModel):
|
||||||
if self.status == self.ApplicationStatus.REJECTED:
|
if self.status == self.ApplicationStatus.REJECTED:
|
||||||
self.rejection_reason = None
|
self.rejection_reason = None
|
||||||
|
|
||||||
literal = DomainApplication.ApplicationStatus.ACTION_NEEDED
|
literal = DomainRequest.ApplicationStatus.ACTION_NEEDED
|
||||||
# Check if the tuple is setup correctly, then grab its value
|
# Check if the tuple is setup correctly, then grab its value
|
||||||
action_needed = literal if literal is not None else "Action Needed"
|
action_needed = literal if literal is not None else "Action Needed"
|
||||||
logger.info(f"A status change occurred. {self} was changed to '{action_needed}'")
|
logger.info(f"A status change occurred. {self} was changed to '{action_needed}'")
|
||||||
|
@ -786,9 +786,9 @@ class DomainApplication(TimeStampedModel):
|
||||||
created_domain = Domain.objects.create(name=self.requested_domain.name)
|
created_domain = Domain.objects.create(name=self.requested_domain.name)
|
||||||
self.approved_domain = created_domain
|
self.approved_domain = created_domain
|
||||||
|
|
||||||
# copy the information from domainapplication into domaininformation
|
# copy the information from DomainRequest into domaininformation
|
||||||
DomainInformation = apps.get_model("registrar.DomainInformation")
|
DomainInformation = apps.get_model("registrar.DomainInformation")
|
||||||
DomainInformation.create_from_da(domain_application=self, domain=created_domain)
|
DomainInformation.create_from_da(domain_request=self, domain=created_domain)
|
||||||
|
|
||||||
# create the permission for the user
|
# create the permission for the user
|
||||||
UserDomainRole = apps.get_model("registrar.UserDomainRole")
|
UserDomainRole = apps.get_model("registrar.UserDomainRole")
|
||||||
|
@ -875,12 +875,12 @@ class DomainApplication(TimeStampedModel):
|
||||||
def show_organization_federal(self) -> bool:
|
def show_organization_federal(self) -> bool:
|
||||||
"""Show this step if the answer to the first question was "federal"."""
|
"""Show this step if the answer to the first question was "federal"."""
|
||||||
user_choice = self.organization_type
|
user_choice = self.organization_type
|
||||||
return user_choice == DomainApplication.OrganizationChoices.FEDERAL
|
return user_choice == DomainRequest.OrganizationChoices.FEDERAL
|
||||||
|
|
||||||
def show_tribal_government(self) -> bool:
|
def show_tribal_government(self) -> bool:
|
||||||
"""Show this step if the answer to the first question was "tribal"."""
|
"""Show this step if the answer to the first question was "tribal"."""
|
||||||
user_choice = self.organization_type
|
user_choice = self.organization_type
|
||||||
return user_choice == DomainApplication.OrganizationChoices.TRIBAL
|
return user_choice == DomainRequest.OrganizationChoices.TRIBAL
|
||||||
|
|
||||||
def show_organization_election(self) -> bool:
|
def show_organization_election(self) -> bool:
|
||||||
"""Show this step if the answer to the first question implies it.
|
"""Show this step if the answer to the first question implies it.
|
||||||
|
@ -890,9 +890,9 @@ class DomainApplication(TimeStampedModel):
|
||||||
"""
|
"""
|
||||||
user_choice = self.organization_type
|
user_choice = self.organization_type
|
||||||
excluded = [
|
excluded = [
|
||||||
DomainApplication.OrganizationChoices.FEDERAL,
|
DomainRequest.OrganizationChoices.FEDERAL,
|
||||||
DomainApplication.OrganizationChoices.INTERSTATE,
|
DomainRequest.OrganizationChoices.INTERSTATE,
|
||||||
DomainApplication.OrganizationChoices.SCHOOL_DISTRICT,
|
DomainRequest.OrganizationChoices.SCHOOL_DISTRICT,
|
||||||
]
|
]
|
||||||
return bool(user_choice and user_choice not in excluded)
|
return bool(user_choice and user_choice not in excluded)
|
||||||
|
|
||||||
|
@ -900,8 +900,8 @@ class DomainApplication(TimeStampedModel):
|
||||||
"""Show this step if this is a special district or interstate."""
|
"""Show this step if this is a special district or interstate."""
|
||||||
user_choice = self.organization_type
|
user_choice = self.organization_type
|
||||||
return user_choice in [
|
return user_choice in [
|
||||||
DomainApplication.OrganizationChoices.SPECIAL_DISTRICT,
|
DomainRequest.OrganizationChoices.SPECIAL_DISTRICT,
|
||||||
DomainApplication.OrganizationChoices.INTERSTATE,
|
DomainRequest.OrganizationChoices.INTERSTATE,
|
||||||
]
|
]
|
||||||
|
|
||||||
def has_rationale(self) -> bool:
|
def has_rationale(self) -> bool:
|
||||||
|
@ -920,7 +920,7 @@ class DomainApplication(TimeStampedModel):
|
||||||
if not self.organization_type:
|
if not self.organization_type:
|
||||||
# organization_type is either blank or None, can't answer
|
# organization_type is either blank or None, can't answer
|
||||||
return None
|
return None
|
||||||
if self.organization_type == DomainApplication.OrganizationChoices.FEDERAL:
|
if self.organization_type == DomainRequest.OrganizationChoices.FEDERAL:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
from registrar.models.utility.domain_helper import DomainHelper
|
from registrar.models.utility.domain_helper import DomainHelper
|
||||||
from .domain_application import DomainApplication
|
from .domain_request import DomainRequest
|
||||||
from .utility.time_stamped_model import TimeStampedModel
|
from .utility.time_stamped_model import TimeStampedModel
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
@ -15,20 +15,20 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class DomainInformation(TimeStampedModel):
|
class DomainInformation(TimeStampedModel):
|
||||||
"""A registrant's domain information for that domain, exported from
|
"""A registrant's domain information for that domain, exported from
|
||||||
DomainApplication. We use these field from DomainApplication with few exceptions
|
DomainRequest. We use these field from DomainRequest with few exceptions
|
||||||
which are 'removed' via pop at the bottom of this file. Most of design for domain
|
which are 'removed' via pop at the bottom of this file. Most of design for domain
|
||||||
management's user information are based on application, but we cannot change
|
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
|
the application once approved, so copying them that way we can make changes
|
||||||
after its approved. Most fields here are copied from Application."""
|
after its approved. Most fields here are copied from Application."""
|
||||||
|
|
||||||
StateTerritoryChoices = DomainApplication.StateTerritoryChoices
|
StateTerritoryChoices = DomainRequest.StateTerritoryChoices
|
||||||
|
|
||||||
# use the short names in Django admin
|
# use the short names in Django admin
|
||||||
OrganizationChoices = DomainApplication.OrganizationChoices
|
OrganizationChoices = DomainRequest.OrganizationChoices
|
||||||
|
|
||||||
BranchChoices = DomainApplication.BranchChoices
|
BranchChoices = DomainRequest.BranchChoices
|
||||||
|
|
||||||
AGENCY_CHOICES = DomainApplication.AGENCY_CHOICES
|
AGENCY_CHOICES = DomainRequest.AGENCY_CHOICES
|
||||||
|
|
||||||
# This is the application user who created this application. The contact
|
# This is the application user who created this application. The contact
|
||||||
# information that they gave is in the `submitter` field
|
# information that they gave is in the `submitter` field
|
||||||
|
@ -38,13 +38,13 @@ class DomainInformation(TimeStampedModel):
|
||||||
related_name="information_created",
|
related_name="information_created",
|
||||||
)
|
)
|
||||||
|
|
||||||
domain_application = models.OneToOneField(
|
domain_request = models.OneToOneField(
|
||||||
"registrar.DomainApplication",
|
"registrar.DomainRequest",
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
related_name="domainapplication_info",
|
related_name="DomainRequest_info",
|
||||||
help_text="Associated domain application",
|
help_text="Associated domain request",
|
||||||
unique=True,
|
unique=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -220,25 +220,25 @@ class DomainInformation(TimeStampedModel):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_from_da(cls, domain_application: DomainApplication, domain=None):
|
def create_from_da(cls, domain_request: DomainRequest, domain=None):
|
||||||
"""Takes in a DomainApplication and converts it into DomainInformation"""
|
"""Takes in a DomainRequest and converts it into DomainInformation"""
|
||||||
|
|
||||||
# Throw an error if we get None - we can't create something from nothing
|
# Throw an error if we get None - we can't create something from nothing
|
||||||
if domain_application is None:
|
if domain_request is None:
|
||||||
raise ValueError("The provided DomainApplication is None")
|
raise ValueError("The provided DomainRequest is None")
|
||||||
|
|
||||||
# Throw an error if the da doesn't have an id
|
# Throw an error if the da doesn't have an id
|
||||||
if not hasattr(domain_application, "id"):
|
if not hasattr(domain_request, "id"):
|
||||||
raise ValueError("The provided DomainApplication has no id")
|
raise ValueError("The provided DomainRequest has no id")
|
||||||
|
|
||||||
# check if we have a record that corresponds with the domain
|
# check if we have a record that corresponds with the domain
|
||||||
# application, if so short circuit the create
|
# application, if so short circuit the create
|
||||||
existing_domain_info = cls.objects.filter(domain_application__id=domain_application.id).first()
|
existing_domain_info = cls.objects.filter(domain_request__id=domain_request.id).first()
|
||||||
if existing_domain_info:
|
if existing_domain_info:
|
||||||
return existing_domain_info
|
return existing_domain_info
|
||||||
|
|
||||||
# Get the fields that exist on both DomainApplication and DomainInformation
|
# Get the fields that exist on both DomainRequest and DomainInformation
|
||||||
common_fields = DomainHelper.get_common_fields(DomainApplication, DomainInformation)
|
common_fields = DomainHelper.get_common_fields(DomainRequest, DomainInformation)
|
||||||
|
|
||||||
# Get a list of all many_to_many relations on DomainInformation (needs to be saved differently)
|
# 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()
|
info_many_to_many_fields = DomainInformation._get_many_to_many_fields()
|
||||||
|
@ -249,11 +249,11 @@ class DomainInformation(TimeStampedModel):
|
||||||
for field in common_fields:
|
for field in common_fields:
|
||||||
# If the field isn't many_to_many, populate the da_dict.
|
# 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 it is, populate da_many_to_many_dict as we need to save this later.
|
||||||
if hasattr(domain_application, field):
|
if hasattr(domain_request, field):
|
||||||
if field not in info_many_to_many_fields:
|
if field not in info_many_to_many_fields:
|
||||||
da_dict[field] = getattr(domain_application, field)
|
da_dict[field] = getattr(domain_request, field)
|
||||||
else:
|
else:
|
||||||
da_many_to_many_dict[field] = getattr(domain_application, field).all()
|
da_many_to_many_dict[field] = getattr(domain_request, field).all()
|
||||||
|
|
||||||
# This will not happen in normal code flow, but having some redundancy doesn't hurt.
|
# This will not happen in normal code flow, but having some redundancy doesn't hurt.
|
||||||
# da_dict should not have "id" under any circumstances.
|
# da_dict should not have "id" under any circumstances.
|
||||||
|
@ -266,8 +266,8 @@ class DomainInformation(TimeStampedModel):
|
||||||
# Create a placeholder DomainInformation object
|
# Create a placeholder DomainInformation object
|
||||||
domain_info = DomainInformation(**da_dict)
|
domain_info = DomainInformation(**da_dict)
|
||||||
|
|
||||||
# Add the domain_application and domain fields
|
# Add the domain_request and domain fields
|
||||||
domain_info.domain_application = domain_application
|
domain_info.domain_request = domain_request
|
||||||
if domain:
|
if domain:
|
||||||
domain_info.domain = domain
|
domain_info.domain = domain
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ class UserGroup(Group):
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"app_label": "registrar",
|
"app_label": "registrar",
|
||||||
"model": "domainapplication",
|
"model": "DomainRequest",
|
||||||
"permissions": ["change_domainapplication"],
|
"permissions": ["change_DomainRequest"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"app_label": "registrar",
|
"app_label": "registrar",
|
||||||
|
|
|
@ -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_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")
|
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 DomainApplication and DomainInformation
|
# Get the fields that exist on both DomainRequest and DomainInformation
|
||||||
common_fields = model_1_fields & model_2_fields
|
common_fields = model_1_fields & model_2_fields
|
||||||
|
|
||||||
return common_fields
|
return common_fields
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% load custom_filters %}
|
{% load custom_filters %}
|
||||||
|
|
||||||
{% block title %}Domain request status | {{ domainapplication.requested_domain.name }} | {% endblock %}
|
{% block title %}Domain request status | {{ DomainRequest.requested_domain.name }} | {% endblock %}
|
||||||
{% load static url_helpers %}
|
{% load static url_helpers %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
Back to manage your domains
|
Back to manage your domains
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<h1>Domain request for {{ domainapplication.requested_domain.name }}</h1>
|
<h1>Domain request for {{ DomainRequest.requested_domain.name }}</h1>
|
||||||
<div
|
<div
|
||||||
class="usa-summary-box dotgov-status-box margin-top-3 padding-left-2"
|
class="usa-summary-box dotgov-status-box margin-top-3 padding-left-2"
|
||||||
role="region"
|
role="region"
|
||||||
|
@ -30,21 +30,21 @@
|
||||||
<span class="text-bold text-primary-darker">
|
<span class="text-bold text-primary-darker">
|
||||||
Status:
|
Status:
|
||||||
</span>
|
</span>
|
||||||
{% if domainapplication.status == 'approved' %} Approved
|
{% if DomainRequest.status == 'approved' %} Approved
|
||||||
{% elif domainapplication.status == 'in review' %} In review
|
{% elif DomainRequest.status == 'in review' %} In review
|
||||||
{% elif domainapplication.status == 'rejected' %} Rejected
|
{% elif DomainRequest.status == 'rejected' %} Rejected
|
||||||
{% elif domainapplication.status == 'submitted' %} Submitted
|
{% elif DomainRequest.status == 'submitted' %} Submitted
|
||||||
{% elif domainapplication.status == 'ineligible' %} Ineligible
|
{% elif DomainRequest.status == 'ineligible' %} Ineligible
|
||||||
{% else %}ERROR Please contact technical support/dev
|
{% else %}ERROR Please contact technical support/dev
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<p> <b class="review__step__name">Last updated:</b> {{domainapplication.updated_at|date:"F j, Y"}}<br>
|
<p> <b class="review__step__name">Last updated:</b> {{DomainRequest.updated_at|date:"F j, Y"}}<br>
|
||||||
<b class="review__step__name">Request #:</b> {{domainapplication.id}}</p>
|
<b class="review__step__name">Request #:</b> {{DomainRequest.id}}</p>
|
||||||
<p>{% include "includes/domain_application.html" %}</p>
|
<p>{% include "includes/domain_request.html" %}</p>
|
||||||
<p><a href="{% url 'application-withdraw-confirmation' pk=domainapplication.id %}" class="usa-button usa-button--outline withdraw_outline">
|
<p><a href="{% url 'application-withdraw-confirmation' pk=DomainRequest.id %}" class="usa-button usa-button--outline withdraw_outline">
|
||||||
Withdraw request</a>
|
Withdraw request</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,72 +52,72 @@
|
||||||
<div class="grid-col desktop:grid-offset-2 maxw-tablet">
|
<div class="grid-col desktop:grid-offset-2 maxw-tablet">
|
||||||
<h2 class="text-primary-darker"> Summary of your domain request </h2>
|
<h2 class="text-primary-darker"> Summary of your domain request </h2>
|
||||||
{% with heading_level='h3' %}
|
{% with heading_level='h3' %}
|
||||||
{% with org_type=domainapplication.get_organization_type_display %}
|
{% 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 %}
|
{% include "includes/summary_item.html" with title='Type of organization' value=org_type heading_level=heading_level %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
{% if domainapplication.tribe_name %}
|
{% if DomainRequest.tribe_name %}
|
||||||
{% include "includes/summary_item.html" with title='Tribal government' value=domainapplication.tribe_name heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Tribal government' value=DomainRequest.tribe_name heading_level=heading_level %}
|
||||||
|
|
||||||
{% if domainapplication.federally_recognized_tribe %}
|
{% if DomainRequest.federally_recognized_tribe %}
|
||||||
<p>Federally-recognized tribe</p>
|
<p>Federally-recognized tribe</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.state_recognized_tribe %}
|
{% if DomainRequest.state_recognized_tribe %}
|
||||||
<p>State-recognized tribe</p>
|
<p>State-recognized tribe</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.get_federal_type_display %}
|
{% if DomainRequest.get_federal_type_display %}
|
||||||
{% include "includes/summary_item.html" with title='Federal government branch' value=domainapplication.get_federal_type_display heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Federal government branch' value=DomainRequest.get_federal_type_display heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.is_election_board %}
|
{% if DomainRequest.is_election_board %}
|
||||||
{% with value=domainapplication.is_election_board|yesno:"Yes,No,Incomplete" %}
|
{% 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 %}
|
{% include "includes/summary_item.html" with title='Election office' value=value heading_level=heading_level %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.organization_name %}
|
{% if DomainRequest.organization_name %}
|
||||||
{% include "includes/summary_item.html" with title='Organization name and mailing address' value=domainapplication address='true' heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Organization name and mailing address' value=DomainRequest address='true' heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.about_your_organization %}
|
{% if DomainRequest.about_your_organization %}
|
||||||
{% include "includes/summary_item.html" with title='About your organization' value=domainapplication.about_your_organization heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='About your organization' value=DomainRequest.about_your_organization heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.authorizing_official %}
|
{% if DomainRequest.authorizing_official %}
|
||||||
{% include "includes/summary_item.html" with title='Authorizing official' value=domainapplication.authorizing_official contact='true' heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Authorizing official' value=DomainRequest.authorizing_official contact='true' heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.current_websites.all %}
|
{% if DomainRequest.current_websites.all %}
|
||||||
{% include "includes/summary_item.html" with title='Current websites' value=domainapplication.current_websites.all list='true' heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Current websites' value=DomainRequest.current_websites.all list='true' heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.requested_domain %}
|
{% if DomainRequest.requested_domain %}
|
||||||
{% include "includes/summary_item.html" with title='.gov domain' value=domainapplication.requested_domain heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='.gov domain' value=DomainRequest.requested_domain heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.alternative_domains.all %}
|
{% if DomainRequest.alternative_domains.all %}
|
||||||
{% include "includes/summary_item.html" with title='Alternative domains' value=domainapplication.alternative_domains.all list='true' heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Alternative domains' value=DomainRequest.alternative_domains.all list='true' heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.purpose %}
|
{% if DomainRequest.purpose %}
|
||||||
{% include "includes/summary_item.html" with title='Purpose of your domain' value=domainapplication.purpose heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Purpose of your domain' value=DomainRequest.purpose heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.submitter %}
|
{% if DomainRequest.submitter %}
|
||||||
{% include "includes/summary_item.html" with title='Your contact information' value=domainapplication.submitter contact='true' heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Your contact information' value=DomainRequest.submitter contact='true' heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if domainapplication.other_contacts.all %}
|
{% if DomainRequest.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 %}
|
{% 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 %}
|
{% else %}
|
||||||
{% include "includes/summary_item.html" with title='Other employees from your organization' value=domainapplication.no_other_contacts_rationale heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Other employees from your organization' value=DomainRequest.no_other_contacts_rationale heading_level=heading_level %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% include "includes/summary_item.html" with title='Anything else?' value=domainapplication.anything_else|default:"No" heading_level=heading_level %}
|
{% include "includes/summary_item.html" with title='Anything else?' value=DomainRequest.anything_else|default:"No" heading_level=heading_level %}
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block title %}Withdraw request for {{ domainapplication.requested_domain.name }} | {% endblock %}
|
{% block title %}Withdraw request for {{ DomainRequest.requested_domain.name }} | {% endblock %}
|
||||||
{% load static url_helpers %}
|
{% load static url_helpers %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -8,12 +8,12 @@
|
||||||
<div class="grid-col desktop:grid-offset-2 desktop:grid-col-8">
|
<div class="grid-col desktop:grid-offset-2 desktop:grid-col-8">
|
||||||
|
|
||||||
|
|
||||||
<h1>Withdraw request for {{ domainapplication.requested_domain.name }}?</h1>
|
<h1>Withdraw request for {{ DomainRequest.requested_domain.name }}?</h1>
|
||||||
|
|
||||||
<p>If you withdraw your request, we won't review it. Once you withdraw your request, you can edit it and submit it again. </p>
|
<p>If you withdraw your request, we won't review it. Once you withdraw your request, you can edit it and submit it again. </p>
|
||||||
|
|
||||||
<p><a href="{% url 'application-withdrawn' domainapplication.id %}" class="usa-button withdraw">Withdraw request</a>
|
<p><a href="{% url 'application-withdrawn' DomainRequest.id %}" class="usa-button withdraw">Withdraw request</a>
|
||||||
<a href="{% url 'application-status' domainapplication.id %}">Cancel</a></p>
|
<a href="{% url 'application-status' DomainRequest.id %}">Cancel</a></p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
<section class="section--outlined">
|
<section class="section--outlined">
|
||||||
<h2>Domain requests</h2>
|
<h2>Domain requests</h2>
|
||||||
{% if domain_applications %}
|
{% if domain_requests %}
|
||||||
<table class="usa-table usa-table--borderless usa-table--stacked dotgov-table dotgov-table--stacked">
|
<table class="usa-table usa-table--borderless usa-table--stacked dotgov-table dotgov-table--stacked">
|
||||||
<caption class="sr-only">Your domain requests</caption>
|
<caption class="sr-only">Your domain requests</caption>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for application in domain_applications %}
|
{% for application in domain_requests %}
|
||||||
<tr>
|
<tr>
|
||||||
<th th scope="row" role="rowheader" data-label="Domain name">
|
<th th scope="row" role="rowheader" data-label="Domain name">
|
||||||
{% if application.requested_domain is None %}
|
{% if application.requested_domain is None %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from django import template
|
from django import template
|
||||||
import re
|
import re
|
||||||
from registrar.models.domain_application import DomainApplication
|
from registrar.models.domain_request import DomainRequest
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -55,7 +55,7 @@ def contains_checkbox(html_list):
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def get_organization_long_name(organization_type):
|
def get_organization_long_name(organization_type):
|
||||||
organization_choices_dict = dict(DomainApplication.OrganizationChoicesVerbose.choices)
|
organization_choices_dict = dict(DomainRequest.OrganizationChoicesVerbose.choices)
|
||||||
long_form_type = organization_choices_dict[organization_type]
|
long_form_type = organization_choices_dict[organization_type]
|
||||||
if long_form_type is None:
|
if long_form_type is None:
|
||||||
logger.error("Organization type error, triggered by a template's custom filter")
|
logger.error("Organization type error, triggered by a template's custom filter")
|
||||||
|
|
|
@ -18,7 +18,7 @@ from registrar.models import (
|
||||||
Contact,
|
Contact,
|
||||||
DraftDomain,
|
DraftDomain,
|
||||||
Website,
|
Website,
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
DomainInvitation,
|
DomainInvitation,
|
||||||
User,
|
User,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
|
@ -365,13 +365,13 @@ class AuditedAdminMockData:
|
||||||
self,
|
self,
|
||||||
domain_type,
|
domain_type,
|
||||||
item_name,
|
item_name,
|
||||||
status=DomainApplication.ApplicationStatus.STARTED,
|
status=DomainRequest.ApplicationStatus.STARTED,
|
||||||
org_type="federal",
|
org_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Returns a prebuilt kwarg dictionary for DomainApplication,
|
Returns a prebuilt kwarg dictionary for DomainRequest,
|
||||||
DomainInformation, or DomainInvitation.
|
DomainInformation, or DomainInvitation.
|
||||||
Args:
|
Args:
|
||||||
domain_type (str): is either 'application', 'information',
|
domain_type (str): is either 'application', 'information',
|
||||||
|
@ -381,8 +381,8 @@ class AuditedAdminMockData:
|
||||||
organization_name, address_line1, address_line2,
|
organization_name, address_line1, address_line2,
|
||||||
title, email, and username.
|
title, email, and username.
|
||||||
|
|
||||||
status (str - optional): Defines the status for DomainApplication,
|
status (str - optional): Defines the status for DomainRequest,
|
||||||
e.g. DomainApplication.ApplicationStatus.STARTED
|
e.g. DomainRequest.ApplicationStatus.STARTED
|
||||||
|
|
||||||
org_type (str - optional): Sets a domains org_type
|
org_type (str - optional): Sets a domains org_type
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ class AuditedAdminMockData:
|
||||||
purpose (str - optional): Sets a domains purpose
|
purpose (str - optional): Sets a domains purpose
|
||||||
Returns:
|
Returns:
|
||||||
dict: Returns a dictionary structurally consistent with the expected input
|
dict: Returns a dictionary structurally consistent with the expected input
|
||||||
of either DomainApplication, DomainInvitation, or DomainInformation
|
of either DomainRequest, DomainInvitation, or DomainInformation
|
||||||
based on the 'domain_type' field.
|
based on the 'domain_type' field.
|
||||||
""" # noqa
|
""" # noqa
|
||||||
common_args = self.get_common_domain_arg_dictionary(item_name, org_type, federal_type, purpose)
|
common_args = self.get_common_domain_arg_dictionary(item_name, org_type, federal_type, purpose)
|
||||||
|
@ -405,11 +405,11 @@ class AuditedAdminMockData:
|
||||||
status=status,
|
status=status,
|
||||||
)
|
)
|
||||||
case self.INFORMATION:
|
case self.INFORMATION:
|
||||||
domain_app = self.create_full_dummy_domain_application(item_name)
|
domain_app = self.create_full_dummy_domain_request(item_name)
|
||||||
full_arg_dict = dict(
|
full_arg_dict = dict(
|
||||||
**common_args,
|
**common_args,
|
||||||
domain=self.dummy_domain(item_name, True),
|
domain=self.dummy_domain(item_name, True),
|
||||||
domain_application=domain_app,
|
domain_request=domain_app,
|
||||||
)
|
)
|
||||||
case self.INVITATION:
|
case self.INVITATION:
|
||||||
full_arg_dict = dict(
|
full_arg_dict = dict(
|
||||||
|
@ -419,22 +419,22 @@ class AuditedAdminMockData:
|
||||||
)
|
)
|
||||||
return full_arg_dict
|
return full_arg_dict
|
||||||
|
|
||||||
def create_full_dummy_domain_application(self, item_name, status=DomainApplication.ApplicationStatus.STARTED):
|
def create_full_dummy_domain_request(self, item_name, status=DomainRequest.ApplicationStatus.STARTED):
|
||||||
"""Creates a dummy domain application object"""
|
"""Creates a dummy domain request object"""
|
||||||
domain_application_kwargs = self.dummy_kwarg_boilerplate(self.APPLICATION, item_name, status)
|
domain_request_kwargs = self.dummy_kwarg_boilerplate(self.APPLICATION, item_name, status)
|
||||||
application = DomainApplication.objects.get_or_create(**domain_application_kwargs)[0]
|
application = DomainRequest.objects.get_or_create(**domain_request_kwargs)[0]
|
||||||
return application
|
return application
|
||||||
|
|
||||||
def create_full_dummy_domain_information(self, item_name, status=DomainApplication.ApplicationStatus.STARTED):
|
def create_full_dummy_domain_information(self, item_name, status=DomainRequest.ApplicationStatus.STARTED):
|
||||||
"""Creates a dummy domain information object"""
|
"""Creates a dummy domain information object"""
|
||||||
domain_application_kwargs = self.dummy_kwarg_boilerplate(self.INFORMATION, item_name, status)
|
domain_request_kwargs = self.dummy_kwarg_boilerplate(self.INFORMATION, item_name, status)
|
||||||
application = DomainInformation.objects.get_or_create(**domain_application_kwargs)[0]
|
application = DomainInformation.objects.get_or_create(**domain_request_kwargs)[0]
|
||||||
return application
|
return application
|
||||||
|
|
||||||
def create_full_dummy_domain_invitation(self, item_name, status=DomainApplication.ApplicationStatus.STARTED):
|
def create_full_dummy_domain_invitation(self, item_name, status=DomainRequest.ApplicationStatus.STARTED):
|
||||||
"""Creates a dummy domain invitation object"""
|
"""Creates a dummy domain invitation object"""
|
||||||
domain_application_kwargs = self.dummy_kwarg_boilerplate(self.INVITATION, item_name, status)
|
domain_request_kwargs = self.dummy_kwarg_boilerplate(self.INVITATION, item_name, status)
|
||||||
application = DomainInvitation.objects.get_or_create(**domain_application_kwargs)[0]
|
application = DomainInvitation.objects.get_or_create(**domain_request_kwargs)[0]
|
||||||
|
|
||||||
return application
|
return application
|
||||||
|
|
||||||
|
@ -445,13 +445,13 @@ class AuditedAdminMockData:
|
||||||
has_other_contacts=True,
|
has_other_contacts=True,
|
||||||
has_current_website=True,
|
has_current_website=True,
|
||||||
has_alternative_gov_domain=True,
|
has_alternative_gov_domain=True,
|
||||||
status=DomainApplication.ApplicationStatus.STARTED,
|
status=DomainRequest.ApplicationStatus.STARTED,
|
||||||
):
|
):
|
||||||
"""A helper to create a dummy domain application object"""
|
"""A helper to create a dummy domain request object"""
|
||||||
application = None
|
application = None
|
||||||
match domain_type:
|
match domain_type:
|
||||||
case self.APPLICATION:
|
case self.APPLICATION:
|
||||||
application = self.create_full_dummy_domain_application(item_name, status)
|
application = self.create_full_dummy_domain_request(item_name, status)
|
||||||
case self.INVITATION:
|
case self.INVITATION:
|
||||||
application = self.create_full_dummy_domain_invitation(item_name, status)
|
application = self.create_full_dummy_domain_invitation(item_name, status)
|
||||||
case self.INFORMATION:
|
case self.INFORMATION:
|
||||||
|
@ -526,12 +526,12 @@ def completed_application(
|
||||||
has_alternative_gov_domain=True,
|
has_alternative_gov_domain=True,
|
||||||
has_about_your_organization=True,
|
has_about_your_organization=True,
|
||||||
has_anything_else=True,
|
has_anything_else=True,
|
||||||
status=DomainApplication.ApplicationStatus.STARTED,
|
status=DomainRequest.ApplicationStatus.STARTED,
|
||||||
user=False,
|
user=False,
|
||||||
submitter=False,
|
submitter=False,
|
||||||
name="city.gov",
|
name="city.gov",
|
||||||
):
|
):
|
||||||
"""A completed domain application."""
|
"""A completed domain request."""
|
||||||
if not user:
|
if not user:
|
||||||
user = get_user_model().objects.create(username="username" + str(uuid.uuid4())[:8])
|
user = get_user_model().objects.create(username="username" + str(uuid.uuid4())[:8])
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -559,7 +559,7 @@ def completed_application(
|
||||||
email="testy2@town.com",
|
email="testy2@town.com",
|
||||||
phone="(555) 555 5557",
|
phone="(555) 555 5557",
|
||||||
)
|
)
|
||||||
domain_application_kwargs = dict(
|
domain_request_kwargs = dict(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -576,11 +576,11 @@ def completed_application(
|
||||||
status=status,
|
status=status,
|
||||||
)
|
)
|
||||||
if has_about_your_organization:
|
if has_about_your_organization:
|
||||||
domain_application_kwargs["about_your_organization"] = "e-Government"
|
domain_request_kwargs["about_your_organization"] = "e-Government"
|
||||||
if has_anything_else:
|
if has_anything_else:
|
||||||
domain_application_kwargs["anything_else"] = "There is more"
|
domain_request_kwargs["anything_else"] = "There is more"
|
||||||
|
|
||||||
application, _ = DomainApplication.objects.get_or_create(**domain_application_kwargs)
|
application, _ = DomainRequest.objects.get_or_create(**domain_request_kwargs)
|
||||||
|
|
||||||
if has_other_contacts:
|
if has_other_contacts:
|
||||||
application.other_contacts.add(other)
|
application.other_contacts.add(other)
|
||||||
|
|
|
@ -7,8 +7,8 @@ from django.contrib import messages
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from registrar.admin import (
|
from registrar.admin import (
|
||||||
DomainAdmin,
|
DomainAdmin,
|
||||||
DomainApplicationAdmin,
|
DomainRequestAdmin,
|
||||||
DomainApplicationAdminForm,
|
DomainRequestAdminForm,
|
||||||
DomainInvitationAdmin,
|
DomainInvitationAdmin,
|
||||||
ListHeaderAdmin,
|
ListHeaderAdmin,
|
||||||
MyUserAdmin,
|
MyUserAdmin,
|
||||||
|
@ -18,7 +18,7 @@ from registrar.admin import (
|
||||||
UserDomainRoleAdmin,
|
UserDomainRoleAdmin,
|
||||||
VerifiedByStaffAdmin,
|
VerifiedByStaffAdmin,
|
||||||
)
|
)
|
||||||
from registrar.models import Domain, DomainApplication, DomainInformation, User, DomainInvitation, Contact, Website
|
from registrar.models import Domain, DomainRequest, DomainInformation, User, DomainInvitation, Contact, Website
|
||||||
from registrar.models.user_domain_role import UserDomainRole
|
from registrar.models.user_domain_role import UserDomainRole
|
||||||
from registrar.models.verified_by_staff import VerifiedByStaff
|
from registrar.models.verified_by_staff import VerifiedByStaff
|
||||||
from .common import (
|
from .common import (
|
||||||
|
@ -236,7 +236,7 @@ class TestDomainAdmin(MockEppLib, WebTest):
|
||||||
"""
|
"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
self.client.force_login(self.superuser)
|
self.client.force_login(self.superuser)
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
mock_client = MockSESClient()
|
mock_client = MockSESClient()
|
||||||
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||||
application.approve()
|
application.approve()
|
||||||
|
@ -435,11 +435,11 @@ class TestDomainAdmin(MockEppLib, WebTest):
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
Domain.objects.all().delete()
|
Domain.objects.all().delete()
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
class TestDomainApplicationAdminForm(TestCase):
|
class TestDomainRequestAdminForm(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Create a test application with an initial state of started
|
# Create a test application with an initial state of started
|
||||||
self.application = completed_application()
|
self.application = completed_application()
|
||||||
|
@ -447,7 +447,7 @@ class TestDomainApplicationAdminForm(TestCase):
|
||||||
def test_form_choices(self):
|
def test_form_choices(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a form instance with the test application
|
# Create a form instance with the test application
|
||||||
form = DomainApplicationAdminForm(instance=self.application)
|
form = DomainRequestAdminForm(instance=self.application)
|
||||||
|
|
||||||
# Verify that the form choices match the available transitions for started
|
# Verify that the form choices match the available transitions for started
|
||||||
expected_choices = [("started", "Started"), ("submitted", "Submitted")]
|
expected_choices = [("started", "Started"), ("submitted", "Submitted")]
|
||||||
|
@ -456,41 +456,41 @@ class TestDomainApplicationAdminForm(TestCase):
|
||||||
def test_form_choices_when_no_instance(self):
|
def test_form_choices_when_no_instance(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a form instance without an instance
|
# Create a form instance without an instance
|
||||||
form = DomainApplicationAdminForm()
|
form = DomainRequestAdminForm()
|
||||||
|
|
||||||
# Verify that the form choices show all choices when no instance is provided;
|
# 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
|
# this is necessary to show all choices when creating a new domain
|
||||||
# application in django admin;
|
# application in django admin;
|
||||||
# note that FSM ensures that no domain application exists with invalid status,
|
# note that FSM ensures that no domain request exists with invalid status,
|
||||||
# so don't need to test for invalid status
|
# so don't need to test for invalid status
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
form.fields["status"].widget.choices,
|
form.fields["status"].widget.choices,
|
||||||
DomainApplication._meta.get_field("status").choices,
|
DomainRequest._meta.get_field("status").choices,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_form_choices_when_ineligible(self):
|
def test_form_choices_when_ineligible(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a form instance with a domain application with ineligible status
|
# Create a form instance with a domain request with ineligible status
|
||||||
ineligible_application = DomainApplication(status="ineligible")
|
ineligible_application = DomainRequest(status="ineligible")
|
||||||
|
|
||||||
# Attempt to create a form with the ineligible application
|
# Attempt to create a form with the ineligible application
|
||||||
# The form should not raise an error, but choices should be the
|
# The form should not raise an error, but choices should be the
|
||||||
# full list of possible choices
|
# full list of possible choices
|
||||||
form = DomainApplicationAdminForm(instance=ineligible_application)
|
form = DomainRequestAdminForm(instance=ineligible_application)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
form.fields["status"].widget.choices,
|
form.fields["status"].widget.choices,
|
||||||
DomainApplication._meta.get_field("status").choices,
|
DomainRequest._meta.get_field("status").choices,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@boto3_mocking.patching
|
@boto3_mocking.patching
|
||||||
class TestDomainApplicationAdmin(MockEppLib):
|
class TestDomainRequestAdmin(MockEppLib):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.site = AdminSite()
|
self.site = AdminSite()
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
self.admin = DomainApplicationAdmin(model=DomainApplication, admin_site=self.site)
|
self.admin = DomainRequestAdmin(model=DomainRequest, admin_site=self.site)
|
||||||
self.superuser = create_superuser()
|
self.superuser = create_superuser()
|
||||||
self.staffuser = create_user()
|
self.staffuser = create_user()
|
||||||
self.client = Client(HTTP_HOST="localhost:8080")
|
self.client = Client(HTTP_HOST="localhost:8080")
|
||||||
|
@ -498,13 +498,13 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
factory=self.factory,
|
factory=self.factory,
|
||||||
user=self.superuser,
|
user=self.superuser,
|
||||||
admin=self.admin,
|
admin=self.admin,
|
||||||
url="/admin/registrar/DomainApplication/",
|
url="/admin/registrar/DomainRequest/",
|
||||||
model=DomainApplication,
|
model=DomainRequest,
|
||||||
)
|
)
|
||||||
self.mock_client = MockSESClient()
|
self.mock_client = MockSESClient()
|
||||||
|
|
||||||
def test_domain_sortable(self):
|
def test_domain_sortable(self):
|
||||||
"""Tests if the DomainApplication sorts by domain correctly"""
|
"""Tests if the DomainRequest sorts by domain correctly"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
p = "adminpass"
|
p = "adminpass"
|
||||||
self.client.login(username="superuser", password=p)
|
self.client.login(username="superuser", password=p)
|
||||||
|
@ -518,7 +518,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.test_helper.assert_table_sorted("-1", ("-requested_domain__name",))
|
self.test_helper.assert_table_sorted("-1", ("-requested_domain__name",))
|
||||||
|
|
||||||
def test_submitter_sortable(self):
|
def test_submitter_sortable(self):
|
||||||
"""Tests if the DomainApplication sorts by domain correctly"""
|
"""Tests if the DomainRequest sorts by domain correctly"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
p = "adminpass"
|
p = "adminpass"
|
||||||
self.client.login(username="superuser", password=p)
|
self.client.login(username="superuser", password=p)
|
||||||
|
@ -549,7 +549,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_investigator_sortable(self):
|
def test_investigator_sortable(self):
|
||||||
"""Tests if the DomainApplication sorts by domain correctly"""
|
"""Tests if the DomainRequest sorts by domain correctly"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
p = "adminpass"
|
p = "adminpass"
|
||||||
self.client.login(username="superuser", password=p)
|
self.client.login(username="superuser", password=p)
|
||||||
|
@ -585,7 +585,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
self.client.force_login(self.superuser)
|
self.client.force_login(self.superuser)
|
||||||
completed_application()
|
completed_application()
|
||||||
response = self.client.get("/admin/registrar/domainapplication/")
|
response = self.client.get("/admin/registrar/DomainRequest/")
|
||||||
# There are 4 template references to Federal (4) plus two references in the table
|
# There are 4 template references to Federal (4) plus two references in the table
|
||||||
# for our actual application
|
# for our actual application
|
||||||
self.assertContains(response, "Federal", count=6)
|
self.assertContains(response, "Federal", count=6)
|
||||||
|
@ -600,7 +600,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a mock request
|
# Create a mock request
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
|
|
||||||
# Modify the application's properties
|
# Modify the application's properties
|
||||||
application.status = status
|
application.status = status
|
||||||
|
@ -661,39 +661,39 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
application = completed_application()
|
application = completed_application()
|
||||||
|
|
||||||
# Test Submitted Status from started
|
# Test Submitted Status from started
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, True)
|
self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, True)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Test Withdrawn Status
|
# Test Withdrawn Status
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.WITHDRAWN)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your .gov domain request has been withdrawn and will not be reviewed by our team.", 1, EMAIL, True
|
"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)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
# Test Submitted Status Again (from withdrawn)
|
# Test Submitted Status Again (from withdrawn)
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Move it to IN_REVIEW
|
# Move it to IN_REVIEW
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Test Submitted Status Again from in IN_REVIEW, no new email should be sent
|
# Test Submitted Status Again from in IN_REVIEW, no new email should be sent
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Move it to IN_REVIEW
|
# Move it to IN_REVIEW
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Move it to ACTION_NEEDED
|
# Move it to ACTION_NEEDED
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.ACTION_NEEDED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.ACTION_NEEDED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Test Submitted Status Again from in ACTION_NEEDED, no new email should be sent
|
# Test Submitted Status Again from in ACTION_NEEDED, no new email should be sent
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
@override_settings(IS_PRODUCTION=True)
|
@override_settings(IS_PRODUCTION=True)
|
||||||
|
@ -718,40 +718,40 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
application = completed_application()
|
application = completed_application()
|
||||||
|
|
||||||
# Test Submitted Status from started
|
# Test Submitted Status from started
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, False, BCC_EMAIL)
|
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)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Test Withdrawn Status
|
# Test Withdrawn Status
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.WITHDRAWN)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your .gov domain request has been withdrawn and will not be reviewed by our team.", 1, EMAIL
|
"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)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
# Test Submitted Status Again (from withdrawn)
|
# Test Submitted Status Again (from withdrawn)
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assert_email_is_accurate("We received your .gov domain request.", 0, EMAIL, False, BCC_EMAIL)
|
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)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Move it to IN_REVIEW
|
# Move it to IN_REVIEW
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Test Submitted Status Again from in IN_REVIEW, no new email should be sent
|
# Test Submitted Status Again from in IN_REVIEW, no new email should be sent
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Move it to IN_REVIEW
|
# Move it to IN_REVIEW
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Move it to ACTION_NEEDED
|
# Move it to ACTION_NEEDED
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.ACTION_NEEDED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.ACTION_NEEDED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
# Test Submitted Status Again from in ACTION_NEEDED, no new email should be sent
|
# Test Submitted Status Again from in ACTION_NEEDED, no new email should be sent
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
def test_save_model_sends_approved_email(self):
|
def test_save_model_sends_approved_email(self):
|
||||||
|
@ -764,24 +764,24 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Test Submitted Status
|
# Test Submitted Status
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 0, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 0, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Test Withdrawn Status
|
# Test Withdrawn Status
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.DOMAIN_PURPOSE,
|
DomainRequest.RejectionReasons.DOMAIN_PURPOSE,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate("Your .gov domain request has been rejected.", 1, EMAIL)
|
self.assert_email_is_accurate("Your .gov domain request has been rejected.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
# Test Submitted Status Again (No new email should be sent)
|
# Test Submitted Status Again (No new email should be sent)
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
def test_save_model_sends_rejected_email_purpose_not_met(self):
|
def test_save_model_sends_rejected_email_purpose_not_met(self):
|
||||||
|
@ -794,13 +794,13 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason DOMAIN_PURPOSE and test email
|
# Reject for reason DOMAIN_PURPOSE and test email
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.DOMAIN_PURPOSE,
|
DomainRequest.RejectionReasons.DOMAIN_PURPOSE,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your domain request was rejected because the purpose you provided did not meet our \nrequirements.",
|
"Your domain request was rejected because the purpose you provided did not meet our \nrequirements.",
|
||||||
|
@ -810,7 +810,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -824,11 +824,11 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason REQUESTOR and test email including dynamic organization name
|
# Reject for reason REQUESTOR and test email including dynamic organization name
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application, DomainApplication.ApplicationStatus.REJECTED, DomainApplication.RejectionReasons.REQUESTOR
|
application, DomainRequest.ApplicationStatus.REJECTED, DomainRequest.RejectionReasons.REQUESTOR
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your domain request was rejected because we don’t believe you’re eligible to request a \n.gov "
|
"Your domain request was rejected because we don’t believe you’re eligible to request a \n.gov "
|
||||||
|
@ -839,7 +839,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -853,13 +853,13 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason SECOND_DOMAIN_REASONING and test email including dynamic organization name
|
# Reject for reason SECOND_DOMAIN_REASONING and test email including dynamic organization name
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.SECOND_DOMAIN_REASONING,
|
DomainRequest.RejectionReasons.SECOND_DOMAIN_REASONING,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your domain request was rejected because Testorg has a .gov domain.", 0, EMAIL
|
"Your domain request was rejected because Testorg has a .gov domain.", 0, EMAIL
|
||||||
|
@ -867,7 +867,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -881,13 +881,13 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason CONTACTS_OR_ORGANIZATION_LEGITIMACY and test email including dynamic organization name
|
# Reject for reason CONTACTS_OR_ORGANIZATION_LEGITIMACY and test email including dynamic organization name
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY,
|
DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your domain request was rejected because we could not verify the organizational \n"
|
"Your domain request was rejected because we could not verify the organizational \n"
|
||||||
|
@ -898,7 +898,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -912,13 +912,13 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason ORGANIZATION_ELIGIBILITY and test email including dynamic organization name
|
# Reject for reason ORGANIZATION_ELIGIBILITY and test email including dynamic organization name
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.ORGANIZATION_ELIGIBILITY,
|
DomainRequest.RejectionReasons.ORGANIZATION_ELIGIBILITY,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your domain request was rejected because we determined that Testorg is not \neligible for "
|
"Your domain request was rejected because we determined that Testorg is not \neligible for "
|
||||||
|
@ -929,7 +929,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -943,13 +943,13 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name
|
# Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.NAMING_REQUIREMENTS,
|
DomainRequest.RejectionReasons.NAMING_REQUIREMENTS,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your domain request was rejected because it does not meet our naming requirements.", 0, EMAIL
|
"Your domain request was rejected because it does not meet our naming requirements.", 0, EMAIL
|
||||||
|
@ -957,7 +957,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -971,19 +971,19 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name
|
# Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name
|
||||||
self.transition_state_and_send_email(
|
self.transition_state_and_send_email(
|
||||||
application,
|
application,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.OTHER,
|
DomainRequest.RejectionReasons.OTHER,
|
||||||
)
|
)
|
||||||
self.assert_email_is_accurate("Choosing a .gov domain name", 0, EMAIL)
|
self.assert_email_is_accurate("Choosing a .gov domain name", 0, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.APPROVED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
self.assert_email_is_accurate("Congratulations! Your .gov domain request has been approved.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
|
@ -995,15 +995,15 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.APPROVED)
|
||||||
|
|
||||||
# Create a request object with a superuser
|
# Create a request object with a superuser
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
request.user = self.superuser
|
request.user = self.superuser
|
||||||
|
|
||||||
with ExitStack() as stack:
|
with ExitStack() as stack:
|
||||||
stack.enter_context(patch.object(messages, "error"))
|
stack.enter_context(patch.object(messages, "error"))
|
||||||
application.status = DomainApplication.ApplicationStatus.REJECTED
|
application.status = DomainRequest.ApplicationStatus.REJECTED
|
||||||
|
|
||||||
self.admin.save_model(request, application, None, True)
|
self.admin.save_model(request, application, None, True)
|
||||||
|
|
||||||
|
@ -1013,7 +1013,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
)
|
)
|
||||||
|
|
||||||
application.refresh_from_db()
|
application.refresh_from_db()
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.APPROVED)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
|
|
||||||
def test_transition_to_rejected_with_rejection_reason_does_not_trigger_error(self):
|
def test_transition_to_rejected_with_rejection_reason_does_not_trigger_error(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1023,23 +1023,23 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.APPROVED)
|
||||||
|
|
||||||
# Create a request object with a superuser
|
# Create a request object with a superuser
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
request.user = self.superuser
|
request.user = self.superuser
|
||||||
|
|
||||||
with ExitStack() as stack:
|
with ExitStack() as stack:
|
||||||
stack.enter_context(patch.object(messages, "error"))
|
stack.enter_context(patch.object(messages, "error"))
|
||||||
application.status = DomainApplication.ApplicationStatus.REJECTED
|
application.status = DomainRequest.ApplicationStatus.REJECTED
|
||||||
application.rejection_reason = DomainApplication.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY
|
application.rejection_reason = DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY
|
||||||
|
|
||||||
self.admin.save_model(request, application, None, True)
|
self.admin.save_model(request, application, None, True)
|
||||||
|
|
||||||
messages.error.assert_not_called()
|
messages.error.assert_not_called()
|
||||||
|
|
||||||
application.refresh_from_db()
|
application.refresh_from_db()
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.REJECTED)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.REJECTED)
|
||||||
|
|
||||||
def test_save_model_sends_withdrawn_email(self):
|
def test_save_model_sends_withdrawn_email(self):
|
||||||
"""When transitioning to withdrawn on a domain request,
|
"""When transitioning to withdrawn on a domain request,
|
||||||
|
@ -1051,22 +1051,22 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Test Submitted Status
|
# Test Submitted Status
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.WITHDRAWN)
|
||||||
self.assert_email_is_accurate(
|
self.assert_email_is_accurate(
|
||||||
"Your .gov domain request has been withdrawn and will not be reviewed by our team.", 0, EMAIL
|
"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)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 1)
|
||||||
|
|
||||||
# Test Withdrawn Status
|
# Test Withdrawn Status
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.SUBMITTED)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.SUBMITTED)
|
||||||
self.assert_email_is_accurate("We received your .gov domain request.", 1, EMAIL)
|
self.assert_email_is_accurate("We received your .gov domain request.", 1, EMAIL)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 2)
|
||||||
|
|
||||||
# Test Submitted Status Again (No new email should be sent)
|
# Test Submitted Status Again (No new email should be sent)
|
||||||
self.transition_state_and_send_email(application, DomainApplication.ApplicationStatus.WITHDRAWN)
|
self.transition_state_and_send_email(application, DomainRequest.ApplicationStatus.WITHDRAWN)
|
||||||
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
self.assertEqual(len(self.mock_client.EMAILS_SENT), 3)
|
||||||
|
|
||||||
def test_save_model_sets_approved_domain(self):
|
def test_save_model_sets_approved_domain(self):
|
||||||
|
@ -1076,14 +1076,14 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Create a mock request
|
# Create a mock request
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
# Modify the application's property
|
# Modify the application's property
|
||||||
application.status = DomainApplication.ApplicationStatus.APPROVED
|
application.status = DomainRequest.ApplicationStatus.APPROVED
|
||||||
|
|
||||||
# Use the model admin's save_model method
|
# Use the model admin's save_model method
|
||||||
self.admin.save_model(request, application, form=None, change=True)
|
self.admin.save_model(request, application, form=None, change=True)
|
||||||
|
@ -1098,14 +1098,14 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
User.objects.filter(email=EMAIL).delete()
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
# Create a mock request
|
# Create a mock request
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
# Modify the application's property
|
# Modify the application's property
|
||||||
application.status = DomainApplication.ApplicationStatus.INELIGIBLE
|
application.status = DomainRequest.ApplicationStatus.INELIGIBLE
|
||||||
|
|
||||||
# Use the model admin's save_model method
|
# Use the model admin's save_model method
|
||||||
self.admin.save_model(request, application, form=None, change=True)
|
self.admin.save_model(request, application, form=None, change=True)
|
||||||
|
@ -1115,7 +1115,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
|
|
||||||
def test_readonly_when_restricted_creator(self):
|
def test_readonly_when_restricted_creator(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
application.creator.status = User.RESTRICTED
|
application.creator.status = User.RESTRICTED
|
||||||
application.creator.save()
|
application.creator.save()
|
||||||
|
@ -1201,7 +1201,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
def test_saving_when_restricted_creator(self):
|
def test_saving_when_restricted_creator(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create an instance of the model
|
# Create an instance of the model
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
application.creator.status = User.RESTRICTED
|
application.creator.status = User.RESTRICTED
|
||||||
application.creator.save()
|
application.creator.save()
|
||||||
|
@ -1221,19 +1221,19 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Assert that the status has not changed
|
# Assert that the status has not changed
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
def test_change_view_with_restricted_creator(self):
|
def test_change_view_with_restricted_creator(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create an instance of the model
|
# Create an instance of the model
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
application.creator.status = User.RESTRICTED
|
application.creator.status = User.RESTRICTED
|
||||||
application.creator.save()
|
application.creator.save()
|
||||||
|
|
||||||
with patch("django.contrib.messages.warning") as mock_warning:
|
with patch("django.contrib.messages.warning") as mock_warning:
|
||||||
# Create a request object with a superuser
|
# Create a request object with a superuser
|
||||||
request = self.factory.get("/admin/your_app/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.get("/admin/your_app/DomainRequest/{}/change/".format(application.pk))
|
||||||
request.user = self.superuser
|
request.user = self.superuser
|
||||||
|
|
||||||
self.admin.display_restricted_warning(request, application)
|
self.admin.display_restricted_warning(request, application)
|
||||||
|
@ -1253,14 +1253,14 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create an instance of the model
|
# Create an instance of the model
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.APPROVED)
|
||||||
domain = Domain.objects.create(name=application.requested_domain.name)
|
domain = Domain.objects.create(name=application.requested_domain.name)
|
||||||
domain_information = DomainInformation.objects.create(creator=self.superuser, domain=domain)
|
domain_information = DomainInformation.objects.create(creator=self.superuser, domain=domain)
|
||||||
application.approved_domain = domain
|
application.approved_domain = domain
|
||||||
application.save()
|
application.save()
|
||||||
|
|
||||||
# Create a request object with a superuser
|
# Create a request object with a superuser
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
request.user = self.superuser
|
request.user = self.superuser
|
||||||
|
|
||||||
# Define a custom implementation for is_active
|
# Define a custom implementation for is_active
|
||||||
|
@ -1299,38 +1299,38 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
domain_information.refresh_from_db()
|
domain_information.refresh_from_db()
|
||||||
|
|
||||||
def test_error_when_saving_approved_to_in_review_and_domain_is_active(self):
|
def test_error_when_saving_approved_to_in_review_and_domain_is_active(self):
|
||||||
self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.trigger_saving_approved_to_another_state(True, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
def test_error_when_saving_approved_to_action_needed_and_domain_is_active(self):
|
def test_error_when_saving_approved_to_action_needed_and_domain_is_active(self):
|
||||||
self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.ACTION_NEEDED)
|
self.trigger_saving_approved_to_another_state(True, DomainRequest.ApplicationStatus.ACTION_NEEDED)
|
||||||
|
|
||||||
def test_error_when_saving_approved_to_rejected_and_domain_is_active(self):
|
def test_error_when_saving_approved_to_rejected_and_domain_is_active(self):
|
||||||
self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.REJECTED)
|
self.trigger_saving_approved_to_another_state(True, DomainRequest.ApplicationStatus.REJECTED)
|
||||||
|
|
||||||
def test_error_when_saving_approved_to_ineligible_and_domain_is_active(self):
|
def test_error_when_saving_approved_to_ineligible_and_domain_is_active(self):
|
||||||
self.trigger_saving_approved_to_another_state(True, DomainApplication.ApplicationStatus.INELIGIBLE)
|
self.trigger_saving_approved_to_another_state(True, DomainRequest.ApplicationStatus.INELIGIBLE)
|
||||||
|
|
||||||
def test_side_effects_when_saving_approved_to_in_review(self):
|
def test_side_effects_when_saving_approved_to_in_review(self):
|
||||||
self.trigger_saving_approved_to_another_state(False, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.trigger_saving_approved_to_another_state(False, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
|
|
||||||
def test_side_effects_when_saving_approved_to_action_needed(self):
|
def test_side_effects_when_saving_approved_to_action_needed(self):
|
||||||
self.trigger_saving_approved_to_another_state(False, DomainApplication.ApplicationStatus.ACTION_NEEDED)
|
self.trigger_saving_approved_to_another_state(False, DomainRequest.ApplicationStatus.ACTION_NEEDED)
|
||||||
|
|
||||||
def test_side_effects_when_saving_approved_to_rejected(self):
|
def test_side_effects_when_saving_approved_to_rejected(self):
|
||||||
self.trigger_saving_approved_to_another_state(
|
self.trigger_saving_approved_to_another_state(
|
||||||
False,
|
False,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY,
|
DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_side_effects_when_saving_approved_to_ineligible(self):
|
def test_side_effects_when_saving_approved_to_ineligible(self):
|
||||||
self.trigger_saving_approved_to_another_state(False, DomainApplication.ApplicationStatus.INELIGIBLE)
|
self.trigger_saving_approved_to_another_state(False, DomainRequest.ApplicationStatus.INELIGIBLE)
|
||||||
|
|
||||||
def test_has_correct_filters(self):
|
def test_has_correct_filters(self):
|
||||||
"""
|
"""
|
||||||
This test verifies that DomainApplicationAdmin has the correct filters set up.
|
This test verifies that DomainRequestAdmin has the correct filters set up.
|
||||||
|
|
||||||
It retrieves the current list of filters from DomainApplicationAdmin
|
It retrieves the current list of filters from DomainRequestAdmin
|
||||||
and checks that it matches the expected list of filters.
|
and checks that it matches the expected list of filters.
|
||||||
"""
|
"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
|
@ -1343,32 +1343,32 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
"status",
|
"status",
|
||||||
"organization_type",
|
"organization_type",
|
||||||
"federal_type",
|
"federal_type",
|
||||||
DomainApplicationAdmin.ElectionOfficeFilter,
|
DomainRequestAdmin.ElectionOfficeFilter,
|
||||||
"rejection_reason",
|
"rejection_reason",
|
||||||
DomainApplicationAdmin.InvestigatorFilter,
|
DomainRequestAdmin.InvestigatorFilter,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(readonly_fields, expected_fields)
|
self.assertEqual(readonly_fields, expected_fields)
|
||||||
|
|
||||||
def test_table_sorted_alphabetically(self):
|
def test_table_sorted_alphabetically(self):
|
||||||
"""
|
"""
|
||||||
This test verifies that the DomainApplicationAdmin table is sorted alphabetically
|
This test verifies that the DomainRequestAdmin table is sorted alphabetically
|
||||||
by the 'requested_domain__name' field.
|
by the 'requested_domain__name' field.
|
||||||
|
|
||||||
It creates a list of DomainApplication instances in a non-alphabetical order,
|
It creates a list of DomainRequest instances in a non-alphabetical order,
|
||||||
then retrieves the queryset from the DomainApplicationAdmin and checks
|
then retrieves the queryset from the DomainRequestAdmin and checks
|
||||||
that it matches the expected queryset,
|
that it matches the expected queryset,
|
||||||
which is sorted alphabetically by the 'requested_domain__name' field.
|
which is sorted alphabetically by the 'requested_domain__name' field.
|
||||||
"""
|
"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Creates a list of DomainApplications in scrambled order
|
# Creates a list of DomainRequests in scrambled order
|
||||||
multiple_unalphabetical_domain_objects("application")
|
multiple_unalphabetical_domain_objects("application")
|
||||||
|
|
||||||
request = self.factory.get("/")
|
request = self.factory.get("/")
|
||||||
request.user = self.superuser
|
request.user = self.superuser
|
||||||
|
|
||||||
# Get the expected list of alphabetically sorted DomainApplications
|
# Get the expected list of alphabetically sorted DomainRequests
|
||||||
expected_order = DomainApplication.objects.order_by("requested_domain__name")
|
expected_order = DomainRequest.objects.order_by("requested_domain__name")
|
||||||
|
|
||||||
# Get the returned queryset
|
# Get the returned queryset
|
||||||
queryset = self.admin.get_queryset(request)
|
queryset = self.admin.get_queryset(request)
|
||||||
|
@ -1382,11 +1382,11 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
def test_displays_investigator_filter(self):
|
def test_displays_investigator_filter(self):
|
||||||
"""
|
"""
|
||||||
This test verifies that the investigator filter in the admin interface for
|
This test verifies that the investigator filter in the admin interface for
|
||||||
the DomainApplication model displays correctly.
|
the DomainRequest model displays correctly.
|
||||||
|
|
||||||
It creates two DomainApplication instances, each with a different investigator.
|
It creates two DomainRequest instances, each with a different investigator.
|
||||||
It then simulates a staff user logging in and applying the investigator filter
|
It then simulates a staff user logging in and applying the investigator filter
|
||||||
on the DomainApplication admin page.
|
on the DomainRequest admin page.
|
||||||
|
|
||||||
We then test if the page displays the filter we expect, but we do not test
|
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
|
if we get back the correct response in the table. This is to isolate if
|
||||||
|
@ -1394,8 +1394,8 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a mock DomainApplication object, with a fake investigator
|
# Create a mock DomainRequest object, with a fake investigator
|
||||||
application: DomainApplication = generic_domain_object("application", "SomeGuy")
|
application: DomainRequest = generic_domain_object("application", "SomeGuy")
|
||||||
investigator_user = User.objects.filter(username=application.investigator.username).get()
|
investigator_user = User.objects.filter(username=application.investigator.username).get()
|
||||||
investigator_user.is_staff = True
|
investigator_user.is_staff = True
|
||||||
investigator_user.save()
|
investigator_user.save()
|
||||||
|
@ -1403,7 +1403,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
p = "userpass"
|
p = "userpass"
|
||||||
self.client.login(username="staffuser", password=p)
|
self.client.login(username="staffuser", password=p)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
"/admin/registrar/domainapplication/",
|
"/admin/registrar/DomainRequest/",
|
||||||
{
|
{
|
||||||
"investigator__id__exact": investigator_user.id,
|
"investigator__id__exact": investigator_user.id,
|
||||||
},
|
},
|
||||||
|
@ -1428,25 +1428,25 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
|
|
||||||
def test_investigator_dropdown_displays_only_staff(self):
|
def test_investigator_dropdown_displays_only_staff(self):
|
||||||
"""
|
"""
|
||||||
This test verifies that the dropdown for the 'investigator' field in the DomainApplicationAdmin
|
This test verifies that the dropdown for the 'investigator' field in the DomainRequestAdmin
|
||||||
interface only displays users who are marked as staff.
|
interface only displays users who are marked as staff.
|
||||||
|
|
||||||
It creates two DomainApplication instances, one with an investigator
|
It creates two DomainRequest instances, one with an investigator
|
||||||
who is a staff user and another with an investigator who is not a staff user.
|
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 DomainApplicationAdmin
|
It then retrieves the queryset for the 'investigator' dropdown from DomainRequestAdmin
|
||||||
and checks that it matches the expected queryset, which only includes staff users.
|
and checks that it matches the expected queryset, which only includes staff users.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a mock DomainApplication object, with a fake investigator
|
# Create a mock DomainRequest object, with a fake investigator
|
||||||
application: DomainApplication = generic_domain_object("application", "SomeGuy")
|
application: DomainRequest = generic_domain_object("application", "SomeGuy")
|
||||||
investigator_user = User.objects.filter(username=application.investigator.username).get()
|
investigator_user = User.objects.filter(username=application.investigator.username).get()
|
||||||
investigator_user.is_staff = True
|
investigator_user.is_staff = True
|
||||||
investigator_user.save()
|
investigator_user.save()
|
||||||
|
|
||||||
# Create a mock DomainApplication object, with a user that is not staff
|
# Create a mock DomainRequest object, with a user that is not staff
|
||||||
application_2: DomainApplication = generic_domain_object("application", "SomeOtherGuy")
|
application_2: DomainRequest = generic_domain_object("application", "SomeOtherGuy")
|
||||||
investigator_user_2 = User.objects.filter(username=application_2.investigator.username).get()
|
investigator_user_2 = User.objects.filter(username=application_2.investigator.username).get()
|
||||||
investigator_user_2.is_staff = False
|
investigator_user_2.is_staff = False
|
||||||
investigator_user_2.save()
|
investigator_user_2.save()
|
||||||
|
@ -1454,10 +1454,10 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
p = "userpass"
|
p = "userpass"
|
||||||
self.client.login(username="staffuser", password=p)
|
self.client.login(username="staffuser", password=p)
|
||||||
|
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(application.pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(application.pk))
|
||||||
|
|
||||||
# Get the actual field from the model's meta information
|
# Get the actual field from the model's meta information
|
||||||
investigator_field = DomainApplication._meta.get_field("investigator")
|
investigator_field = DomainRequest._meta.get_field("investigator")
|
||||||
|
|
||||||
# We should only be displaying staff users, in alphabetical order
|
# We should only be displaying staff users, in alphabetical order
|
||||||
sorted_fields = ["first_name", "last_name", "email"]
|
sorted_fields = ["first_name", "last_name", "email"]
|
||||||
|
@ -1466,7 +1466,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
# Grab the current dropdown. We do an API call to autocomplete to get this info.
|
# Grab the current dropdown. We do an API call to autocomplete to get this info.
|
||||||
application_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(
|
user_request = self.factory.post(
|
||||||
"/admin/autocomplete/?app_label=registrar&model_name=domainapplication&field_name=investigator"
|
"/admin/autocomplete/?app_label=registrar&model_name=DomainRequest&field_name=investigator"
|
||||||
)
|
)
|
||||||
user_admin = MyUserAdmin(User, self.site)
|
user_admin = MyUserAdmin(User, self.site)
|
||||||
user_queryset = user_admin.get_search_results(user_request, application_queryset, None)[0]
|
user_queryset = user_admin.get_search_results(user_request, application_queryset, None)[0]
|
||||||
|
@ -1483,19 +1483,19 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
is displayed alphabetically
|
is displayed alphabetically
|
||||||
"""
|
"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a mock DomainApplication object, with a fake investigator
|
# Create a mock DomainRequest object, with a fake investigator
|
||||||
application: DomainApplication = generic_domain_object("application", "SomeGuy")
|
application: DomainRequest = generic_domain_object("application", "SomeGuy")
|
||||||
investigator_user = User.objects.filter(username=application.investigator.username).get()
|
investigator_user = User.objects.filter(username=application.investigator.username).get()
|
||||||
investigator_user.is_staff = True
|
investigator_user.is_staff = True
|
||||||
investigator_user.save()
|
investigator_user.save()
|
||||||
|
|
||||||
application_2: DomainApplication = generic_domain_object("application", "AGuy")
|
application_2: DomainRequest = generic_domain_object("application", "AGuy")
|
||||||
investigator_user_2 = User.objects.filter(username=application_2.investigator.username).get()
|
investigator_user_2 = User.objects.filter(username=application_2.investigator.username).get()
|
||||||
investigator_user_2.first_name = "AGuy"
|
investigator_user_2.first_name = "AGuy"
|
||||||
investigator_user_2.is_staff = True
|
investigator_user_2.is_staff = True
|
||||||
investigator_user_2.save()
|
investigator_user_2.save()
|
||||||
|
|
||||||
application_3: DomainApplication = generic_domain_object("application", "FinalGuy")
|
application_3: DomainRequest = generic_domain_object("application", "FinalGuy")
|
||||||
investigator_user_3 = User.objects.filter(username=application_3.investigator.username).get()
|
investigator_user_3 = User.objects.filter(username=application_3.investigator.username).get()
|
||||||
investigator_user_3.first_name = "FinalGuy"
|
investigator_user_3.first_name = "FinalGuy"
|
||||||
investigator_user_3.is_staff = True
|
investigator_user_3.is_staff = True
|
||||||
|
@ -1522,7 +1522,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
Domain.objects.all().delete()
|
Domain.objects.all().delete()
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
Contact.objects.all().delete()
|
Contact.objects.all().delete()
|
||||||
Website.objects.all().delete()
|
Website.objects.all().delete()
|
||||||
|
@ -1617,7 +1617,7 @@ class TestDomainInformationAdmin(TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Delete all Users, Domains, and UserDomainRoles"""
|
"""Delete all Users, Domains, and UserDomainRoles"""
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
Domain.objects.all().delete()
|
Domain.objects.all().delete()
|
||||||
Contact.objects.all().delete()
|
Contact.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
@ -1635,7 +1635,7 @@ class TestDomainInformationAdmin(TestCase):
|
||||||
"type_of_work",
|
"type_of_work",
|
||||||
"more_organization_information",
|
"more_organization_information",
|
||||||
"domain",
|
"domain",
|
||||||
"domain_application",
|
"domain_request",
|
||||||
"submitter",
|
"submitter",
|
||||||
"no_other_contacts_rationale",
|
"no_other_contacts_rationale",
|
||||||
"anything_else",
|
"anything_else",
|
||||||
|
@ -1809,7 +1809,7 @@ class ListHeaderAdminTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.site = AdminSite()
|
self.site = AdminSite()
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
self.admin = ListHeaderAdmin(model=DomainApplication, admin_site=None)
|
self.admin = ListHeaderAdmin(model=DomainRequest, admin_site=None)
|
||||||
self.client = Client(HTTP_HOST="localhost:8080")
|
self.client = Client(HTTP_HOST="localhost:8080")
|
||||||
self.superuser = create_superuser()
|
self.superuser = create_superuser()
|
||||||
|
|
||||||
|
@ -1824,7 +1824,7 @@ class ListHeaderAdminTest(TestCase):
|
||||||
# which handles CSRF
|
# which handles CSRF
|
||||||
# Follow=True handles the redirect
|
# Follow=True handles the redirect
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
"/admin/registrar/domainapplication/",
|
"/admin/registrar/DomainRequest/",
|
||||||
{
|
{
|
||||||
"status__exact": "started",
|
"status__exact": "started",
|
||||||
"investigator__id__exact": user.id,
|
"investigator__id__exact": user.id,
|
||||||
|
@ -1874,7 +1874,7 @@ class ListHeaderAdminTest(TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# delete any applications too
|
# delete any applications too
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1943,7 +1943,7 @@ class AuditedAdminTest(TestCase):
|
||||||
|
|
||||||
return ordered_list
|
return ordered_list
|
||||||
|
|
||||||
def test_alphabetically_sorted_domain_application_investigator(self):
|
def test_alphabetically_sorted_domain_request_investigator(self):
|
||||||
"""Tests if the investigator field is alphabetically sorted by mimicking
|
"""Tests if the investigator field is alphabetically sorted by mimicking
|
||||||
the call event flow"""
|
the call event flow"""
|
||||||
# Creates multiple domain applications - review status does not matter
|
# Creates multiple domain applications - review status does not matter
|
||||||
|
@ -1951,16 +1951,16 @@ class AuditedAdminTest(TestCase):
|
||||||
|
|
||||||
# Create a mock request
|
# Create a mock request
|
||||||
application_request = self.factory.post(
|
application_request = self.factory.post(
|
||||||
"/admin/registrar/domainapplication/{}/change/".format(applications[0].pk)
|
"/admin/registrar/DomainRequest/{}/change/".format(applications[0].pk)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get the formfield data from the application page
|
# Get the formfield data from the application page
|
||||||
application_admin = AuditedAdmin(DomainApplication, self.site)
|
application_admin = AuditedAdmin(DomainRequest, self.site)
|
||||||
field = DomainApplication.investigator.field
|
field = DomainRequest.investigator.field
|
||||||
application_queryset = application_admin.formfield_for_foreignkey(field, application_request).queryset
|
application_queryset = application_admin.formfield_for_foreignkey(field, application_request).queryset
|
||||||
|
|
||||||
request = self.factory.post(
|
request = self.factory.post(
|
||||||
"/admin/autocomplete/?app_label=registrar&model_name=domainapplication&field_name=investigator"
|
"/admin/autocomplete/?app_label=registrar&model_name=DomainRequest&field_name=investigator"
|
||||||
)
|
)
|
||||||
|
|
||||||
sorted_fields = ["first_name", "last_name", "email"]
|
sorted_fields = ["first_name", "last_name", "email"]
|
||||||
|
@ -1978,23 +1978,23 @@ class AuditedAdminTest(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# This test case should be refactored in general, as it is too overly specific and engineered
|
# This test case should be refactored in general, as it is too overly specific and engineered
|
||||||
def test_alphabetically_sorted_fk_fields_domain_application(self):
|
def test_alphabetically_sorted_fk_fields_domain_request(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
tested_fields = [
|
tested_fields = [
|
||||||
DomainApplication.authorizing_official.field,
|
DomainRequest.authorizing_official.field,
|
||||||
DomainApplication.submitter.field,
|
DomainRequest.submitter.field,
|
||||||
# DomainApplication.investigator.field,
|
# DomainRequest.investigator.field,
|
||||||
DomainApplication.creator.field,
|
DomainRequest.creator.field,
|
||||||
DomainApplication.requested_domain.field,
|
DomainRequest.requested_domain.field,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Creates multiple domain applications - review status does not matter
|
# Creates multiple domain applications - review status does not matter
|
||||||
applications = multiple_unalphabetical_domain_objects("application")
|
applications = multiple_unalphabetical_domain_objects("application")
|
||||||
|
|
||||||
# Create a mock request
|
# Create a mock request
|
||||||
request = self.factory.post("/admin/registrar/domainapplication/{}/change/".format(applications[0].pk))
|
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(applications[0].pk))
|
||||||
|
|
||||||
model_admin = AuditedAdmin(DomainApplication, self.site)
|
model_admin = AuditedAdmin(DomainRequest, self.site)
|
||||||
|
|
||||||
sorted_fields = []
|
sorted_fields = []
|
||||||
# Typically we wouldn't want two nested for fields,
|
# Typically we wouldn't want two nested for fields,
|
||||||
|
@ -2002,7 +2002,7 @@ class AuditedAdminTest(TestCase):
|
||||||
# For test case purposes, this should be performant.
|
# For test case purposes, this should be performant.
|
||||||
for field in tested_fields:
|
for field in tested_fields:
|
||||||
with self.subTest(field=field):
|
with self.subTest(field=field):
|
||||||
isNamefield: bool = field == DomainApplication.requested_domain.field
|
isNamefield: bool = field == DomainRequest.requested_domain.field
|
||||||
if isNamefield:
|
if isNamefield:
|
||||||
sorted_fields = ["name"]
|
sorted_fields = ["name"]
|
||||||
else:
|
else:
|
||||||
|
@ -2043,7 +2043,7 @@ class AuditedAdminTest(TestCase):
|
||||||
DomainInformation.submitter.field,
|
DomainInformation.submitter.field,
|
||||||
# DomainInformation.creator.field,
|
# DomainInformation.creator.field,
|
||||||
(DomainInformation.domain.field, ["name"]),
|
(DomainInformation.domain.field, ["name"]),
|
||||||
(DomainInformation.domain_application.field, ["requested_domain__name"]),
|
(DomainInformation.domain_request.field, ["requested_domain__name"]),
|
||||||
]
|
]
|
||||||
# Creates multiple domain applications - review status does not matter
|
# Creates multiple domain applications - review status does not matter
|
||||||
applications = multiple_unalphabetical_domain_objects("information")
|
applications = multiple_unalphabetical_domain_objects("information")
|
||||||
|
@ -2083,7 +2083,7 @@ class AuditedAdminTest(TestCase):
|
||||||
last = obj.last_name
|
last = obj.last_name
|
||||||
elif field_obj == DomainInformation.domain.field:
|
elif field_obj == DomainInformation.domain.field:
|
||||||
first = obj.name
|
first = obj.name
|
||||||
elif field_obj == DomainInformation.domain_application.field:
|
elif field_obj == DomainInformation.domain_request.field:
|
||||||
first = obj.requested_domain.name
|
first = obj.requested_domain.name
|
||||||
|
|
||||||
name_tuple = self.coerced_fk_field_helper(first, last, field_obj.name, ":")
|
name_tuple = self.coerced_fk_field_helper(first, last, field_obj.name, ":")
|
||||||
|
@ -2156,7 +2156,7 @@ class AuditedAdminTest(TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
DomainInvitation.objects.all().delete()
|
DomainInvitation.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
|
@ -2342,14 +2342,14 @@ class ContactAdminTest(TestCase):
|
||||||
mock_warning.assert_called_once_with(
|
mock_warning.assert_called_once_with(
|
||||||
response.wsgi_request,
|
response.wsgi_request,
|
||||||
"<ul class='messagelist_content-list--unstyled'>"
|
"<ul class='messagelist_content-list--unstyled'>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application1.pk}/change/'>city1.gov</a></li>"
|
f"DomainRequest/{application1.pk}/change/'>city1.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application2.pk}/change/'>city2.gov</a></li>"
|
f"DomainRequest/{application2.pk}/change/'>city2.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application3.pk}/change/'>city3.gov</a></li>"
|
f"DomainRequest/{application3.pk}/change/'>city3.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application4.pk}/change/'>city4.gov</a></li>"
|
f"DomainRequest/{application4.pk}/change/'>city4.gov</a></li>"
|
||||||
"<li>Joined to User: <a href='/admin/registrar/"
|
"<li>Joined to User: <a href='/admin/registrar/"
|
||||||
f"user/{self.staffuser.pk}/change/'>staff@example.com</a></li>"
|
f"user/{self.staffuser.pk}/change/'>staff@example.com</a></li>"
|
||||||
"</ul>",
|
"</ul>",
|
||||||
|
@ -2377,22 +2377,22 @@ class ContactAdminTest(TestCase):
|
||||||
mock_warning.assert_called_once_with(
|
mock_warning.assert_called_once_with(
|
||||||
response.wsgi_request,
|
response.wsgi_request,
|
||||||
"<ul class='messagelist_content-list--unstyled'>"
|
"<ul class='messagelist_content-list--unstyled'>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application1.pk}/change/'>city1.gov</a></li>"
|
f"DomainRequest/{application1.pk}/change/'>city1.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application2.pk}/change/'>city2.gov</a></li>"
|
f"DomainRequest/{application2.pk}/change/'>city2.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application3.pk}/change/'>city3.gov</a></li>"
|
f"DomainRequest/{application3.pk}/change/'>city3.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application4.pk}/change/'>city4.gov</a></li>"
|
f"DomainRequest/{application4.pk}/change/'>city4.gov</a></li>"
|
||||||
"<li>Joined to DomainApplication: <a href='/admin/registrar/"
|
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||||
f"domainapplication/{application5.pk}/change/'>city5.gov</a></li>"
|
f"DomainRequest/{application5.pk}/change/'>city5.gov</a></li>"
|
||||||
"</ul>"
|
"</ul>"
|
||||||
"<p class='font-sans-3xs'>And 1 more...</p>",
|
"<p class='font-sans-3xs'>And 1 more...</p>",
|
||||||
)
|
)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
Contact.objects.all().delete()
|
Contact.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class TestGroups(TestCase):
|
||||||
"view_logentry",
|
"view_logentry",
|
||||||
"change_contact",
|
"change_contact",
|
||||||
"view_domain",
|
"view_domain",
|
||||||
"change_domainapplication",
|
"change_DomainRequest",
|
||||||
"change_domaininformation",
|
"change_domaininformation",
|
||||||
"add_domaininvitation",
|
"add_domaininvitation",
|
||||||
"view_domaininvitation",
|
"view_domaininvitation",
|
||||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
Contact,
|
Contact,
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
User,
|
User,
|
||||||
Website,
|
Website,
|
||||||
|
@ -22,34 +22,34 @@ from django_fsm import TransitionNotAllowed
|
||||||
|
|
||||||
|
|
||||||
# Test comment for push -- will remove
|
# Test comment for push -- will remove
|
||||||
# The DomainApplication submit method has a side effect of sending an email
|
# The DomainRequest submit method has a side effect of sending an email
|
||||||
# with AWS SES, so mock that out in all of these test cases
|
# with AWS SES, so mock that out in all of these test cases
|
||||||
@boto3_mocking.patching
|
@boto3_mocking.patching
|
||||||
class TestDomainApplication(TestCase):
|
class TestDomainRequest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.started_application = completed_application(
|
self.started_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.STARTED, name="started.gov"
|
status=DomainRequest.ApplicationStatus.STARTED, name="started.gov"
|
||||||
)
|
)
|
||||||
self.submitted_application = completed_application(
|
self.submitted_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.SUBMITTED, name="submitted.gov"
|
status=DomainRequest.ApplicationStatus.SUBMITTED, name="submitted.gov"
|
||||||
)
|
)
|
||||||
self.in_review_application = completed_application(
|
self.in_review_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.IN_REVIEW, name="in-review.gov"
|
status=DomainRequest.ApplicationStatus.IN_REVIEW, name="in-review.gov"
|
||||||
)
|
)
|
||||||
self.action_needed_application = completed_application(
|
self.action_needed_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.ACTION_NEEDED, name="action-needed.gov"
|
status=DomainRequest.ApplicationStatus.ACTION_NEEDED, name="action-needed.gov"
|
||||||
)
|
)
|
||||||
self.approved_application = completed_application(
|
self.approved_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.APPROVED, name="approved.gov"
|
status=DomainRequest.ApplicationStatus.APPROVED, name="approved.gov"
|
||||||
)
|
)
|
||||||
self.withdrawn_application = completed_application(
|
self.withdrawn_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.WITHDRAWN, name="withdrawn.gov"
|
status=DomainRequest.ApplicationStatus.WITHDRAWN, name="withdrawn.gov"
|
||||||
)
|
)
|
||||||
self.rejected_application = completed_application(
|
self.rejected_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.REJECTED, name="rejected.gov"
|
status=DomainRequest.ApplicationStatus.REJECTED, name="rejected.gov"
|
||||||
)
|
)
|
||||||
self.ineligible_application = completed_application(
|
self.ineligible_application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.INELIGIBLE, name="ineligible.gov"
|
status=DomainRequest.ApplicationStatus.INELIGIBLE, name="ineligible.gov"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mock_client = MockSESClient()
|
self.mock_client = MockSESClient()
|
||||||
|
@ -64,19 +64,19 @@ class TestDomainApplication(TestCase):
|
||||||
return self.assertRaises(Exception, None, exception_type)
|
return self.assertRaises(Exception, None, exception_type)
|
||||||
|
|
||||||
def test_empty_create_fails(self):
|
def test_empty_create_fails(self):
|
||||||
"""Can't create a completely empty domain application.
|
"""Can't create a completely empty domain request.
|
||||||
NOTE: something about theexception this test raises messes up with the
|
NOTE: something about theexception this test raises messes up with the
|
||||||
atomic block in a custom tearDown method for the parent test class."""
|
atomic block in a custom tearDown method for the parent test class."""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
with self.assertRaisesRegex(IntegrityError, "creator"):
|
with self.assertRaisesRegex(IntegrityError, "creator"):
|
||||||
DomainApplication.objects.create()
|
DomainRequest.objects.create()
|
||||||
|
|
||||||
def test_minimal_create(self):
|
def test_minimal_create(self):
|
||||||
"""Can create with just a creator."""
|
"""Can create with just a creator."""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
user, _ = User.objects.get_or_create(username="testy")
|
user, _ = User.objects.get_or_create(username="testy")
|
||||||
application = DomainApplication.objects.create(creator=user)
|
application = DomainRequest.objects.create(creator=user)
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.STARTED)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.STARTED)
|
||||||
|
|
||||||
def test_full_create(self):
|
def test_full_create(self):
|
||||||
"""Can create with all fields."""
|
"""Can create with all fields."""
|
||||||
|
@ -86,11 +86,11 @@ class TestDomainApplication(TestCase):
|
||||||
com_website, _ = Website.objects.get_or_create(website="igorville.com")
|
com_website, _ = Website.objects.get_or_create(website="igorville.com")
|
||||||
gov_website, _ = Website.objects.get_or_create(website="igorville.gov")
|
gov_website, _ = Website.objects.get_or_create(website="igorville.gov")
|
||||||
domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=user,
|
creator=user,
|
||||||
investigator=user,
|
investigator=user,
|
||||||
organization_type=DomainApplication.OrganizationChoices.FEDERAL,
|
organization_type=DomainRequest.OrganizationChoices.FEDERAL,
|
||||||
federal_type=DomainApplication.BranchChoices.EXECUTIVE,
|
federal_type=DomainRequest.BranchChoices.EXECUTIVE,
|
||||||
is_election_board=False,
|
is_election_board=False,
|
||||||
organization_name="Test",
|
organization_name="Test",
|
||||||
address_line1="100 Main St.",
|
address_line1="100 Main St.",
|
||||||
|
@ -140,7 +140,7 @@ class TestDomainApplication(TestCase):
|
||||||
def test_status_fsm_submit_fail(self):
|
def test_status_fsm_submit_fail(self):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
user, _ = User.objects.get_or_create(username="testy")
|
user, _ = User.objects.get_or_create(username="testy")
|
||||||
application = DomainApplication.objects.create(creator=user)
|
application = DomainRequest.objects.create(creator=user)
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
|
@ -152,7 +152,7 @@ class TestDomainApplication(TestCase):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
user, _ = User.objects.get_or_create(username="testy")
|
user, _ = User.objects.get_or_create(username="testy")
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(creator=user, requested_domain=site)
|
application = DomainRequest.objects.create(creator=user, requested_domain=site)
|
||||||
|
|
||||||
# no submitter email so this emits a log warning
|
# no submitter email so this emits a log warning
|
||||||
|
|
||||||
|
@ -186,37 +186,37 @@ class TestDomainApplication(TestCase):
|
||||||
|
|
||||||
def test_submit_from_withdrawn_sends_email(self):
|
def test_submit_from_withdrawn_sends_email(self):
|
||||||
msg = "Create a withdrawn application and submit it and see if email was sent."
|
msg = "Create a withdrawn application and submit it and see if email was sent."
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.WITHDRAWN)
|
application = completed_application(status=DomainRequest.ApplicationStatus.WITHDRAWN)
|
||||||
self.check_email_sent(application, msg, "submit", 1)
|
self.check_email_sent(application, msg, "submit", 1)
|
||||||
|
|
||||||
def test_submit_from_action_needed_does_not_send_email(self):
|
def test_submit_from_action_needed_does_not_send_email(self):
|
||||||
msg = "Create an application with ACTION_NEEDED status and submit it, check if email was not sent."
|
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)
|
application = completed_application(status=DomainRequest.ApplicationStatus.ACTION_NEEDED)
|
||||||
self.check_email_sent(application, msg, "submit", 0)
|
self.check_email_sent(application, msg, "submit", 0)
|
||||||
|
|
||||||
def test_submit_from_in_review_does_not_send_email(self):
|
def test_submit_from_in_review_does_not_send_email(self):
|
||||||
msg = "Create a withdrawn application and submit it and see if email was sent."
|
msg = "Create a withdrawn application and submit it and see if email was sent."
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.check_email_sent(application, msg, "submit", 0)
|
self.check_email_sent(application, msg, "submit", 0)
|
||||||
|
|
||||||
def test_approve_sends_email(self):
|
def test_approve_sends_email(self):
|
||||||
msg = "Create an application and approve it and see if email was sent."
|
msg = "Create an application and approve it and see if email was sent."
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.check_email_sent(application, msg, "approve", 1)
|
self.check_email_sent(application, msg, "approve", 1)
|
||||||
|
|
||||||
def test_withdraw_sends_email(self):
|
def test_withdraw_sends_email(self):
|
||||||
msg = "Create an application and withdraw it and see if email was sent."
|
msg = "Create an application and withdraw it and see if email was sent."
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.IN_REVIEW)
|
application = completed_application(status=DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.check_email_sent(application, msg, "withdraw", 1)
|
self.check_email_sent(application, msg, "withdraw", 1)
|
||||||
|
|
||||||
def test_reject_sends_email(self):
|
def test_reject_sends_email(self):
|
||||||
msg = "Create an application and reject it and see if email was sent."
|
msg = "Create an application and reject it and see if email was sent."
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.check_email_sent(application, msg, "reject", 1)
|
self.check_email_sent(application, msg, "reject", 1)
|
||||||
|
|
||||||
def test_reject_with_prejudice_does_not_send_email(self):
|
def test_reject_with_prejudice_does_not_send_email(self):
|
||||||
msg = "Create an application and reject it with prejudice and see if email was sent."
|
msg = "Create an application and reject it with prejudice and see if email was sent."
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.check_email_sent(application, msg, "reject_with_prejudice", 0)
|
self.check_email_sent(application, msg, "reject_with_prejudice", 0)
|
||||||
|
|
||||||
def test_submit_transition_allowed(self):
|
def test_submit_transition_allowed(self):
|
||||||
|
@ -580,14 +580,14 @@ class TestDomainApplication(TestCase):
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.REJECTED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.REJECTED)
|
||||||
application.rejection_reason = DomainApplication.RejectionReasons.DOMAIN_PURPOSE
|
application.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
application.approve()
|
application.approve()
|
||||||
|
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.APPROVED)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.APPROVED)
|
||||||
self.assertEqual(application.rejection_reason, None)
|
self.assertEqual(application.rejection_reason, None)
|
||||||
|
|
||||||
def test_in_review_from_rejected_clears_rejection_reason(self):
|
def test_in_review_from_rejected_clears_rejection_reason(self):
|
||||||
|
@ -596,15 +596,15 @@ class TestDomainApplication(TestCase):
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.REJECTED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.REJECTED)
|
||||||
application.domain_is_not_active = True
|
application.domain_is_not_active = True
|
||||||
application.rejection_reason = DomainApplication.RejectionReasons.DOMAIN_PURPOSE
|
application.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
application.in_review()
|
application.in_review()
|
||||||
|
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.IN_REVIEW)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.IN_REVIEW)
|
||||||
self.assertEqual(application.rejection_reason, None)
|
self.assertEqual(application.rejection_reason, None)
|
||||||
|
|
||||||
def test_action_needed_from_rejected_clears_rejection_reason(self):
|
def test_action_needed_from_rejected_clears_rejection_reason(self):
|
||||||
|
@ -613,15 +613,15 @@ class TestDomainApplication(TestCase):
|
||||||
|
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# Create a sample application
|
# Create a sample application
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.REJECTED)
|
application = completed_application(status=DomainRequest.ApplicationStatus.REJECTED)
|
||||||
application.domain_is_not_active = True
|
application.domain_is_not_active = True
|
||||||
application.rejection_reason = DomainApplication.RejectionReasons.DOMAIN_PURPOSE
|
application.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE
|
||||||
|
|
||||||
# Approve
|
# Approve
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
application.action_needed()
|
application.action_needed()
|
||||||
|
|
||||||
self.assertEqual(application.status, DomainApplication.ApplicationStatus.ACTION_NEEDED)
|
self.assertEqual(application.status, DomainRequest.ApplicationStatus.ACTION_NEEDED)
|
||||||
self.assertEqual(application.rejection_reason, None)
|
self.assertEqual(application.rejection_reason, None)
|
||||||
|
|
||||||
def test_has_rationale_returns_true(self):
|
def test_has_rationale_returns_true(self):
|
||||||
|
@ -646,7 +646,7 @@ class TestDomainApplication(TestCase):
|
||||||
"""has_other_contacts() returns false when an application has no other_contacts"""
|
"""has_other_contacts() returns false when an application has no other_contacts"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
application = completed_application(
|
application = completed_application(
|
||||||
status=DomainApplication.ApplicationStatus.STARTED, name="no-others.gov", has_other_contacts=False
|
status=DomainRequest.ApplicationStatus.STARTED, name="no-others.gov", has_other_contacts=False
|
||||||
)
|
)
|
||||||
self.assertEquals(application.has_other_contacts(), False)
|
self.assertEquals(application.has_other_contacts(), False)
|
||||||
|
|
||||||
|
@ -666,12 +666,12 @@ class TestPermissions(TestCase):
|
||||||
def test_approval_creates_role(self):
|
def test_approval_creates_role(self):
|
||||||
draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
||||||
user, _ = User.objects.get_or_create()
|
user, _ = User.objects.get_or_create()
|
||||||
application = DomainApplication.objects.create(creator=user, requested_domain=draft_domain)
|
application = DomainRequest.objects.create(creator=user, requested_domain=draft_domain)
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# skip using the submit method
|
# skip using the submit method
|
||||||
application.status = DomainApplication.ApplicationStatus.SUBMITTED
|
application.status = DomainRequest.ApplicationStatus.SUBMITTED
|
||||||
application.approve()
|
application.approve()
|
||||||
|
|
||||||
# should be a role for this user
|
# should be a role for this user
|
||||||
|
@ -691,7 +691,7 @@ class TestDomainInformation(TestCase):
|
||||||
self.mock_client.EMAILS_SENT.clear()
|
self.mock_client.EMAILS_SENT.clear()
|
||||||
Domain.objects.all().delete()
|
Domain.objects.all().delete()
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
DraftDomain.objects.all().delete()
|
DraftDomain.objects.all().delete()
|
||||||
|
|
||||||
|
@ -700,12 +700,12 @@ class TestDomainInformation(TestCase):
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
||||||
user, _ = User.objects.get_or_create()
|
user, _ = User.objects.get_or_create()
|
||||||
application = DomainApplication.objects.create(creator=user, requested_domain=draft_domain, notes="test notes")
|
application = DomainRequest.objects.create(creator=user, requested_domain=draft_domain, notes="test notes")
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", self.mock_client):
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# skip using the submit method
|
# skip using the submit method
|
||||||
application.status = DomainApplication.ApplicationStatus.SUBMITTED
|
application.status = DomainRequest.ApplicationStatus.SUBMITTED
|
||||||
application.approve()
|
application.approve()
|
||||||
|
|
||||||
# should be an information present for this domain
|
# should be an information present for this domain
|
||||||
|
@ -719,7 +719,7 @@ class TestDomainInformation(TestCase):
|
||||||
creator=user,
|
creator=user,
|
||||||
domain=domain,
|
domain=domain,
|
||||||
notes="test notes",
|
notes="test notes",
|
||||||
domain_application=application,
|
domain_request=application,
|
||||||
).__dict__
|
).__dict__
|
||||||
|
|
||||||
# Test the two records for consistency
|
# 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, _ = Contact.objects.get_or_create(user=self.user)
|
||||||
|
|
||||||
self.contact_as_ao, _ = Contact.objects.get_or_create(email="newguy@igorville.gov")
|
self.contact_as_ao, _ = Contact.objects.get_or_create(email="newguy@igorville.gov")
|
||||||
self.application = DomainApplication.objects.create(creator=self.user, authorizing_official=self.contact_as_ao)
|
self.application = DomainRequest.objects.create(creator=self.user, authorizing_official=self.contact_as_ao)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
Contact.objects.all().delete()
|
Contact.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from django.utils.timezone import make_aware
|
||||||
from registrar.models import Domain, Host, HostIP
|
from registrar.models import Domain, Host, HostIP
|
||||||
|
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from registrar.models.domain_application import DomainApplication
|
from registrar.models.domain_request import DomainRequest
|
||||||
from registrar.models.domain_information import DomainInformation
|
from registrar.models.domain_information import DomainInformation
|
||||||
from registrar.models.draft_domain import DraftDomain
|
from registrar.models.draft_domain import DraftDomain
|
||||||
from registrar.models.public_contact import PublicContact
|
from registrar.models.public_contact import PublicContact
|
||||||
|
@ -311,25 +311,25 @@ class TestDomainCache(MockEppLib):
|
||||||
|
|
||||||
|
|
||||||
class TestDomainCreation(MockEppLib):
|
class TestDomainCreation(MockEppLib):
|
||||||
"""Rule: An approved domain application must result in a domain"""
|
"""Rule: An approved domain request must result in a domain"""
|
||||||
|
|
||||||
@boto3_mocking.patching
|
@boto3_mocking.patching
|
||||||
def test_approved_application_creates_domain_locally(self):
|
def test_approved_application_creates_domain_locally(self):
|
||||||
"""
|
"""
|
||||||
Scenario: Analyst approves a domain application
|
Scenario: Analyst approves a domain request
|
||||||
When the DomainApplication transitions to approved
|
When the DomainRequest transitions to approved
|
||||||
Then a Domain exists in the database with the same `name`
|
Then a Domain exists in the database with the same `name`
|
||||||
But a domain object does not exist in the registry
|
But a domain object does not exist in the registry
|
||||||
"""
|
"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
draft_domain, _ = DraftDomain.objects.get_or_create(name="igorville.gov")
|
||||||
user, _ = User.objects.get_or_create()
|
user, _ = User.objects.get_or_create()
|
||||||
application = DomainApplication.objects.create(creator=user, requested_domain=draft_domain)
|
application = DomainRequest.objects.create(creator=user, requested_domain=draft_domain)
|
||||||
|
|
||||||
mock_client = MockSESClient()
|
mock_client = MockSESClient()
|
||||||
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||||
# skip using the submit method
|
# skip using the submit method
|
||||||
application.status = DomainApplication.ApplicationStatus.SUBMITTED
|
application.status = DomainRequest.ApplicationStatus.SUBMITTED
|
||||||
# transition to approve state
|
# transition to approve state
|
||||||
application.approve()
|
application.approve()
|
||||||
# should have information present for this domain
|
# should have information present for this domain
|
||||||
|
@ -395,7 +395,7 @@ class TestDomainCreation(MockEppLib):
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
def tearDown(self) -> None:
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
PublicContact.objects.all().delete()
|
PublicContact.objects.all().delete()
|
||||||
Domain.objects.all().delete()
|
Domain.objects.all().delete()
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
|
|
|
@ -5,7 +5,7 @@ from .common import MockEppLib # type: ignore
|
||||||
|
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
)
|
)
|
||||||
import logging
|
import logging
|
||||||
|
@ -47,7 +47,7 @@ class TestWithUser(MockEppLib):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# delete any applications too
|
# delete any applications too
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
self.user.delete()
|
self.user.delete()
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django_webtest import WebTest # type: ignore
|
||||||
import boto3_mocking # type: ignore
|
import boto3_mocking # type: ignore
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
DraftDomain,
|
DraftDomain,
|
||||||
Domain,
|
Domain,
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
|
@ -29,8 +29,8 @@ import logging
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationTests(TestWithUser, WebTest):
|
class DomainRequestTests(TestWithUser, WebTest):
|
||||||
"""Webtests for domain application to test filling and submitting."""
|
"""Webtests for domain request to test filling and submitting."""
|
||||||
|
|
||||||
# Doesn't work with CSRF checking
|
# Doesn't work with CSRF checking
|
||||||
# hypothesis is that CSRF_USE_SESSIONS is incompatible with WebTest
|
# hypothesis is that CSRF_USE_SESSIONS is incompatible with WebTest
|
||||||
|
@ -48,7 +48,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
|
|
||||||
def test_application_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'"""
|
"""Tests that user is NOT presented with intro acknowledgement page when accessed through 'edit'"""
|
||||||
completed_application(status=DomainApplication.ApplicationStatus.STARTED, user=self.user)
|
completed_application(status=DomainRequest.ApplicationStatus.STARTED, user=self.user)
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
self.assertContains(home_page, "city.gov")
|
self.assertContains(home_page, "city.gov")
|
||||||
# click the "Edit" link
|
# click the "Edit" link
|
||||||
|
@ -146,7 +146,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
type_result = type_form.submit()
|
type_result = type_form.submit()
|
||||||
# should see results in db
|
# should see results in db
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.organization_type, "federal")
|
self.assertEqual(application.organization_type, "federal")
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the application
|
# the application
|
||||||
|
@ -166,7 +166,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
federal_result = federal_form.submit()
|
federal_result = federal_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.federal_type, "executive")
|
self.assertEqual(application.federal_type, "executive")
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the application
|
# the application
|
||||||
|
@ -193,7 +193,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
org_contact_result = org_contact_form.submit()
|
org_contact_result = org_contact_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.organization_name, "Testorg")
|
self.assertEqual(application.organization_name, "Testorg")
|
||||||
self.assertEqual(application.address_line1, "address 1")
|
self.assertEqual(application.address_line1, "address 1")
|
||||||
self.assertEqual(application.address_line2, "address 2")
|
self.assertEqual(application.address_line2, "address 2")
|
||||||
|
@ -221,7 +221,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
ao_result = ao_form.submit()
|
ao_result = ao_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.authorizing_official.first_name, "Testy ATO")
|
self.assertEqual(application.authorizing_official.first_name, "Testy ATO")
|
||||||
self.assertEqual(application.authorizing_official.last_name, "Tester ATO")
|
self.assertEqual(application.authorizing_official.last_name, "Tester ATO")
|
||||||
self.assertEqual(application.authorizing_official.title, "Chief Tester")
|
self.assertEqual(application.authorizing_official.title, "Chief Tester")
|
||||||
|
@ -243,7 +243,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
current_sites_result = current_sites_form.submit()
|
current_sites_result = current_sites_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
application.current_websites.filter(website="http://www.city.com").count(),
|
application.current_websites.filter(website="http://www.city.com").count(),
|
||||||
1,
|
1,
|
||||||
|
@ -265,7 +265,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
dotgov_result = dotgov_form.submit()
|
dotgov_result = dotgov_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.requested_domain.name, "city.gov")
|
self.assertEqual(application.requested_domain.name, "city.gov")
|
||||||
self.assertEqual(application.alternative_domains.filter(website="city1.gov").count(), 1)
|
self.assertEqual(application.alternative_domains.filter(website="city1.gov").count(), 1)
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
|
@ -285,7 +285,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
purpose_result = purpose_form.submit()
|
purpose_result = purpose_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.purpose, "For all kinds of things.")
|
self.assertEqual(application.purpose, "For all kinds of things.")
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the application
|
# the application
|
||||||
|
@ -309,7 +309,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
your_contact_result = your_contact_form.submit()
|
your_contact_result = your_contact_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.submitter.first_name, "Testy you")
|
self.assertEqual(application.submitter.first_name, "Testy you")
|
||||||
self.assertEqual(application.submitter.last_name, "Tester you")
|
self.assertEqual(application.submitter.last_name, "Tester you")
|
||||||
self.assertEqual(application.submitter.title, "Admin Tester")
|
self.assertEqual(application.submitter.title, "Admin Tester")
|
||||||
|
@ -342,7 +342,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
other_contacts_result = other_contacts_form.submit()
|
other_contacts_result = other_contacts_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
application.other_contacts.filter(
|
application.other_contacts.filter(
|
||||||
first_name="Testy2",
|
first_name="Testy2",
|
||||||
|
@ -371,7 +371,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
anything_else_result = anything_else_form.submit()
|
anything_else_result = anything_else_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.anything_else, "Nothing else.")
|
self.assertEqual(application.anything_else, "Nothing else.")
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the application
|
# the application
|
||||||
|
@ -391,7 +391,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
requirements_result = requirements_form.submit()
|
requirements_result = requirements_form.submit()
|
||||||
# validate that data from this step are being saved
|
# validate that data from this step are being saved
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(application.is_policy_acknowledged, True)
|
self.assertEqual(application.is_policy_acknowledged, True)
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the application
|
# the application
|
||||||
|
@ -663,7 +663,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
|
|
||||||
type_form = type_page.forms[0]
|
type_form = type_page.forms[0]
|
||||||
type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.INTERSTATE
|
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.INTERSTATE
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
type_result = type_form.submit()
|
type_result = type_form.submit()
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
|
|
||||||
type_form = type_page.forms[0]
|
type_form = type_page.forms[0]
|
||||||
type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.SPECIAL_DISTRICT
|
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.SPECIAL_DISTRICT
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
type_result = type_page.forms[0].submit()
|
type_result = type_page.forms[0].submit()
|
||||||
# follow first redirect
|
# follow first redirect
|
||||||
|
@ -803,7 +803,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
# Verify that the no_other_contacts_rationale we saved earlier has been removed from the database
|
# Verify that the no_other_contacts_rationale we saved earlier has been removed from the database
|
||||||
application = DomainApplication.objects.get()
|
application = DomainRequest.objects.get()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
application.other_contacts.count(),
|
application.other_contacts.count(),
|
||||||
1,
|
1,
|
||||||
|
@ -845,7 +845,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
# Verify that the no_other_contacts_rationale we saved earlier has been removed from the database
|
# Verify that the no_other_contacts_rationale we saved earlier has been removed from the database
|
||||||
application = DomainApplication.objects.get()
|
application = DomainRequest.objects.get()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
application.other_contacts.count(),
|
application.other_contacts.count(),
|
||||||
0,
|
0,
|
||||||
|
@ -859,7 +859,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
def test_submitting_no_other_contacts_rationale_removes_reference_other_contacts_when_joined(self):
|
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 application'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"""
|
other contacts references get removed for other contacts that exist and are joined to other objects"""
|
||||||
# Populate the database with a domain application that
|
# Populate the database with a domain request that
|
||||||
# has 1 "other contact" assigned to it
|
# has 1 "other contact" assigned to it
|
||||||
# We'll do it from scratch so we can reuse the other contact
|
# We'll do it from scratch so we can reuse the other contact
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -883,7 +883,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy2@town.com",
|
email="testy2@town.com",
|
||||||
phone="(555) 555 5557",
|
phone="(555) 555 5557",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -929,7 +929,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
# Verify that the no_other_contacts_rationale we saved earlier is no longer associated with the application
|
# Verify that the no_other_contacts_rationale we saved earlier is no longer associated with the application
|
||||||
application = DomainApplication.objects.get()
|
application = DomainRequest.objects.get()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
application.other_contacts.count(),
|
application.other_contacts.count(),
|
||||||
0,
|
0,
|
||||||
|
@ -986,7 +986,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
|
|
||||||
This formset uses the DJANGO DELETE widget. We'll test that by setting 2 contacts on an application,
|
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."""
|
loading the form and marking one contact up for deletion."""
|
||||||
# Populate the database with a domain application that
|
# Populate the database with a domain request that
|
||||||
# has 2 "other contact" assigned to it
|
# has 2 "other contact" assigned to it
|
||||||
# We'll do it from scratch so we can reuse the other contact
|
# We'll do it from scratch so we can reuse the other contact
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -1017,7 +1017,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy3@town.com",
|
email="testy3@town.com",
|
||||||
phone="(201) 555 5557",
|
phone="(201) 555 5557",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1061,13 +1061,13 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
# Verify that the first dude was deleted
|
# Verify that the first dude was deleted
|
||||||
application = DomainApplication.objects.get()
|
application = DomainRequest.objects.get()
|
||||||
self.assertEqual(application.other_contacts.count(), 1)
|
self.assertEqual(application.other_contacts.count(), 1)
|
||||||
self.assertEqual(application.other_contacts.first().first_name, "Testy3")
|
self.assertEqual(application.other_contacts.first().first_name, "Testy3")
|
||||||
|
|
||||||
def test_delete_other_contact_does_not_allow_zero_contacts(self):
|
def test_delete_other_contact_does_not_allow_zero_contacts(self):
|
||||||
"""Delete Other Contact does not allow submission with zero contacts."""
|
"""Delete Other Contact does not allow submission with zero contacts."""
|
||||||
# Populate the database with a domain application that
|
# Populate the database with a domain request that
|
||||||
# has 1 "other contact" assigned to it
|
# has 1 "other contact" assigned to it
|
||||||
# We'll do it from scratch so we can reuse the other contact
|
# We'll do it from scratch so we can reuse the other contact
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -1091,7 +1091,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy2@town.com",
|
email="testy2@town.com",
|
||||||
phone="(201) 555 5557",
|
phone="(201) 555 5557",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1133,7 +1133,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
# Verify that the contact was not deleted
|
# Verify that the contact was not deleted
|
||||||
application = DomainApplication.objects.get()
|
application = DomainRequest.objects.get()
|
||||||
self.assertEqual(application.other_contacts.count(), 1)
|
self.assertEqual(application.other_contacts.count(), 1)
|
||||||
self.assertEqual(application.other_contacts.first().first_name, "Testy2")
|
self.assertEqual(application.other_contacts.first().first_name, "Testy2")
|
||||||
|
|
||||||
|
@ -1144,7 +1144,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
3. then submit,
|
3. then submit,
|
||||||
The forms on page reload shows all the required fields and their errors."""
|
The forms on page reload shows all the required fields and their errors."""
|
||||||
|
|
||||||
# Populate the database with a domain application that
|
# Populate the database with a domain request that
|
||||||
# has 1 "other contact" assigned to it
|
# has 1 "other contact" assigned to it
|
||||||
# We'll do it from scratch so we can reuse the other contact
|
# We'll do it from scratch so we can reuse the other contact
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -1168,7 +1168,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy2@town.com",
|
email="testy2@town.com",
|
||||||
phone="(201) 555 5557",
|
phone="(201) 555 5557",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1220,7 +1220,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
2. then submit,
|
2. then submit,
|
||||||
The application 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 application that
|
# Populate the database with a domain request that
|
||||||
# has 1 "other contact" assigned to it
|
# has 1 "other contact" assigned to it
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -1244,7 +1244,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy2@town.com",
|
email="testy2@town.com",
|
||||||
phone="(201) 555 5557",
|
phone="(201) 555 5557",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1301,7 +1301,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
2. then submit,
|
2. then submit,
|
||||||
The application 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 application that
|
# Populate the database with a domain request that
|
||||||
# has 1 "other contact" assigned to it, the other contact is also
|
# has 1 "other contact" assigned to it, the other contact is also
|
||||||
# the authorizing official initially
|
# the authorizing official initially
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
|
@ -1319,7 +1319,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy-admin@town.com",
|
email="testy-admin@town.com",
|
||||||
phone="(201) 555 5556",
|
phone="(201) 555 5556",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1381,7 +1381,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
2. then submit,
|
2. then submit,
|
||||||
The application 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 application that
|
# Populate the database with a domain request that
|
||||||
# has an authorizing_official (ao)
|
# has an authorizing_official (ao)
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
ao, _ = Contact.objects.get_or_create(
|
ao, _ = Contact.objects.get_or_create(
|
||||||
|
@ -1391,7 +1391,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy@town.com",
|
email="testy@town.com",
|
||||||
phone="(201) 555 5555",
|
phone="(201) 555 5555",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1446,7 +1446,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
2. then submit,
|
2. then submit,
|
||||||
The application 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 application that
|
# Populate the database with a domain request that
|
||||||
# has authorizing official assigned to it, the authorizing offical is also
|
# has authorizing official assigned to it, the authorizing offical is also
|
||||||
# an other contact initially
|
# an other contact initially
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
|
@ -1457,7 +1457,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy@town.com",
|
email="testy@town.com",
|
||||||
phone="(201) 555 5555",
|
phone="(201) 555 5555",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1518,7 +1518,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
2. then submit,
|
2. then submit,
|
||||||
The application 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 application that
|
# Populate the database with a domain request that
|
||||||
# has a submitter
|
# has a submitter
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
you, _ = Contact.objects.get_or_create(
|
you, _ = Contact.objects.get_or_create(
|
||||||
|
@ -1528,7 +1528,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy@town.com",
|
email="testy@town.com",
|
||||||
phone="(201) 555 5555",
|
phone="(201) 555 5555",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1582,7 +1582,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
2. then submit,
|
2. then submit,
|
||||||
The application 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 application that
|
# Populate the database with a domain request that
|
||||||
# has submitter assigned to it, the submitter is also
|
# has submitter assigned to it, the submitter is also
|
||||||
# an other contact initially
|
# an other contact initially
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
|
@ -1593,7 +1593,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy@town.com",
|
email="testy@town.com",
|
||||||
phone="(201) 555 5555",
|
phone="(201) 555 5555",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -1667,7 +1667,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
|
|
||||||
type_form = type_page.forms[0]
|
type_form = type_page.forms[0]
|
||||||
type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.INTERSTATE
|
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.INTERSTATE
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
type_result = type_form.submit()
|
type_result = type_form.submit()
|
||||||
# follow first redirect
|
# follow first redirect
|
||||||
|
@ -1695,7 +1695,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
|
|
||||||
type_form = type_page.forms[0]
|
type_form = type_page.forms[0]
|
||||||
type_form["organization_type-organization_type"] = DomainApplication.OrganizationChoices.TRIBAL
|
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.TRIBAL
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
type_result = type_form.submit()
|
type_result = type_form.submit()
|
||||||
# the tribal government page comes immediately afterwards
|
# the tribal government page comes immediately afterwards
|
||||||
|
@ -1900,7 +1900,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.assertEqual(value, "https://example.com")
|
self.assertEqual(value, "https://example.com")
|
||||||
self.assertIn("current_sites-1-website", current_sites_form.fields)
|
self.assertIn("current_sites-1-website", current_sites_form.fields)
|
||||||
# and it is correctly referenced in the ManyToOne relationship
|
# and it is correctly referenced in the ManyToOne relationship
|
||||||
application = DomainApplication.objects.get() # there's only one
|
application = DomainRequest.objects.get() # there's only one
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
application.current_websites.filter(website="https://example.com").count(),
|
application.current_websites.filter(website="https://example.com").count(),
|
||||||
1,
|
1,
|
||||||
|
@ -1935,7 +1935,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
email="testy2@town.com",
|
email="testy2@town.com",
|
||||||
phone="(555) 555 5557",
|
phone="(555) 555 5557",
|
||||||
)
|
)
|
||||||
application, _ = DomainApplication.objects.get_or_create(
|
application, _ = DomainRequest.objects.get_or_create(
|
||||||
organization_type="federal",
|
organization_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
purpose="Purpose of the site",
|
purpose="Purpose of the site",
|
||||||
|
@ -2068,7 +2068,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.assertContains(review_page, "You are about to submit an incomplete request")
|
self.assertContains(review_page, "You are about to submit an incomplete request")
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.app.set_user(self.user.username)
|
self.app.set_user(self.user.username)
|
||||||
|
@ -2076,7 +2076,7 @@ class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
|
|
||||||
def test_application_status(self):
|
def test_application_status(self):
|
||||||
"""Checking application status page"""
|
"""Checking application status page"""
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user)
|
application = completed_application(status=DomainRequest.ApplicationStatus.SUBMITTED, user=self.user)
|
||||||
application.save()
|
application.save()
|
||||||
|
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
|
@ -2096,7 +2096,7 @@ class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
self.user.status = "ineligible"
|
self.user.status = "ineligible"
|
||||||
self.user.save()
|
self.user.save()
|
||||||
|
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user)
|
application = completed_application(status=DomainRequest.ApplicationStatus.SUBMITTED, user=self.user)
|
||||||
application.save()
|
application.save()
|
||||||
|
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
|
@ -2111,7 +2111,7 @@ class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
|
|
||||||
def test_application_withdraw(self):
|
def test_application_withdraw(self):
|
||||||
"""Checking application status page"""
|
"""Checking application status page"""
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user)
|
application = completed_application(status=DomainRequest.ApplicationStatus.SUBMITTED, user=self.user)
|
||||||
application.save()
|
application.save()
|
||||||
|
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
|
@ -2146,7 +2146,7 @@ class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
"""Can't withdraw applications as a restricted user."""
|
"""Can't withdraw applications as a restricted user."""
|
||||||
self.user.status = User.RESTRICTED
|
self.user.status = User.RESTRICTED
|
||||||
self.user.save()
|
self.user.save()
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user)
|
application = completed_application(status=DomainRequest.ApplicationStatus.SUBMITTED, user=self.user)
|
||||||
application.save()
|
application.save()
|
||||||
|
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
|
@ -2171,7 +2171,7 @@ class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
|
|
||||||
def test_application_status_no_permissions(self):
|
def test_application_status_no_permissions(self):
|
||||||
"""Can't access applications without being the creator."""
|
"""Can't access applications without being the creator."""
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.SUBMITTED, user=self.user)
|
application = completed_application(status=DomainRequest.ApplicationStatus.SUBMITTED, user=self.user)
|
||||||
other_user = User()
|
other_user = User()
|
||||||
other_user.save()
|
other_user.save()
|
||||||
application.creator = other_user
|
application.creator = other_user
|
||||||
|
@ -2191,7 +2191,7 @@ class DomainApplicationTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
def test_approved_application_not_in_active_requests(self):
|
def test_approved_application_not_in_active_requests(self):
|
||||||
"""An approved application is not shown in the Active
|
"""An approved application is not shown in the Active
|
||||||
Requests table on home.html."""
|
Requests table on home.html."""
|
||||||
application = completed_application(status=DomainApplication.ApplicationStatus.APPROVED, user=self.user)
|
application = completed_application(status=DomainRequest.ApplicationStatus.APPROVED, user=self.user)
|
||||||
application.save()
|
application.save()
|
||||||
|
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
|
@ -2222,7 +2222,7 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
def test_unlocked_steps_full_application(self):
|
def test_unlocked_steps_full_application(self):
|
||||||
"""Test when all fields in the application are filled."""
|
"""Test when all fields in the application are filled."""
|
||||||
|
|
||||||
completed_application(status=DomainApplication.ApplicationStatus.STARTED, user=self.user)
|
completed_application(status=DomainRequest.ApplicationStatus.STARTED, user=self.user)
|
||||||
# Make a request to the home page
|
# Make a request to the home page
|
||||||
home_page = self.app.get("/")
|
home_page = self.app.get("/")
|
||||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||||
|
@ -2280,10 +2280,10 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
contact_user, _ = Contact.objects.get_or_create(user=self.user)
|
contact_user, _ = Contact.objects.get_or_create(user=self.user)
|
||||||
|
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
requested_domain=site,
|
requested_domain=site,
|
||||||
status=DomainApplication.ApplicationStatus.WITHDRAWN,
|
status=DomainRequest.ApplicationStatus.WITHDRAWN,
|
||||||
authorizing_official=contact,
|
authorizing_official=contact,
|
||||||
submitter=contact_user,
|
submitter=contact_user,
|
||||||
)
|
)
|
||||||
|
@ -2341,11 +2341,11 @@ class HomeTests(TestWithUser):
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
Contact.objects.all().delete()
|
Contact.objects.all().delete()
|
||||||
|
|
||||||
def test_home_lists_domain_applications(self):
|
def test_home_lists_domain_requests(self):
|
||||||
response = self.client.get("/")
|
response = self.client.get("/")
|
||||||
self.assertNotContains(response, "igorville.gov")
|
self.assertNotContains(response, "igorville.gov")
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(creator=self.user, requested_domain=site)
|
application = DomainRequest.objects.create(creator=self.user, requested_domain=site)
|
||||||
response = self.client.get("/")
|
response = self.client.get("/")
|
||||||
|
|
||||||
# count = 7 because of screenreader content
|
# count = 7 because of screenreader content
|
||||||
|
@ -2464,12 +2464,12 @@ class HomeTests(TestWithUser):
|
||||||
# Check that we have the right text content.
|
# Check that we have the right text content.
|
||||||
self.assertContains(response, unknown_text, count=1)
|
self.assertContains(response, unknown_text, count=1)
|
||||||
|
|
||||||
def test_home_deletes_withdrawn_domain_application(self):
|
def test_home_deletes_withdrawn_domain_request(self):
|
||||||
"""Tests if the user can delete a DomainApplication in the 'withdrawn' status"""
|
"""Tests if the user can delete a DomainRequest in the 'withdrawn' status"""
|
||||||
|
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=self.user, requested_domain=site, status=DomainApplication.ApplicationStatus.WITHDRAWN
|
creator=self.user, requested_domain=site, status=DomainRequest.ApplicationStatus.WITHDRAWN
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure that igorville.gov exists on the page
|
# Ensure that igorville.gov exists on the page
|
||||||
|
@ -2488,12 +2488,12 @@ class HomeTests(TestWithUser):
|
||||||
# clean up
|
# clean up
|
||||||
application.delete()
|
application.delete()
|
||||||
|
|
||||||
def test_home_deletes_started_domain_application(self):
|
def test_home_deletes_started_domain_request(self):
|
||||||
"""Tests if the user can delete a DomainApplication in the 'started' status"""
|
"""Tests if the user can delete a DomainRequest in the 'started' status"""
|
||||||
|
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=self.user, requested_domain=site, status=DomainApplication.ApplicationStatus.STARTED
|
creator=self.user, requested_domain=site, status=DomainRequest.ApplicationStatus.STARTED
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure that igorville.gov exists on the page
|
# Ensure that igorville.gov exists on the page
|
||||||
|
@ -2512,20 +2512,20 @@ class HomeTests(TestWithUser):
|
||||||
# clean up
|
# clean up
|
||||||
application.delete()
|
application.delete()
|
||||||
|
|
||||||
def test_home_doesnt_delete_other_domain_applications(self):
|
def test_home_doesnt_delete_other_domain_requests(self):
|
||||||
"""Tests to ensure the user can't delete Applications not in the status of STARTED or WITHDRAWN"""
|
"""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,
|
# 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.
|
# subTest is appropriate here as otherwise we would need many duplicate tests for the same reason.
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
draft_domain = DraftDomain.objects.create(name="igorville.gov")
|
draft_domain = DraftDomain.objects.create(name="igorville.gov")
|
||||||
for status in DomainApplication.ApplicationStatus:
|
for status in DomainRequest.ApplicationStatus:
|
||||||
if status not in [
|
if status not in [
|
||||||
DomainApplication.ApplicationStatus.STARTED,
|
DomainRequest.ApplicationStatus.STARTED,
|
||||||
DomainApplication.ApplicationStatus.WITHDRAWN,
|
DomainRequest.ApplicationStatus.WITHDRAWN,
|
||||||
]:
|
]:
|
||||||
with self.subTest(status=status):
|
with self.subTest(status=status):
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=self.user, requested_domain=draft_domain, status=status
|
creator=self.user, requested_domain=draft_domain, status=status
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2537,16 +2537,16 @@ class HomeTests(TestWithUser):
|
||||||
# Check for a 403 error - the end user should not be allowed to do this
|
# Check for a 403 error - the end user should not be allowed to do this
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
desired_application = DomainApplication.objects.filter(requested_domain=draft_domain)
|
desired_application = DomainRequest.objects.filter(requested_domain=draft_domain)
|
||||||
|
|
||||||
# Make sure the DomainApplication wasn't deleted
|
# Make sure the DomainRequest wasn't deleted
|
||||||
self.assertEqual(desired_application.count(), 1)
|
self.assertEqual(desired_application.count(), 1)
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
application.delete()
|
application.delete()
|
||||||
|
|
||||||
def test_home_deletes_domain_application_and_orphans(self):
|
def test_home_deletes_domain_request_and_orphans(self):
|
||||||
"""Tests if delete for DomainApplication deletes orphaned Contact objects"""
|
"""Tests if delete for DomainRequest deletes orphaned Contact objects"""
|
||||||
|
|
||||||
# Create the site and contacts to delete (orphaned)
|
# Create the site and contacts to delete (orphaned)
|
||||||
contact = Contact.objects.create(
|
contact = Contact.objects.create(
|
||||||
|
@ -2568,10 +2568,10 @@ class HomeTests(TestWithUser):
|
||||||
contact_user, _ = Contact.objects.get_or_create(user=self.user)
|
contact_user, _ = Contact.objects.get_or_create(user=self.user)
|
||||||
|
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
requested_domain=site,
|
requested_domain=site,
|
||||||
status=DomainApplication.ApplicationStatus.WITHDRAWN,
|
status=DomainRequest.ApplicationStatus.WITHDRAWN,
|
||||||
authorizing_official=contact,
|
authorizing_official=contact,
|
||||||
submitter=contact_user,
|
submitter=contact_user,
|
||||||
)
|
)
|
||||||
|
@ -2579,10 +2579,10 @@ class HomeTests(TestWithUser):
|
||||||
|
|
||||||
# Create a second application to attach contacts to
|
# Create a second application to attach contacts to
|
||||||
site_2 = DraftDomain.objects.create(name="teaville.gov")
|
site_2 = DraftDomain.objects.create(name="teaville.gov")
|
||||||
application_2 = DomainApplication.objects.create(
|
application_2 = DomainRequest.objects.create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
requested_domain=site_2,
|
requested_domain=site_2,
|
||||||
status=DomainApplication.ApplicationStatus.STARTED,
|
status=DomainRequest.ApplicationStatus.STARTED,
|
||||||
authorizing_official=contact_2,
|
authorizing_official=contact_2,
|
||||||
submitter=contact_shared,
|
submitter=contact_shared,
|
||||||
)
|
)
|
||||||
|
@ -2616,7 +2616,7 @@ class HomeTests(TestWithUser):
|
||||||
|
|
||||||
self.assertEqual(edge_case, contact_2)
|
self.assertEqual(edge_case, contact_2)
|
||||||
|
|
||||||
def test_home_deletes_domain_application_and_shared_orphans(self):
|
def test_home_deletes_domain_request_and_shared_orphans(self):
|
||||||
"""Test the edge case for an object that will become orphaned after a delete
|
"""Test the edge case for an object that will become orphaned after a delete
|
||||||
(but is not an orphan at the time of deletion)"""
|
(but is not an orphan at the time of deletion)"""
|
||||||
|
|
||||||
|
@ -2640,10 +2640,10 @@ class HomeTests(TestWithUser):
|
||||||
contact_user, _ = Contact.objects.get_or_create(user=self.user)
|
contact_user, _ = Contact.objects.get_or_create(user=self.user)
|
||||||
|
|
||||||
site = DraftDomain.objects.create(name="igorville.gov")
|
site = DraftDomain.objects.create(name="igorville.gov")
|
||||||
application = DomainApplication.objects.create(
|
application = DomainRequest.objects.create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
requested_domain=site,
|
requested_domain=site,
|
||||||
status=DomainApplication.ApplicationStatus.WITHDRAWN,
|
status=DomainRequest.ApplicationStatus.WITHDRAWN,
|
||||||
authorizing_official=contact,
|
authorizing_official=contact,
|
||||||
submitter=contact_user,
|
submitter=contact_user,
|
||||||
)
|
)
|
||||||
|
@ -2651,10 +2651,10 @@ class HomeTests(TestWithUser):
|
||||||
|
|
||||||
# Create a second application to attach contacts to
|
# Create a second application to attach contacts to
|
||||||
site_2 = DraftDomain.objects.create(name="teaville.gov")
|
site_2 = DraftDomain.objects.create(name="teaville.gov")
|
||||||
application_2 = DomainApplication.objects.create(
|
application_2 = DomainRequest.objects.create(
|
||||||
creator=self.user,
|
creator=self.user,
|
||||||
requested_domain=site_2,
|
requested_domain=site_2,
|
||||||
status=DomainApplication.ApplicationStatus.STARTED,
|
status=DomainRequest.ApplicationStatus.STARTED,
|
||||||
authorizing_official=contact_2,
|
authorizing_official=contact_2,
|
||||||
submitter=contact_shared,
|
submitter=contact_shared,
|
||||||
)
|
)
|
||||||
|
@ -2679,7 +2679,7 @@ class HomeTests(TestWithUser):
|
||||||
"You’re about to start your .gov domain request.",
|
"You’re about to start your .gov domain request.",
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_domain_application_form_with_ineligible_user(self):
|
def test_domain_request_form_with_ineligible_user(self):
|
||||||
"""Application form not accessible for an ineligible user.
|
"""Application form not accessible for an ineligible user.
|
||||||
This test should be solid enough since all application wizard
|
This test should be solid enough since all application wizard
|
||||||
views share the same permissions class"""
|
views share the same permissions class"""
|
||||||
|
|
|
@ -21,7 +21,7 @@ from registrar.utility.errors import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
Domain,
|
Domain,
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
DomainInvitation,
|
DomainInvitation,
|
||||||
|
@ -120,7 +120,7 @@ class TestWithDomainPermissions(TestWithUser):
|
||||||
UserDomainRole.objects.all().delete()
|
UserDomainRole.objects.all().delete()
|
||||||
if hasattr(self.domain, "contacts"):
|
if hasattr(self.domain, "contacts"):
|
||||||
self.domain.contacts.all().delete()
|
self.domain.contacts.all().delete()
|
||||||
DomainApplication.objects.all().delete()
|
DomainRequest.objects.all().delete()
|
||||||
DomainInformation.objects.all().delete()
|
DomainInformation.objects.all().delete()
|
||||||
PublicContact.objects.all().delete()
|
PublicContact.objects.all().delete()
|
||||||
HostIP.objects.all().delete()
|
HostIP.objects.all().delete()
|
||||||
|
@ -311,7 +311,7 @@ class TestDomainDetail(TestDomainOverview):
|
||||||
|
|
||||||
def test_domain_detail_with_no_information_or_application(self):
|
def test_domain_detail_with_no_information_or_application(self):
|
||||||
"""Test that domain management page returns 200 and displays error
|
"""Test that domain management page returns 200 and displays error
|
||||||
when no domain information or domain application exist"""
|
when no domain information or domain request exist"""
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
# have to use staff user for this test
|
# have to use staff user for this test
|
||||||
staff_user = create_user()
|
staff_user = create_user()
|
||||||
|
|
|
@ -9,16 +9,16 @@ from django.views.generic import TemplateView
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
|
||||||
from registrar.forms import application_wizard as forms
|
from registrar.forms import application_wizard as forms
|
||||||
from registrar.models import DomainApplication
|
from registrar.models import DomainRequest
|
||||||
from registrar.models.contact import Contact
|
from registrar.models.contact import Contact
|
||||||
from registrar.models.user import User
|
from registrar.models.user import User
|
||||||
from registrar.utility import StrEnum
|
from registrar.utility import StrEnum
|
||||||
from registrar.views.utility import StepsHelper
|
from registrar.views.utility import StepsHelper
|
||||||
from registrar.views.utility.permission_views import DomainApplicationPermissionDeleteView
|
from registrar.views.utility.permission_views import DomainRequestPermissionDeleteView
|
||||||
|
|
||||||
from .utility import (
|
from .utility import (
|
||||||
DomainApplicationPermissionView,
|
DomainRequestPermissionView,
|
||||||
DomainApplicationPermissionWithdrawView,
|
DomainRequestPermissionWithdrawView,
|
||||||
ApplicationWizardPermissionView,
|
ApplicationWizardPermissionView,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
"""
|
"""
|
||||||
A common set of methods and configuration.
|
A common set of methods and configuration.
|
||||||
|
|
||||||
The registrar's domain application is several pages of "steps".
|
The registrar's domain request is several pages of "steps".
|
||||||
Together, these steps constitute a "wizard".
|
Together, these steps constitute a "wizard".
|
||||||
|
|
||||||
This base class sets up a shared state (stored in the user's session)
|
This base class sets up a shared state (stored in the user's session)
|
||||||
|
@ -111,7 +111,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
self._application = None # for caching
|
self._application = None # for caching
|
||||||
|
|
||||||
def has_pk(self):
|
def has_pk(self):
|
||||||
"""Does this wizard know about a DomainApplication database record?"""
|
"""Does this wizard know about a DomainRequest database record?"""
|
||||||
return "application_id" in self.storage
|
return "application_id" in self.storage
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -122,9 +122,9 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
return "wizard_application"
|
return "wizard_application"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def application(self) -> DomainApplication:
|
def application(self) -> DomainRequest:
|
||||||
"""
|
"""
|
||||||
Attempt to match the current wizard with a DomainApplication.
|
Attempt to match the current wizard with a DomainRequest.
|
||||||
|
|
||||||
Will create an application if none exists.
|
Will create an application if none exists.
|
||||||
"""
|
"""
|
||||||
|
@ -142,15 +142,15 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
if self.has_pk():
|
if self.has_pk():
|
||||||
id = self.storage["application_id"]
|
id = self.storage["application_id"]
|
||||||
try:
|
try:
|
||||||
self._application = DomainApplication.objects.get(
|
self._application = DomainRequest.objects.get(
|
||||||
creator=creator,
|
creator=creator,
|
||||||
pk=id,
|
pk=id,
|
||||||
)
|
)
|
||||||
return self._application
|
return self._application
|
||||||
except DomainApplication.DoesNotExist:
|
except DomainRequest.DoesNotExist:
|
||||||
logger.debug("Application id %s did not have a DomainApplication" % id)
|
logger.debug("Application id %s did not have a DomainRequest" % id)
|
||||||
|
|
||||||
self._application = DomainApplication.objects.create(creator=self.request.user)
|
self._application = DomainRequest.objects.create(creator=self.request.user)
|
||||||
|
|
||||||
self.storage["application_id"] = self._application.id
|
self.storage["application_id"] = self._application.id
|
||||||
return self._application
|
return self._application
|
||||||
|
@ -236,7 +236,7 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
context["forms"] = self.get_forms()
|
context["forms"] = self.get_forms()
|
||||||
|
|
||||||
# if pending requests exist and user does not have approved domains,
|
# if pending requests exist and user does not have approved domains,
|
||||||
# present message that domain application cannot be submitted
|
# present message that domain request cannot be submitted
|
||||||
pending_requests = self.pending_requests()
|
pending_requests = self.pending_requests()
|
||||||
if len(pending_requests) > 0:
|
if len(pending_requests) > 0:
|
||||||
message_header = "You cannot submit this request yet"
|
message_header = "You cannot submit this request yet"
|
||||||
|
@ -310,8 +310,8 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
|
|
||||||
def approved_applications_exist(self):
|
def approved_applications_exist(self):
|
||||||
"""Checks if user is creator of applications with ApplicationStatus.APPROVED status"""
|
"""Checks if user is creator of applications with ApplicationStatus.APPROVED status"""
|
||||||
approved_application_count = DomainApplication.objects.filter(
|
approved_application_count = DomainRequest.objects.filter(
|
||||||
creator=self.request.user, status=DomainApplication.ApplicationStatus.APPROVED
|
creator=self.request.user, status=DomainRequest.ApplicationStatus.APPROVED
|
||||||
).count()
|
).count()
|
||||||
return approved_application_count > 0
|
return approved_application_count > 0
|
||||||
|
|
||||||
|
@ -326,14 +326,14 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
"""Returns a List of user's applications with one of the following states:
|
"""Returns a List of user's applications with one of the following states:
|
||||||
ApplicationStatus.SUBMITTED, ApplicationStatus.IN_REVIEW, ApplicationStatus.ACTION_NEEDED"""
|
ApplicationStatus.SUBMITTED, ApplicationStatus.IN_REVIEW, ApplicationStatus.ACTION_NEEDED"""
|
||||||
# if the current application has ApplicationStatus.ACTION_NEEDED status, this check should not be performed
|
# if the current application has ApplicationStatus.ACTION_NEEDED status, this check should not be performed
|
||||||
if self.application.status == DomainApplication.ApplicationStatus.ACTION_NEEDED:
|
if self.application.status == DomainRequest.ApplicationStatus.ACTION_NEEDED:
|
||||||
return []
|
return []
|
||||||
check_statuses = [
|
check_statuses = [
|
||||||
DomainApplication.ApplicationStatus.SUBMITTED,
|
DomainRequest.ApplicationStatus.SUBMITTED,
|
||||||
DomainApplication.ApplicationStatus.IN_REVIEW,
|
DomainRequest.ApplicationStatus.IN_REVIEW,
|
||||||
DomainApplication.ApplicationStatus.ACTION_NEEDED,
|
DomainRequest.ApplicationStatus.ACTION_NEEDED,
|
||||||
]
|
]
|
||||||
return DomainApplication.objects.filter(creator=self.request.user, status__in=check_statuses)
|
return DomainRequest.objects.filter(creator=self.request.user, status__in=check_statuses)
|
||||||
|
|
||||||
def db_check_for_unlocking_steps(self):
|
def db_check_for_unlocking_steps(self):
|
||||||
"""Helper for get_context_data
|
"""Helper for get_context_data
|
||||||
|
@ -635,21 +635,21 @@ class Finished(ApplicationWizard):
|
||||||
return render(self.request, self.template_name, context)
|
return render(self.request, self.template_name, context)
|
||||||
|
|
||||||
|
|
||||||
class ApplicationStatus(DomainApplicationPermissionView):
|
class ApplicationStatus(DomainRequestPermissionView):
|
||||||
template_name = "application_status.html"
|
template_name = "application_status.html"
|
||||||
|
|
||||||
|
|
||||||
class ApplicationWithdrawConfirmation(DomainApplicationPermissionWithdrawView):
|
class ApplicationWithdrawConfirmation(DomainRequestPermissionWithdrawView):
|
||||||
"""This page will ask user to confirm if they want to withdraw
|
"""This page will ask user to confirm if they want to withdraw
|
||||||
|
|
||||||
The DomainApplicationPermissionView restricts access so that only the
|
The DomainRequestPermissionView restricts access so that only the
|
||||||
`creator` of the application may withdraw it.
|
`creator` of the application may withdraw it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
template_name = "application_withdraw_confirmation.html"
|
template_name = "application_withdraw_confirmation.html"
|
||||||
|
|
||||||
|
|
||||||
class ApplicationWithdrawn(DomainApplicationPermissionWithdrawView):
|
class ApplicationWithdrawn(DomainRequestPermissionWithdrawView):
|
||||||
# this view renders no template
|
# this view renders no template
|
||||||
template_name = ""
|
template_name = ""
|
||||||
|
|
||||||
|
@ -659,16 +659,16 @@ class ApplicationWithdrawn(DomainApplicationPermissionWithdrawView):
|
||||||
If user click on withdraw confirm button, this view updates the status
|
If user click on withdraw confirm button, this view updates the status
|
||||||
to withdraw and send back to homepage.
|
to withdraw and send back to homepage.
|
||||||
"""
|
"""
|
||||||
application = DomainApplication.objects.get(id=self.kwargs["pk"])
|
application = DomainRequest.objects.get(id=self.kwargs["pk"])
|
||||||
application.withdraw()
|
application.withdraw()
|
||||||
application.save()
|
application.save()
|
||||||
return HttpResponseRedirect(reverse("home"))
|
return HttpResponseRedirect(reverse("home"))
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView):
|
class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
|
||||||
"""Delete view for home that allows the end user to delete DomainApplications"""
|
"""Delete view for home that allows the end user to delete DomainRequests"""
|
||||||
|
|
||||||
object: DomainApplication # workaround for type mismatch in DeleteView
|
object: DomainRequest # workaround for type mismatch in DeleteView
|
||||||
|
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
"""Custom override for has_permission to exclude all statuses, except WITHDRAWN and STARTED"""
|
"""Custom override for has_permission to exclude all statuses, except WITHDRAWN and STARTED"""
|
||||||
|
@ -677,7 +677,7 @@ class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
status = self.get_object().status
|
status = self.get_object().status
|
||||||
valid_statuses = [DomainApplication.ApplicationStatus.WITHDRAWN, DomainApplication.ApplicationStatus.STARTED]
|
valid_statuses = [DomainRequest.ApplicationStatus.WITHDRAWN, DomainRequest.ApplicationStatus.STARTED]
|
||||||
if status not in valid_statuses:
|
if status not in valid_statuses:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -689,10 +689,10 @@ class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView):
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
# Grab all orphaned contacts
|
# Grab all orphaned contacts
|
||||||
application: DomainApplication = self.get_object()
|
application: DomainRequest = self.get_object()
|
||||||
contacts_to_delete, duplicates = self._get_orphaned_contacts(application)
|
contacts_to_delete, duplicates = self._get_orphaned_contacts(application)
|
||||||
|
|
||||||
# Delete the DomainApplication
|
# Delete the DomainRequest
|
||||||
response = super().post(request, *args, **kwargs)
|
response = super().post(request, *args, **kwargs)
|
||||||
|
|
||||||
# Delete orphaned contacts - but only for if they are not associated with a user
|
# Delete orphaned contacts - but only for if they are not associated with a user
|
||||||
|
@ -707,16 +707,16 @@ class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView):
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def _get_orphaned_contacts(self, application: DomainApplication, check_db=False):
|
def _get_orphaned_contacts(self, application: DomainRequest, check_db=False):
|
||||||
"""
|
"""
|
||||||
Collects all orphaned contacts associated with a given DomainApplication object.
|
Collects all orphaned contacts associated with a given DomainRequest object.
|
||||||
|
|
||||||
An orphaned contact is defined as a contact that is associated with the application,
|
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,
|
but not with any other application. This includes the authorizing official, the submitter,
|
||||||
and any other contacts linked to the application.
|
and any other contacts linked to the application.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
application (DomainApplication): The DomainApplication object for which to find orphaned contacts.
|
application (DomainRequest): The DomainRequest 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.
|
check_db (bool, optional): A flag indicating whether to check the database for the existence of the contacts.
|
||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ class DomainApplicationDeleteView(DomainApplicationPermissionDeleteView):
|
||||||
"""
|
"""
|
||||||
contacts_to_delete = []
|
contacts_to_delete = []
|
||||||
|
|
||||||
# Get each contact object on the DomainApplication object
|
# Get each contact object on the DomainRequest object
|
||||||
ao = application.authorizing_official
|
ao = application.authorizing_official
|
||||||
submitter = application.submitter
|
submitter = application.submitter
|
||||||
other_contacts = list(application.other_contacts.all())
|
other_contacts = list(application.other_contacts.all())
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
from registrar.models import DomainApplication, Domain, UserDomainRole
|
from registrar.models import DomainRequest, Domain, UserDomainRole
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
|
@ -10,7 +10,7 @@ def index(request):
|
||||||
# Get all domain applications the user has access to
|
# Get all domain applications the user has access to
|
||||||
applications, deletable_applications = _get_applications(request)
|
applications, deletable_applications = _get_applications(request)
|
||||||
|
|
||||||
context["domain_applications"] = applications
|
context["domain_requests"] = applications
|
||||||
|
|
||||||
# Get all domains the user has access to
|
# Get all domains the user has access to
|
||||||
domains = _get_domains(request)
|
domains = _get_domains(request)
|
||||||
|
@ -35,19 +35,19 @@ def index(request):
|
||||||
|
|
||||||
def _get_applications(request):
|
def _get_applications(request):
|
||||||
"""Given the current request,
|
"""Given the current request,
|
||||||
get all DomainApplications that are associated with the UserDomainRole object.
|
get all DomainRequests that are associated with the UserDomainRole object.
|
||||||
|
|
||||||
Returns a tuple of all applications, 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 applications since our
|
# Let's exclude the approved applications since our
|
||||||
# domain_applications context will be used to populate
|
# domain_requests context will be used to populate
|
||||||
# the active applications table
|
# the active applications table
|
||||||
applications = DomainApplication.objects.filter(creator=request.user).exclude(
|
applications = DomainRequest.objects.filter(creator=request.user).exclude(
|
||||||
status=DomainApplication.ApplicationStatus.APPROVED
|
status=DomainRequest.ApplicationStatus.APPROVED
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create a placeholder DraftDomain for each incomplete draft
|
# Create a placeholder DraftDomain for each incomplete draft
|
||||||
valid_statuses = [DomainApplication.ApplicationStatus.STARTED, DomainApplication.ApplicationStatus.WITHDRAWN]
|
valid_statuses = [DomainRequest.ApplicationStatus.STARTED, DomainRequest.ApplicationStatus.WITHDRAWN]
|
||||||
deletable_applications = applications.filter(status__in=valid_statuses)
|
deletable_applications = applications.filter(status__in=valid_statuses)
|
||||||
|
|
||||||
return (applications, deletable_applications)
|
return (applications, deletable_applications)
|
||||||
|
|
|
@ -3,8 +3,8 @@ from .always_404 import always_404
|
||||||
|
|
||||||
from .permission_views import (
|
from .permission_views import (
|
||||||
DomainPermissionView,
|
DomainPermissionView,
|
||||||
DomainApplicationPermissionView,
|
DomainRequestPermissionView,
|
||||||
DomainApplicationPermissionWithdrawView,
|
DomainRequestPermissionWithdrawView,
|
||||||
DomainInvitationPermissionDeleteView,
|
DomainInvitationPermissionDeleteView,
|
||||||
ApplicationWizardPermissionView,
|
ApplicationWizardPermissionView,
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
Domain,
|
Domain,
|
||||||
DomainApplication,
|
DomainRequest,
|
||||||
DomainInvitation,
|
DomainInvitation,
|
||||||
DomainInformation,
|
DomainInformation,
|
||||||
UserDomainRole,
|
UserDomainRole,
|
||||||
|
@ -230,10 +230,10 @@ class DomainPermission(PermissionsLoginMixin):
|
||||||
|
|
||||||
# Analysts may manage domains, when they are in these statuses:
|
# Analysts may manage domains, when they are in these statuses:
|
||||||
valid_domain_statuses = [
|
valid_domain_statuses = [
|
||||||
DomainApplication.ApplicationStatus.APPROVED,
|
DomainRequest.ApplicationStatus.APPROVED,
|
||||||
DomainApplication.ApplicationStatus.IN_REVIEW,
|
DomainRequest.ApplicationStatus.IN_REVIEW,
|
||||||
DomainApplication.ApplicationStatus.REJECTED,
|
DomainRequest.ApplicationStatus.REJECTED,
|
||||||
DomainApplication.ApplicationStatus.ACTION_NEEDED,
|
DomainRequest.ApplicationStatus.ACTION_NEEDED,
|
||||||
# Edge case - some domains do not have
|
# Edge case - some domains do not have
|
||||||
# a status or DomainInformation... aka a status of 'None'.
|
# a status or DomainInformation... aka a status of 'None'.
|
||||||
# It is necessary to access those to correct errors.
|
# It is necessary to access those to correct errors.
|
||||||
|
@ -246,12 +246,12 @@ class DomainPermission(PermissionsLoginMixin):
|
||||||
|
|
||||||
# if no domain information or application exist, the user
|
# if no domain information or application exist, the user
|
||||||
# should be able to manage the domain; however, if domain information
|
# should be able to manage the domain; however, if domain information
|
||||||
# and domain application exist, and application is not in valid status,
|
# and domain request exist, and application is not in valid status,
|
||||||
# user should not be able to manage domain
|
# user should not be able to manage domain
|
||||||
if (
|
if (
|
||||||
requested_domain
|
requested_domain
|
||||||
and requested_domain.domain_application
|
and requested_domain.domain_request
|
||||||
and requested_domain.domain_application.status not in valid_domain_statuses
|
and requested_domain.domain_request.status not in valid_domain_statuses
|
||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -261,12 +261,12 @@ class DomainPermission(PermissionsLoginMixin):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationPermission(PermissionsLoginMixin):
|
class DomainRequestPermission(PermissionsLoginMixin):
|
||||||
"""Permission mixin that redirects to domain application if user
|
"""Permission mixin that redirects to domain request if user
|
||||||
has access, otherwise 403"""
|
has access, otherwise 403"""
|
||||||
|
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
"""Check if this user has access to this domain application.
|
"""Check if this user has access to this domain request.
|
||||||
|
|
||||||
The user is in self.request.user and the domain needs to be looked
|
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"]
|
up from the domain's primary key in self.kwargs["pk"]
|
||||||
|
@ -275,9 +275,9 @@ class DomainApplicationPermission(PermissionsLoginMixin):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# user needs to be the creator of the application
|
# user needs to be the creator of the application
|
||||||
# this query is empty if there isn't a domain application with this
|
# this query is empty if there isn't a domain request with this
|
||||||
# id and this user as creator
|
# id and this user as creator
|
||||||
if not DomainApplication.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists():
|
if not DomainRequest.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -288,7 +288,7 @@ class UserDeleteDomainRolePermission(PermissionsLoginMixin):
|
||||||
has access, otherwise 403"""
|
has access, otherwise 403"""
|
||||||
|
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
"""Check if this user has access to this domain application.
|
"""Check if this user has access to this domain request.
|
||||||
|
|
||||||
The user is in self.request.user and the domain needs to be looked
|
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"]
|
up from the domain's primary key in self.kwargs["pk"]
|
||||||
|
@ -319,19 +319,19 @@ class UserDeleteDomainRolePermission(PermissionsLoginMixin):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationPermissionWithdraw(PermissionsLoginMixin):
|
class DomainRequestPermissionWithdraw(PermissionsLoginMixin):
|
||||||
"""Permission mixin that redirects to withdraw action on domain application
|
"""Permission mixin that redirects to withdraw action on domain request
|
||||||
if user has access, otherwise 403"""
|
if user has access, otherwise 403"""
|
||||||
|
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
"""Check if this user has access to withdraw this domain application."""
|
"""Check if this user has access to withdraw this domain request."""
|
||||||
if not self.request.user.is_authenticated:
|
if not self.request.user.is_authenticated:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# user needs to be the creator of the application
|
# user needs to be the creator of the application
|
||||||
# this query is empty if there isn't a domain application with this
|
# this query is empty if there isn't a domain request with this
|
||||||
# id and this user as creator
|
# id and this user as creator
|
||||||
if not DomainApplication.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists():
|
if not DomainRequest.objects.filter(creator=self.request.user, id=self.kwargs["pk"]).exists():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Restricted users should not be able to withdraw domain requests
|
# Restricted users should not be able to withdraw domain requests
|
||||||
|
@ -342,7 +342,7 @@ class DomainApplicationPermissionWithdraw(PermissionsLoginMixin):
|
||||||
|
|
||||||
|
|
||||||
class ApplicationWizardPermission(PermissionsLoginMixin):
|
class ApplicationWizardPermission(PermissionsLoginMixin):
|
||||||
"""Permission mixin that redirects to start or edit domain application if
|
"""Permission mixin that redirects to start or edit domain request if
|
||||||
user has access, otherwise 403"""
|
user has access, otherwise 403"""
|
||||||
|
|
||||||
def has_permission(self):
|
def has_permission(self):
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
import abc # abstract base class
|
import abc # abstract base class
|
||||||
|
|
||||||
from django.views.generic import DetailView, DeleteView, TemplateView
|
from django.views.generic import DetailView, DeleteView, TemplateView
|
||||||
from registrar.models import Domain, DomainApplication, DomainInvitation
|
from registrar.models import Domain, DomainRequest, DomainInvitation
|
||||||
from registrar.models.user_domain_role import UserDomainRole
|
from registrar.models.user_domain_role import UserDomainRole
|
||||||
|
|
||||||
from .mixins import (
|
from .mixins import (
|
||||||
DomainPermission,
|
DomainPermission,
|
||||||
DomainApplicationPermission,
|
DomainRequestPermission,
|
||||||
DomainApplicationPermissionWithdraw,
|
DomainRequestPermissionWithdraw,
|
||||||
DomainInvitationPermission,
|
DomainInvitationPermission,
|
||||||
ApplicationWizardPermission,
|
ApplicationWizardPermission,
|
||||||
UserDeleteDomainRolePermission,
|
UserDeleteDomainRolePermission,
|
||||||
|
@ -56,7 +56,7 @@ class DomainPermissionView(DomainPermission, DetailView, abc.ABC):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationPermissionView(DomainApplicationPermission, DetailView, abc.ABC):
|
class DomainRequestPermissionView(DomainRequestPermission, DetailView, abc.ABC):
|
||||||
"""Abstract base view for domain applications that enforces permissions
|
"""Abstract base view for domain applications that enforces permissions
|
||||||
|
|
||||||
This abstract view cannot be instantiated. Actual views must specify
|
This abstract view cannot be instantiated. Actual views must specify
|
||||||
|
@ -64,9 +64,9 @@ class DomainApplicationPermissionView(DomainApplicationPermission, DetailView, a
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# DetailView property for what model this is viewing
|
# DetailView property for what model this is viewing
|
||||||
model = DomainApplication
|
model = DomainRequest
|
||||||
# variable name in template context for the model object
|
# variable name in template context for the model object
|
||||||
context_object_name = "domainapplication"
|
context_object_name = "DomainRequest"
|
||||||
|
|
||||||
# Abstract property enforces NotImplementedError on an attribute.
|
# Abstract property enforces NotImplementedError on an attribute.
|
||||||
@property
|
@property
|
||||||
|
@ -75,17 +75,17 @@ class DomainApplicationPermissionView(DomainApplicationPermission, DetailView, a
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationPermissionWithdrawView(DomainApplicationPermissionWithdraw, DetailView, abc.ABC):
|
class DomainRequestPermissionWithdrawView(DomainRequestPermissionWithdraw, DetailView, abc.ABC):
|
||||||
"""Abstract base view for domain application withdraw function
|
"""Abstract base view for domain request withdraw function
|
||||||
|
|
||||||
This abstract view cannot be instantiated. Actual views must specify
|
This abstract view cannot be instantiated. Actual views must specify
|
||||||
`template_name`.
|
`template_name`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# DetailView property for what model this is viewing
|
# DetailView property for what model this is viewing
|
||||||
model = DomainApplication
|
model = DomainRequest
|
||||||
# variable name in template context for the model object
|
# variable name in template context for the model object
|
||||||
context_object_name = "domainapplication"
|
context_object_name = "DomainRequest"
|
||||||
|
|
||||||
# Abstract property enforces NotImplementedError on an attribute.
|
# Abstract property enforces NotImplementedError on an attribute.
|
||||||
@property
|
@property
|
||||||
|
@ -121,11 +121,11 @@ class DomainInvitationPermissionDeleteView(DomainInvitationPermission, DeleteVie
|
||||||
object: DomainInvitation # workaround for type mismatch in DeleteView
|
object: DomainInvitation # workaround for type mismatch in DeleteView
|
||||||
|
|
||||||
|
|
||||||
class DomainApplicationPermissionDeleteView(DomainApplicationPermission, DeleteView, abc.ABC):
|
class DomainRequestPermissionDeleteView(DomainRequestPermission, DeleteView, abc.ABC):
|
||||||
"""Abstract view for deleting a DomainApplication."""
|
"""Abstract view for deleting a DomainRequest."""
|
||||||
|
|
||||||
model = DomainApplication
|
model = DomainRequest
|
||||||
object: DomainApplication
|
object: DomainRequest
|
||||||
|
|
||||||
|
|
||||||
class UserDomainRolePermissionDeleteView(UserDeleteDomainRolePermission, DeleteView, abc.ABC):
|
class UserDomainRolePermissionDeleteView(UserDeleteDomainRolePermission, DeleteView, abc.ABC):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue