mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 09:07:02 +02:00
Auto stash before cherry pick of "Merge pull request #1843 from cisagov/nl/1798-update-email-signature"
First pass of searching remaining instances of "application"
This commit is contained in:
parent
b0ef577869
commit
efe3c4e5de
22 changed files with 238 additions and 238 deletions
|
@ -18,13 +18,13 @@ Deployment_Node(aws, "AWS GovCloud", "Amazon Web Services Region") {
|
|||
Deployment_Node(organization, "get.gov organization") {
|
||||
Deployment_Node(sandbox, "sandbox space") {
|
||||
System_Boundary(dashboard_sandbox, "get.gov registrar") {
|
||||
Container(getgov_app_sandbox, "Registrar Application", "Python, Django", "Delivers static HTML/CSS and forms")
|
||||
Container(getgov_app_sandbox, "Registrar Domain Request", "Python, Django", "Delivers static HTML/CSS and forms")
|
||||
ContainerDb(dashboard_db_sandbox, "sandbox PostgreSQL Database", "AWS RDS", "Stores agency information and reports")
|
||||
}
|
||||
}
|
||||
Deployment_Node(stable, "stable space") {
|
||||
System_Boundary(dashboard_stable, "get.gov registrar") {
|
||||
Container(getgov_app_stable, "Registrar Application", "Python, Django", "Delivers static HTML/CSS and forms")
|
||||
Container(getgov_app_stable, "Registrar Domain Request", "Python, Django", "Delivers static HTML/CSS and forms")
|
||||
ContainerDb(dashboard_db_stable, "stable PostgreSQL Database", "AWS RDS", "Stores agency information and reports")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ allowmixing
|
|||
left to right direction
|
||||
|
||||
class DomainRequest {
|
||||
Application for a domain
|
||||
Request for a domain
|
||||
--
|
||||
creator (User)
|
||||
investigator (User)
|
||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
@ -1056,7 +1056,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
def save_model(self, request, obj, form, change):
|
||||
if obj and obj.creator.status != models.User.RESTRICTED:
|
||||
if change: # Check if the domain request is being edited
|
||||
# Get the original application from the database
|
||||
# Get the original domain request from the database
|
||||
original_obj = models.DomainRequest.objects.get(pk=obj.pk)
|
||||
|
||||
if (
|
||||
|
@ -1065,7 +1065,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
and obj.status != models.DomainRequest.DomainRequestStatus.APPROVED
|
||||
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 domain request to
|
||||
# another status and the related domain is already
|
||||
# active, shortcut the action and throw a friendly
|
||||
# error message. This action would still not go through
|
||||
|
@ -1127,7 +1127,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
|
||||
messages.error(
|
||||
request,
|
||||
"This action is not permitted for applications with a restricted creator.",
|
||||
"This action is not permitted for domain requests with a restricted creator.",
|
||||
)
|
||||
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
|
|
|
@ -55,24 +55,24 @@ urlpatterns = [
|
|||
path("export_data/", ExportData.as_view(), name="admin_export_data"),
|
||||
path("admin/", admin.site.urls),
|
||||
path(
|
||||
"application/<id>/edit/",
|
||||
"domain-request/<id>/edit/",
|
||||
views.DomainRequestWizard.as_view(),
|
||||
name=views.DomainRequestWizard.EDIT_URL_NAME,
|
||||
),
|
||||
path(
|
||||
"application/<int:pk>",
|
||||
"domain-request/<int:pk>",
|
||||
views.DomainRequestStatus.as_view(),
|
||||
name="application-status",
|
||||
name="domain-request-status",
|
||||
),
|
||||
path(
|
||||
"application/<int:pk>/withdraw",
|
||||
views.ApplicationWithdrawConfirmation.as_view(),
|
||||
name="application-withdraw-confirmation",
|
||||
"domain-request/<int:pk>/withdraw",
|
||||
views.domain-requestWithdrawConfirmation.as_view(),
|
||||
name="domain-request-withdraw-confirmation",
|
||||
),
|
||||
path(
|
||||
"application/<int:pk>/withdrawconfirmed",
|
||||
views.ApplicationWithdrawn.as_view(),
|
||||
name="application-withdrawn",
|
||||
"domain-request/<int:pk>/withdrawconfirmed",
|
||||
views.domain-requestWithdrawn.as_view(),
|
||||
name="domain-request-withdrawn",
|
||||
),
|
||||
path("health", views.health, name="health"),
|
||||
path("openid/", include("djangooidc.urls")),
|
||||
|
@ -138,9 +138,9 @@ urlpatterns = [
|
|||
name="invitation-delete",
|
||||
),
|
||||
path(
|
||||
"application/<int:pk>/delete",
|
||||
"domain-request/<int:pk>/delete",
|
||||
views.DomainRequestDeleteView.as_view(http_method_names=["post"]),
|
||||
name="application-delete",
|
||||
name="domain-request-delete",
|
||||
),
|
||||
path(
|
||||
"domain/<int:pk>/users/<int:user_pk>/delete",
|
||||
|
|
|
@ -296,7 +296,7 @@ class OrganizationContactForm(RegistrarForm):
|
|||
federal_agency = self.cleaned_data.get("federal_agency", None)
|
||||
# need the domain request object to know if this is federal
|
||||
if self.domain_request is None:
|
||||
# hmm, no saved application object?, default require the agency
|
||||
# hmm, no saved domain request object?, default require the agency
|
||||
if not federal_agency:
|
||||
# no answer was selected
|
||||
raise forms.ValidationError(
|
||||
|
@ -578,13 +578,13 @@ class OtherContactsYesNoForm(RegistrarForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
"""Extend the initialization of the form from RegistrarForm __init__"""
|
||||
super().__init__(*args, **kwargs)
|
||||
# set the initial value based on attributes of application
|
||||
# set the initial value based on attributes of domain request
|
||||
if self.domain_request and self.domain_request.has_other_contacts():
|
||||
initial_value = True
|
||||
elif self.domain_request and self.domain_request.has_rationale():
|
||||
initial_value = False
|
||||
else:
|
||||
# No pre-selection for new applications
|
||||
# No pre-selection for new domain requests
|
||||
initial_value = None
|
||||
|
||||
self.fields["has_other_contacts"] = forms.TypedChoiceField(
|
||||
|
|
|
@ -163,8 +163,8 @@ class DomainInformation(TimeStampedModel):
|
|||
help_text="Domain to which this information belongs",
|
||||
)
|
||||
|
||||
# This is the contact information provided by the applicant. The
|
||||
# application user who created it is in the `creator` field.
|
||||
# This is the contact information provided by the domain requestor. The
|
||||
# user who created the domain request is in the `creator` field.
|
||||
submitter = models.ForeignKey(
|
||||
"registrar.Contact",
|
||||
null=True,
|
||||
|
|
|
@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class DomainRequest(TimeStampedModel):
|
||||
"""A registrant's application for a new domain."""
|
||||
"""A registrant's domain request for a new domain."""
|
||||
|
||||
# Constants for choice fields
|
||||
class DomainRequestStatus(models.TextChoices):
|
||||
|
@ -384,7 +384,7 @@ class DomainRequest(TimeStampedModel):
|
|||
creator = models.ForeignKey(
|
||||
"registrar.User",
|
||||
on_delete=models.PROTECT,
|
||||
related_name="applications_created",
|
||||
related_name="domain_requests_created",
|
||||
)
|
||||
|
||||
investigator = models.ForeignKey(
|
||||
|
@ -392,7 +392,7 @@ class DomainRequest(TimeStampedModel):
|
|||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="applications_investigating",
|
||||
related_name="domain_requests_investigating",
|
||||
)
|
||||
|
||||
# ##### data fields from the initial form #####
|
||||
|
@ -499,7 +499,7 @@ class DomainRequest(TimeStampedModel):
|
|||
on_delete=models.PROTECT,
|
||||
)
|
||||
|
||||
# "+" means no reverse relation to lookup applications from Website
|
||||
# "+" means no reverse relation to lookup domain requests from Website
|
||||
current_websites = models.ManyToManyField(
|
||||
"registrar.Website",
|
||||
blank=True,
|
||||
|
@ -530,8 +530,8 @@ class DomainRequest(TimeStampedModel):
|
|||
related_name="alternatives+",
|
||||
)
|
||||
|
||||
# This is the contact information provided by the applicant. The
|
||||
# application user who created it is in the `creator` field.
|
||||
# This is the contact information provided by the domain requestor. The
|
||||
# user who created the domain request is in the `creator` field.
|
||||
submitter = models.ForeignKey(
|
||||
"registrar.Contact",
|
||||
null=True,
|
||||
|
@ -571,7 +571,7 @@ class DomainRequest(TimeStampedModel):
|
|||
help_text="Acknowledged .gov acceptable use policy",
|
||||
)
|
||||
|
||||
# submission date records when application is submitted
|
||||
# submission date records when domain request is submitted
|
||||
submission_date = models.DateField(
|
||||
null=True,
|
||||
blank=True,
|
||||
|
@ -590,7 +590,7 @@ class DomainRequest(TimeStampedModel):
|
|||
if self.requested_domain and self.requested_domain.name:
|
||||
return self.requested_domain.name
|
||||
else:
|
||||
return f"{self.status} application created by {self.creator}"
|
||||
return f"{self.status} domain request created by {self.creator}"
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
@ -776,7 +776,7 @@ class DomainRequest(TimeStampedModel):
|
|||
|
||||
This has substantial side-effects because it creates another database
|
||||
object for the approved Domain and makes the user who created the
|
||||
application into an admin on that domain. It also triggers an email
|
||||
domain request into an admin on that domain. It also triggers an email
|
||||
notification."""
|
||||
|
||||
# create the domain
|
||||
|
@ -800,7 +800,7 @@ class DomainRequest(TimeStampedModel):
|
|||
self.rejection_reason = None
|
||||
|
||||
self._send_status_update_email(
|
||||
"application approved",
|
||||
"domain request approved",
|
||||
"emails/status_change_approved.txt",
|
||||
"emails/status_change_approved_subject.txt",
|
||||
send_email,
|
||||
|
@ -856,7 +856,7 @@ class DomainRequest(TimeStampedModel):
|
|||
"""The applicant is a bad actor, reject with prejudice.
|
||||
|
||||
No email As a side effect, but we block the applicant from editing
|
||||
any existing domains/applications and from submitting new aplications.
|
||||
any existing domains/domain requests and from submitting new aplications.
|
||||
We do this by setting an ineligible status on the user, which the
|
||||
permissions classes test against. This will also delete the domain
|
||||
and domain_information (will cascade) when they exist."""
|
||||
|
|
|
@ -16,7 +16,7 @@ class Timer:
|
|||
|
||||
Note that this class does not account for general randomness as more
|
||||
robust libraries do, so there is some tiny amount of latency involved
|
||||
in using this, but it is minimal enough that for most applications it is not
|
||||
in using this, but it is minimal enough that for most domain requests it is not
|
||||
noticable.
|
||||
|
||||
Usage:
|
||||
|
|
|
@ -4,7 +4,7 @@ from .utility.time_stamped_model import TimeStampedModel
|
|||
|
||||
|
||||
class Website(TimeStampedModel):
|
||||
"""Keep domain names in their own table so that applications can refer to
|
||||
"""Keep domain names in their own table so that domain requests can refer to
|
||||
many of them."""
|
||||
|
||||
# domain names have strictly limited lengths, 255 characters is more than
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
{% if step == Step.ORGANIZATION_CONTACT %}
|
||||
{% namespaced_url 'domain_request' step as domain_request_url %}
|
||||
{% if domain_request.organization_name %}
|
||||
{% with title=form_titles|get_item:step value=application %}
|
||||
{% with title=form_titles|get_item:step value=domain_request %}
|
||||
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url address='true' %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<p> <b class="review__step__name">Last updated:</b> {{DomainRequest.updated_at|date:"F j, Y"}}<br>
|
||||
<b class="review__step__name">Request #:</b> {{DomainRequest.id}}</p>
|
||||
<p>{% include "includes/domain_request.html" %}</p>
|
||||
<p><a href="{% url 'application-withdraw-confirmation' pk=DomainRequest.id %}" class="usa-button usa-button--outline withdraw_outline">
|
||||
<p><a href="{% url 'domain-request-withdraw-confirmation' pk=DomainRequest.id %}" class="usa-button usa-button--outline withdraw_outline">
|
||||
Withdraw request</a>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
<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' DomainRequest.id %}" class="usa-button withdraw">Withdraw request</a>
|
||||
<a href="{% url 'application-status' DomainRequest.id %}">Cancel</a></p>
|
||||
<p><a href="{% url 'domain-request-withdrawn' DomainRequest.id %}" class="usa-button withdraw">Withdraw request</a>
|
||||
<a href="{% url 'domain-request-status' DomainRequest.id %}">Cancel</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
<p class="margin-top-4">
|
||||
<a href="{% url 'application:' %}" class="usa-button"
|
||||
<a href="{% url 'domain-request:' %}" class="usa-button"
|
||||
>
|
||||
Start a new domain request
|
||||
</a>
|
||||
|
@ -118,7 +118,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for application in domain_requests %}
|
||||
{% for domain_request in domain_requests %}
|
||||
<tr>
|
||||
<th th scope="row" role="rowheader" data-label="Domain name">
|
||||
{% if domain_request.requested_domain is None %}
|
||||
|
@ -143,7 +143,7 @@
|
|||
{% with date=domain_request.created_at|date:"DATETIME_FORMAT"%}
|
||||
{% with name_default=prefix|add:date|add:" UTC)"%}
|
||||
{% if domain_request.status == domain_request.DomainRequestStatus.STARTED or domain_request.status == domain_request.DomainRequestStatus.ACTION_NEEDED or domain_request.status == domain_request.DomainRequestStatus.WITHDRAWN %}
|
||||
<a href="{% url 'edit-application' domain_request.pk %}">
|
||||
<a href="{% url 'edit-domain-request' domain_request.pk %}">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#edit"></use>
|
||||
</svg>
|
||||
|
@ -153,7 +153,7 @@
|
|||
Edit <span class="usa-sr-only">{{ name_default }}</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="{% url 'application-status' domain_request.pk %}">
|
||||
<a href="{% url 'domain-request-status' domain_request.pk %}">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#settings"></use>
|
||||
</svg>
|
||||
|
@ -198,7 +198,7 @@
|
|||
aria-describedby="Domain will be removed"
|
||||
data-force-action
|
||||
>
|
||||
<form method="POST" action="{% url "application-delete" pk=domain_request.id %}">
|
||||
<form method="POST" action="{% url "domain-request-delete" pk=domain_request.id %}">
|
||||
{% if domain_request.requested_domain is None %}
|
||||
{% if domain_request.created_at %}
|
||||
{% with prefix="(created " %}
|
||||
|
@ -231,7 +231,7 @@
|
|||
></div>
|
||||
{% else %}
|
||||
<p>You haven't requested any domains.</p>
|
||||
<!-- <p><a href="{% url 'application:' %}" class="usa-button">Start a new domain request</a></p> -->
|
||||
<!-- <p><a href="{% url 'domain-request:' %}" class="usa-button">Start a new domain request</a></p> -->
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
|
|
|
@ -423,20 +423,20 @@ class AuditedAdminMockData:
|
|||
"""Creates a dummy domain request object"""
|
||||
domain_request_kwargs = self.dummy_kwarg_boilerplate(self.DOMAIN_REQUEST, item_name, status)
|
||||
domain_request = DomainRequest.objects.get_or_create(**domain_request_kwargs)[0]
|
||||
return application
|
||||
return domain_request
|
||||
|
||||
def create_full_dummy_domain_information(self, item_name, status=DomainRequest.DomainRequestStatus.STARTED):
|
||||
"""Creates a dummy domain information object"""
|
||||
domain_request_kwargs = self.dummy_kwarg_boilerplate(self.INFORMATION, item_name, status)
|
||||
domain_request = DomainInformation.objects.get_or_create(**domain_request_kwargs)[0]
|
||||
return application
|
||||
return domain_request
|
||||
|
||||
def create_full_dummy_domain_invitation(self, item_name, status=DomainRequest.DomainRequestStatus.STARTED):
|
||||
"""Creates a dummy domain invitation object"""
|
||||
domain_request_kwargs = self.dummy_kwarg_boilerplate(self.INVITATION, item_name, status)
|
||||
domain_request = DomainInvitation.objects.get_or_create(**domain_request_kwargs)[0]
|
||||
|
||||
return application
|
||||
return domain_request
|
||||
|
||||
def create_full_dummy_domain_object(
|
||||
self,
|
||||
|
@ -469,7 +469,7 @@ class AuditedAdminMockData:
|
|||
alt = self.dummy_alt(item_name)
|
||||
domain_request.alternative_domains.add(alt)
|
||||
|
||||
return application
|
||||
return domain_request
|
||||
|
||||
|
||||
def mock_user():
|
||||
|
@ -589,22 +589,22 @@ def completed_domain_request(
|
|||
if has_alternative_gov_domain:
|
||||
domain_request.alternative_domains.add(alt)
|
||||
|
||||
return application
|
||||
return domain_request
|
||||
|
||||
|
||||
def multiple_unalphabetical_domain_objects(
|
||||
domain_type=AuditedAdminMockData.DOMAIN_REQUEST,
|
||||
):
|
||||
"""Returns a list of generic domain objects for testing purposes"""
|
||||
applications = []
|
||||
domain_requests = []
|
||||
list_of_letters = list(ascii_uppercase)
|
||||
random.shuffle(list_of_letters)
|
||||
|
||||
mock = AuditedAdminMockData()
|
||||
for object_name in list_of_letters:
|
||||
domain_request = mock.create_full_dummy_domain_object(domain_type, object_name)
|
||||
applications.append(application)
|
||||
return applications
|
||||
domain_requests.append(domain_request)
|
||||
return domain_requests
|
||||
|
||||
|
||||
def generic_domain_object(domain_type, object_name):
|
||||
|
@ -612,7 +612,7 @@ def generic_domain_object(domain_type, object_name):
|
|||
domain_type 'domain_request', 'information', or 'invitation'"""
|
||||
mock = AuditedAdminMockData()
|
||||
domain_request = mock.create_full_dummy_domain_object(domain_type, object_name)
|
||||
return application
|
||||
return domain_request
|
||||
|
||||
|
||||
class MockEppLib(TestCase):
|
||||
|
|
|
@ -244,7 +244,7 @@ class TestDomainAdmin(MockEppLib, WebTest):
|
|||
response = self.client.get("/admin/registrar/domain/")
|
||||
|
||||
# There are 4 template references to Federal (4) plus four references in the table
|
||||
# for our actual application
|
||||
# for our actual domain_request
|
||||
self.assertContains(response, "Federal", count=8)
|
||||
# This may be a bit more robust
|
||||
self.assertContains(response, '<td class="field-organization_type">Federal</td>', count=1)
|
||||
|
@ -441,12 +441,12 @@ class TestDomainAdmin(MockEppLib, WebTest):
|
|||
|
||||
class TestDomainRequestAdminForm(TestCase):
|
||||
def setUp(self):
|
||||
# Create a test application with an initial state of started
|
||||
# Create a test domain request with an initial state of started
|
||||
self.domain_request = completed_domain_request()
|
||||
|
||||
def test_form_choices(self):
|
||||
with less_console_noise():
|
||||
# Create a form instance with the test application
|
||||
# Create a form instance with the test domain request
|
||||
form = DomainRequestAdminForm(instance=self.domain_request)
|
||||
|
||||
# Verify that the form choices match the available transitions for started
|
||||
|
@ -460,7 +460,7 @@ class TestDomainRequestAdminForm(TestCase):
|
|||
|
||||
# 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
|
||||
# application in django admin;
|
||||
# request in django admin;
|
||||
# note that FSM ensures that no domain request exists with invalid status,
|
||||
# so don't need to test for invalid status
|
||||
self.assertEqual(
|
||||
|
@ -473,7 +473,7 @@ class TestDomainRequestAdminForm(TestCase):
|
|||
# Create a form instance with a domain request with ineligible status
|
||||
ineligible_domain_request = DomainRequest(status="ineligible")
|
||||
|
||||
# Attempt to create a form with the ineligible application
|
||||
# Attempt to create a form with the ineligible domain request
|
||||
# The form should not raise an error, but choices should be the
|
||||
# full list of possible choices
|
||||
form = DomainRequestAdminForm(instance=ineligible_domain_request)
|
||||
|
@ -587,7 +587,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
completed_domain_request()
|
||||
response = self.client.get("/admin/registrar/DomainRequest/")
|
||||
# There are 4 template references to Federal (4) plus two references in the table
|
||||
# for our actual application
|
||||
# for our actual domain request
|
||||
self.assertContains(response, "Federal", count=6)
|
||||
# This may be a bit more robust
|
||||
self.assertContains(response, '<td class="field-organization_type">Federal</td>', count=1)
|
||||
|
@ -657,7 +657,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request()
|
||||
|
||||
# Test Submitted Status from started
|
||||
|
@ -714,7 +714,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
|
||||
BCC_EMAIL = settings.DEFAULT_FROM_EMAIL
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request()
|
||||
|
||||
# Test Submitted Status from started
|
||||
|
@ -763,7 +763,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Test Submitted Status
|
||||
|
@ -773,7 +773,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
|
||||
# Test Withdrawn Status
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.DOMAIN_PURPOSE,
|
||||
)
|
||||
|
@ -793,12 +793,12 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason DOMAIN_PURPOSE and test email
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.DOMAIN_PURPOSE,
|
||||
)
|
||||
|
@ -823,7 +823,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason REQUESTOR and test email including dynamic organization name
|
||||
|
@ -852,12 +852,12 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason SECOND_DOMAIN_REASONING and test email including dynamic organization name
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.SECOND_DOMAIN_REASONING,
|
||||
)
|
||||
|
@ -880,12 +880,12 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason CONTACTS_OR_ORGANIZATION_LEGITIMACY and test email including dynamic organization name
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.CONTACTS_OR_ORGANIZATION_LEGITIMACY,
|
||||
)
|
||||
|
@ -911,12 +911,12 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason ORGANIZATION_ELIGIBILITY and test email including dynamic organization name
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.ORGANIZATION_ELIGIBILITY,
|
||||
)
|
||||
|
@ -942,12 +942,12 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.NAMING_REQUIREMENTS,
|
||||
)
|
||||
|
@ -970,12 +970,12 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Reject for reason NAMING_REQUIREMENTS and test email including dynamic organization name
|
||||
self.transition_state_and_send_email(
|
||||
application,
|
||||
domain_request,
|
||||
DomainRequest.DomainRequestStatus.REJECTED,
|
||||
DomainRequest.RejectionReasons.OTHER,
|
||||
)
|
||||
|
@ -1050,7 +1050,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Test Submitted Status
|
||||
|
@ -1075,7 +1075,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Create a mock request
|
||||
|
@ -1097,7 +1097,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
|
||||
# Create a mock request
|
||||
|
@ -1217,7 +1217,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
# Assert that the error message was called with the correct argument
|
||||
mock_error.assert_called_once_with(
|
||||
request,
|
||||
"This action is not permitted for applications with a restricted creator.",
|
||||
"This action is not permitted for domain requests with a restricted creator.",
|
||||
)
|
||||
|
||||
# Assert that the status has not changed
|
||||
|
@ -1395,7 +1395,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
|
||||
with less_console_noise():
|
||||
# Create a mock DomainRequest object, with a fake investigator
|
||||
application: DomainRequest = generic_domain_object("domain_request", "SomeGuy")
|
||||
domain_request: DomainRequest = generic_domain_object("domain_request", "SomeGuy")
|
||||
investigator_user = User.objects.filter(username=domain_request.investigator.username).get()
|
||||
investigator_user.is_staff = True
|
||||
investigator_user.save()
|
||||
|
@ -1440,7 +1440,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
|
||||
with less_console_noise():
|
||||
# Create a mock DomainRequest object, with a fake investigator
|
||||
application: DomainRequest = generic_domain_object("domain_request", "SomeGuy")
|
||||
domain_request: DomainRequest = generic_domain_object("domain_request", "SomeGuy")
|
||||
investigator_user = User.objects.filter(username=domain_request.investigator.username).get()
|
||||
investigator_user.is_staff = True
|
||||
investigator_user.save()
|
||||
|
@ -1484,7 +1484,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
"""
|
||||
with less_console_noise():
|
||||
# Create a mock DomainRequest object, with a fake investigator
|
||||
application: DomainRequest = generic_domain_object("domain_request", "SomeGuy")
|
||||
domain_request: DomainRequest = generic_domain_object("domain_request", "SomeGuy")
|
||||
investigator_user = User.objects.filter(username=domain_request.investigator.username).get()
|
||||
investigator_user.is_staff = True
|
||||
investigator_user.save()
|
||||
|
@ -1872,7 +1872,7 @@ class ListHeaderAdminTest(TestCase):
|
|||
)
|
||||
|
||||
def tearDown(self):
|
||||
# delete any applications too
|
||||
# delete any domain requests too
|
||||
DomainInformation.objects.all().delete()
|
||||
DomainRequest.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
@ -1947,11 +1947,11 @@ class AuditedAdminTest(TestCase):
|
|||
"""Tests if the investigator field is alphabetically sorted by mimicking
|
||||
the call event flow"""
|
||||
# Creates multiple domain requests - review status does not matter
|
||||
applications = multiple_unalphabetical_domain_objects("domain_request")
|
||||
domain_requests = multiple_unalphabetical_domain_objects("domain_request")
|
||||
|
||||
# Create a mock request
|
||||
domain_request_request = self.factory.post(
|
||||
"/admin/registrar/DomainRequest/{}/change/".format(applications[0].pk)
|
||||
"/admin/registrar/DomainRequest/{}/change/".format(domain_requests[0].pk)
|
||||
)
|
||||
|
||||
# Get the formfield data from the domain request page
|
||||
|
@ -1989,10 +1989,10 @@ class AuditedAdminTest(TestCase):
|
|||
]
|
||||
|
||||
# Creates multiple domain requests - review status does not matter
|
||||
applications = multiple_unalphabetical_domain_objects("domain_request")
|
||||
domain_requests = multiple_unalphabetical_domain_objects("domain_request")
|
||||
|
||||
# Create a mock request
|
||||
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(applications[0].pk))
|
||||
request = self.factory.post("/admin/registrar/DomainRequest/{}/change/".format(domain_requests[0].pk))
|
||||
|
||||
model_admin = AuditedAdmin(DomainRequest, self.site)
|
||||
|
||||
|
@ -2046,10 +2046,10 @@ class AuditedAdminTest(TestCase):
|
|||
(DomainInformation.domain_request.field, ["requested_domain__name"]),
|
||||
]
|
||||
# Creates multiple domain requests - review status does not matter
|
||||
applications = multiple_unalphabetical_domain_objects("information")
|
||||
domain_requests = multiple_unalphabetical_domain_objects("information")
|
||||
|
||||
# Create a mock request
|
||||
request = self.factory.post("/admin/registrar/domaininformation/{}/change/".format(applications[0].pk))
|
||||
request = self.factory.post("/admin/registrar/domaininformation/{}/change/".format(domain_requests[0].pk))
|
||||
|
||||
model_admin = AuditedAdmin(DomainInformation, self.site)
|
||||
|
||||
|
@ -2101,10 +2101,10 @@ class AuditedAdminTest(TestCase):
|
|||
tested_fields = [DomainInvitation.domain.field]
|
||||
|
||||
# Creates multiple domain requests - review status does not matter
|
||||
applications = multiple_unalphabetical_domain_objects("invitation")
|
||||
domain_requests = multiple_unalphabetical_domain_objects("invitation")
|
||||
|
||||
# Create a mock request
|
||||
request = self.factory.post("/admin/registrar/domaininvitation/{}/change/".format(applications[0].pk))
|
||||
request = self.factory.post("/admin/registrar/domaininvitation/{}/change/".format(domain_requests[0].pk))
|
||||
|
||||
model_admin = AuditedAdmin(DomainInvitation, self.site)
|
||||
|
||||
|
@ -2328,10 +2328,10 @@ class ContactAdminTest(TestCase):
|
|||
contact, _ = Contact.objects.get_or_create(user=self.staffuser)
|
||||
|
||||
# join it to 4 domain requests. The 5th join will be a user.
|
||||
application1 = completed_domain_request(submitter=contact, name="city1.gov")
|
||||
application2 = completed_domain_request(submitter=contact, name="city2.gov")
|
||||
application3 = completed_domain_request(submitter=contact, name="city3.gov")
|
||||
application4 = completed_domain_request(submitter=contact, name="city4.gov")
|
||||
domain_request1 = completed_domain_request(submitter=contact, name="city1.gov")
|
||||
domain_request2 = completed_domain_request(submitter=contact, name="city2.gov")
|
||||
domain_request3 = completed_domain_request(submitter=contact, name="city3.gov")
|
||||
domain_request4 = completed_domain_request(submitter=contact, name="city4.gov")
|
||||
|
||||
with patch("django.contrib.messages.warning") as mock_warning:
|
||||
# Use the test client to simulate the request
|
||||
|
@ -2343,13 +2343,13 @@ class ContactAdminTest(TestCase):
|
|||
response.wsgi_request,
|
||||
"<ul class='messagelist_content-list--unstyled'>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application1.pk}/change/'>city1.gov</a></li>"
|
||||
f"DomainRequest/{domain_request1.pk}/change/'>city1.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application2.pk}/change/'>city2.gov</a></li>"
|
||||
f"DomainRequest/{domain_request2.pk}/change/'>city2.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application3.pk}/change/'>city3.gov</a></li>"
|
||||
f"DomainRequest/{domain_request3.pk}/change/'>city3.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application4.pk}/change/'>city4.gov</a></li>"
|
||||
f"DomainRequest/{domain_request4.pk}/change/'>city4.gov</a></li>"
|
||||
"<li>Joined to User: <a href='/admin/registrar/"
|
||||
f"user/{self.staffuser.pk}/change/'>staff@example.com</a></li>"
|
||||
"</ul>",
|
||||
|
@ -2363,11 +2363,11 @@ class ContactAdminTest(TestCase):
|
|||
# Create an instance of the model
|
||||
# join it to 5 domain requests. The 6th join will be a user.
|
||||
contact, _ = Contact.objects.get_or_create(user=self.staffuser)
|
||||
application1 = completed_domain_request(submitter=contact, name="city1.gov")
|
||||
application2 = completed_domain_request(submitter=contact, name="city2.gov")
|
||||
application3 = completed_domain_request(submitter=contact, name="city3.gov")
|
||||
application4 = completed_domain_request(submitter=contact, name="city4.gov")
|
||||
application5 = completed_domain_request(submitter=contact, name="city5.gov")
|
||||
domain_request1 = completed_domain_request(submitter=contact, name="city1.gov")
|
||||
domain_request2 = completed_domain_request(submitter=contact, name="city2.gov")
|
||||
domain_request3 = completed_domain_request(submitter=contact, name="city3.gov")
|
||||
domain_request4 = completed_domain_request(submitter=contact, name="city4.gov")
|
||||
domain_request5 = completed_domain_request(submitter=contact, name="city5.gov")
|
||||
with patch("django.contrib.messages.warning") as mock_warning:
|
||||
# Use the test client to simulate the request
|
||||
response = self.client.get(reverse("admin:registrar_contact_change", args=[contact.pk]))
|
||||
|
@ -2378,15 +2378,15 @@ class ContactAdminTest(TestCase):
|
|||
response.wsgi_request,
|
||||
"<ul class='messagelist_content-list--unstyled'>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application1.pk}/change/'>city1.gov</a></li>"
|
||||
f"DomainRequest/{domain_request1.pk}/change/'>city1.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application2.pk}/change/'>city2.gov</a></li>"
|
||||
f"DomainRequest/{domain_request2.pk}/change/'>city2.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application3.pk}/change/'>city3.gov</a></li>"
|
||||
f"DomainRequest/{domain_request3.pk}/change/'>city3.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application4.pk}/change/'>city4.gov</a></li>"
|
||||
f"DomainRequest/{domain_request4.pk}/change/'>city4.gov</a></li>"
|
||||
"<li>Joined to DomainRequest: <a href='/admin/registrar/"
|
||||
f"DomainRequest/{application5.pk}/change/'>city5.gov</a></li>"
|
||||
f"DomainRequest/{domain_request5.pk}/change/'>city5.gov</a></li>"
|
||||
"</ul>"
|
||||
"<p class='font-sans-3xs'>And 1 more...</p>",
|
||||
)
|
||||
|
|
|
@ -185,7 +185,7 @@ class TestDomainRequest(TestCase):
|
|||
self.check_email_sent(domain_request, msg, "submit", 1)
|
||||
|
||||
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 domain request and submit it and see if email was sent."
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.WITHDRAWN)
|
||||
self.check_email_sent(domain_request, msg, "submit", 1)
|
||||
|
||||
|
@ -195,7 +195,7 @@ class TestDomainRequest(TestCase):
|
|||
self.check_email_sent(domain_request, msg, "submit", 0)
|
||||
|
||||
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 domain request and submit it and see if email was sent."
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||
self.check_email_sent(domain_request, msg, "submit", 0)
|
||||
|
||||
|
@ -579,7 +579,7 @@ class TestDomainRequest(TestCase):
|
|||
the rejection_reason is cleared."""
|
||||
|
||||
with less_console_noise():
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.REJECTED)
|
||||
domain_request.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE
|
||||
|
||||
|
@ -595,7 +595,7 @@ class TestDomainRequest(TestCase):
|
|||
the rejection_reason is cleared."""
|
||||
|
||||
with less_console_noise():
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.REJECTED)
|
||||
domain_request.domain_is_not_active = True
|
||||
domain_request.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE
|
||||
|
@ -612,7 +612,7 @@ class TestDomainRequest(TestCase):
|
|||
the rejection_reason is cleared."""
|
||||
|
||||
with less_console_noise():
|
||||
# Create a sample application
|
||||
# Create a sample domain request
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.REJECTED)
|
||||
domain_request.domain_is_not_active = True
|
||||
domain_request.rejection_reason = DomainRequest.RejectionReasons.DOMAIN_PURPOSE
|
||||
|
@ -719,7 +719,7 @@ class TestDomainInformation(TestCase):
|
|||
creator=user,
|
||||
domain=domain,
|
||||
notes="test notes",
|
||||
domain_request=application,
|
||||
domain_request=domain_request,
|
||||
).__dict__
|
||||
|
||||
# Test the two records for consistency
|
||||
|
|
|
@ -45,7 +45,7 @@ class TestWithUser(MockEppLib):
|
|||
)
|
||||
|
||||
def tearDown(self):
|
||||
# delete any applications too
|
||||
# delete any domain requests too
|
||||
super().tearDown()
|
||||
DomainRequest.objects.all().delete()
|
||||
DomainInformation.objects.all().delete()
|
||||
|
|
|
@ -43,7 +43,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_form_intro_acknowledgement(self):
|
||||
"""Tests that user is presented with intro acknowledgement page"""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
self.assertContains(intro_page, "You’re about to start your .gov domain request")
|
||||
|
||||
def test_domain_request_form_intro_is_skipped_when_edit_access(self):
|
||||
|
@ -61,7 +61,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_form_empty_submit(self):
|
||||
"""Tests empty submit on the first page after the acknowledgement page"""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -82,7 +82,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
self.assertIn("What kind of U.S.-based government organization do you represent?", result)
|
||||
|
||||
def test_domain_request_multiple_domain_requests_exist(self):
|
||||
"""Test that an info message appears when user has multiple applications already"""
|
||||
"""Test that an info message appears when user has multiple domain requests already"""
|
||||
# create and submit a domain request
|
||||
domain_request = completed_domain_request(user=self.user)
|
||||
mock_client = MockSESClient()
|
||||
|
@ -93,7 +93,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
# now, attempt to create another one
|
||||
with less_console_noise():
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
intro_form = intro_page.forms[0]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
@ -123,7 +123,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
SKIPPED_PAGES = 3
|
||||
num_pages = len(self.TITLES) - SKIPPED_PAGES
|
||||
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -481,13 +481,13 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
self.assertContains(home_page, "Started")
|
||||
num_pages_tested += 1
|
||||
|
||||
# TODO: For some reason this click results in a new application being generated
|
||||
# TODO: For some reason this click results in a new domain request being generated
|
||||
# This appraoch is an alternatie to using get as is being done below
|
||||
#
|
||||
# type_page = home_page.click("Edit")
|
||||
|
||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
url = reverse("edit-application", kwargs={"id": domain_request.pk})
|
||||
url = reverse("edit-domain-request", kwargs={"id": domain_request.pk})
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
# TODO: The following line results in a django error on middleware
|
||||
|
@ -500,7 +500,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_form_conditional_federal(self):
|
||||
"""Federal branch question is shown for federal organizations."""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -555,7 +555,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_form_conditional_elections(self):
|
||||
"""Election question is shown for other organizations."""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -609,7 +609,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_form_section_skipping(self):
|
||||
"""Can skip forward and back in sections"""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -646,7 +646,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_form_nonfederal(self):
|
||||
"""Non-federal organizations don't have to provide their federal agency."""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -691,7 +691,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_about_your_organization_special(self):
|
||||
"""Special districts have to answer an additional question."""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -719,18 +719,18 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_yes_no_form_inits_blank_for_new_domain_request(self):
|
||||
"""On the Other Contacts page, the yes/no form gets initialized with nothing selected for
|
||||
new applications"""
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
new domain requests"""
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
self.assertEquals(other_contacts_form["other_contacts-has_other_contacts"].value, None)
|
||||
|
||||
def test_yes_no_form_inits_yes_for_domain_request_with_other_contacts(self):
|
||||
"""On the Other Contacts page, the yes/no form gets initialized with YES selected if the
|
||||
application has other contacts"""
|
||||
# Application has other contacts by default
|
||||
domain request has other contacts"""
|
||||
# Domain Request has other contacts by default
|
||||
domain_request = completed_domain_request(user=self.user)
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -738,7 +738,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -746,13 +746,13 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_yes_no_form_inits_no_for_domain_request_with_no_other_contacts_rationale(self):
|
||||
"""On the Other Contacts page, the yes/no form gets initialized with NO selected if the
|
||||
application has no other contacts"""
|
||||
# Application has other contacts by default
|
||||
domain request has no other contacts"""
|
||||
# Domain request has other contacts by default
|
||||
domain_request = completed_domain_request(user=self.user, has_other_contacts=False)
|
||||
domain_request.no_other_contacts_rationale = "Hello!"
|
||||
domain_request.save()
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -760,7 +760,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -769,12 +769,12 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
def test_submitting_other_contacts_deletes_no_other_contacts_rationale(self):
|
||||
"""When a user submits the Other Contacts form with other contacts selected, the domain request's
|
||||
no other contacts rationale gets deleted"""
|
||||
# Application has other contacts by default
|
||||
# Domain request has other contacts by default
|
||||
domain_request = completed_domain_request(user=self.user, has_other_contacts=False)
|
||||
domain_request.no_other_contacts_rationale = "Hello!"
|
||||
domain_request.save()
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -782,7 +782,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -818,10 +818,10 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
"""When a user submits the Other Contacts form with no other contacts selected, the domain request's
|
||||
other contacts get deleted for other contacts that exist and are not joined to other objects
|
||||
"""
|
||||
# Application has other contacts by default
|
||||
# Domain request has other contacts by default
|
||||
domain_request = completed_domain_request(user=self.user)
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -829,7 +829,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -905,7 +905,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
domain_info.other_contacts.set([other])
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -913,7 +913,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -953,7 +953,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_if_yes_no_form_is_no_then_no_other_contacts_required(self):
|
||||
"""Applicants with no other contacts have to give a reason."""
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
other_contacts_form["other_contacts-has_other_contacts"] = "False"
|
||||
response = other_contacts_page.forms[0].submit()
|
||||
|
@ -968,7 +968,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_if_yes_no_form_is_yes_then_other_contacts_required(self):
|
||||
"""Applicants with other contacts do not have to give a reason."""
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
other_contacts_form["other_contacts-has_other_contacts"] = "True"
|
||||
response = other_contacts_page.forms[0].submit()
|
||||
|
@ -1036,7 +1036,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
domain_request.other_contacts.add(other2)
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1044,7 +1044,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -1109,7 +1109,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
domain_request.other_contacts.add(other)
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1117,7 +1117,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -1186,7 +1186,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
domain_request.other_contacts.add(other)
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1194,7 +1194,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -1266,7 +1266,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
other_contact_pk = other.id
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1274,7 +1274,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -1342,7 +1342,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
other_contact_pk = ao.id
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1350,7 +1350,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_page = self.app.get(reverse("application:other_contacts"))
|
||||
other_contacts_page = self.app.get(reverse("domain-request:other_contacts"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
other_contacts_form = other_contacts_page.forms[0]
|
||||
|
@ -1411,7 +1411,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
ao_pk = ao.id
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1419,7 +1419,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
ao_page = self.app.get(reverse("application:authorizing_official"))
|
||||
ao_page = self.app.get(reverse("domain-request:authorizing_official"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
ao_form = ao_page.forms[0]
|
||||
|
@ -1479,7 +1479,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
ao_pk = ao.id
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1487,7 +1487,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
ao_page = self.app.get(reverse("application:authorizing_official"))
|
||||
ao_page = self.app.get(reverse("domain-request:authorizing_official"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
ao_form = ao_page.forms[0]
|
||||
|
@ -1548,7 +1548,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
submitter_pk = you.id
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1556,7 +1556,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
your_contact_page = self.app.get(reverse("application:your_contact"))
|
||||
your_contact_page = self.app.get(reverse("domain-request:your_contact"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
your_contact_form = your_contact_page.forms[0]
|
||||
|
@ -1615,7 +1615,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
submitter_pk = submitter.id
|
||||
|
||||
# prime the form by visiting /edit
|
||||
self.app.get(reverse("edit-application", kwargs={"id": domain_request.pk}))
|
||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1623,7 +1623,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
your_contact_page = self.app.get(reverse("application:your_contact"))
|
||||
your_contact_page = self.app.get(reverse("domain-request:your_contact"))
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
your_contact_form = your_contact_page.forms[0]
|
||||
|
@ -1650,7 +1650,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_about_your_organiztion_interstate(self):
|
||||
"""Special districts have to answer an additional question."""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1678,7 +1678,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_tribal_government(self):
|
||||
"""Tribal organizations have to answer an additional question."""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1708,7 +1708,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT])
|
||||
|
||||
def test_domain_request_ao_dynamic_text(self):
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1779,7 +1779,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
self.assertContains(ao_page, "Domain requests from cities")
|
||||
|
||||
def test_domain_request_dotgov_domain_dynamic_text(self):
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -1881,7 +1881,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
|
||||
def test_domain_request_formsets(self):
|
||||
"""Users are able to add more than one of some fields."""
|
||||
current_sites_page = self.app.get(reverse("application:current_sites"))
|
||||
current_sites_page = self.app.get(reverse("domain-request:current_sites"))
|
||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
# fill in the form field
|
||||
current_sites_form = current_sites_page.forms[0]
|
||||
|
@ -1909,7 +1909,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
@skip("WIP")
|
||||
def test_domain_request_edit_restore(self):
|
||||
"""
|
||||
Test that a previously saved application is available at the /edit endpoint.
|
||||
Test that a previously saved domain request is available at the /edit endpoint.
|
||||
"""
|
||||
ao, _ = Contact.objects.get_or_create(
|
||||
first_name="Testy",
|
||||
|
@ -1955,7 +1955,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
domain_request.alternative_domains.add(alt)
|
||||
|
||||
# prime the form by visiting /edit
|
||||
url = reverse("edit-application", kwargs={"id": domain_request.pk})
|
||||
url = reverse("edit-domain-request", kwargs={"id": domain_request.pk})
|
||||
response = self.client.get(url)
|
||||
|
||||
# TODO: this is a sketch of each page in the wizard which needs to be tested
|
||||
|
@ -1965,7 +1965,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
# -- the best that can/should be done here is to ensure the correct values
|
||||
# are being passed to the templating engine
|
||||
|
||||
url = reverse("application:organization_type")
|
||||
url = reverse("domain-request:organization_type")
|
||||
response = self.client.get(url, follow=True)
|
||||
self.assertContains(response, "<input>")
|
||||
# choices = response.context['wizard']['form']['organization_type'].subwidgets
|
||||
|
@ -1973,62 +1973,62 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
# checked = radio.data["selected"]
|
||||
# self.assertTrue(checked)
|
||||
|
||||
# url = reverse("application:organization_federal")
|
||||
# url = reverse("domain-request:organization_federal")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:organization_contact")
|
||||
# url = reverse("domain-request:organization_contact")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:authorizing_official")
|
||||
# url = reverse("domain-request:authorizing_official")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:current_sites")
|
||||
# url = reverse("domain-request:current_sites")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:dotgov_domain")
|
||||
# url = reverse("domain-request:dotgov_domain")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:purpose")
|
||||
# url = reverse("domain-request:purpose")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:your_contact")
|
||||
# url = reverse("domain-request:your_contact")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:other_contacts")
|
||||
# url = reverse("domain-request:other_contacts")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:other_contacts")
|
||||
# url = reverse("domain-request:other_contacts")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:security_email")
|
||||
# url = reverse("domain-request:security_email")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:anything_else")
|
||||
# url = reverse("domain-request:anything_else")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
||||
# url = reverse("application:requirements")
|
||||
# url = reverse("domain-request:requirements")
|
||||
# self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
# page = self.app.get(url)
|
||||
# self.assertNotContains(page, "VALUE")
|
||||
|
@ -2038,7 +2038,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
Make sure the long name is displaying in the domain request form,
|
||||
org step
|
||||
"""
|
||||
intro_page = self.app.get(reverse("application:"))
|
||||
intro_page = self.app.get(reverse("domain-request:"))
|
||||
# django-webtest does not handle cookie-based sessions well because it keeps
|
||||
# resetting the session key on each new request, thus destroying the concept
|
||||
# of a "session". We are going to do it manually, saving the session ID here
|
||||
|
@ -2063,7 +2063,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
NOTE: This may be a moot point if we implement a more solid pattern in the
|
||||
future, like not a submit action at all on the review page."""
|
||||
|
||||
review_page = self.app.get(reverse("application:review"))
|
||||
review_page = self.app.get(reverse("domain-request:review"))
|
||||
self.assertContains(review_page, "toggle-submit-domain-request")
|
||||
self.assertContains(review_page, "You are about to submit an incomplete request")
|
||||
|
||||
|
@ -2075,7 +2075,7 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
self.client.force_login(self.user)
|
||||
|
||||
def test_domain_request_status(self):
|
||||
"""Checking application status page"""
|
||||
"""Checking domain request status page"""
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user)
|
||||
domain_request.save()
|
||||
|
||||
|
@ -2091,7 +2091,7 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
self.assertContains(detail_page, "Status:")
|
||||
|
||||
def test_domain_request_status_with_ineligible_user(self):
|
||||
"""Checking application status page whith a blocked user.
|
||||
"""Checking domain request status page whith a blocked user.
|
||||
The user should still have access to view."""
|
||||
self.user.status = "ineligible"
|
||||
self.user.save()
|
||||
|
@ -2110,7 +2110,7 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
self.assertContains(detail_page, "Status:")
|
||||
|
||||
def test_domain_request_withdraw(self):
|
||||
"""Checking application status page"""
|
||||
"""Checking domain request status page"""
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user)
|
||||
domain_request.save()
|
||||
|
||||
|
@ -2143,7 +2143,7 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
self.assertContains(home_page, "Withdrawn")
|
||||
|
||||
def test_domain_request_withdraw_no_permissions(self):
|
||||
"""Can't withdraw applications as a restricted user."""
|
||||
"""Can't withdraw domain requests as a restricted user."""
|
||||
self.user.status = User.RESTRICTED
|
||||
self.user.save()
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user)
|
||||
|
@ -2162,15 +2162,15 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
# Restricted user trying to withdraw results in 403 error
|
||||
with less_console_noise():
|
||||
for url_name in [
|
||||
"application-withdraw-confirmation",
|
||||
"application-withdrawn",
|
||||
"domain-request-withdraw-confirmation",
|
||||
"domain-request-withdrawn",
|
||||
]:
|
||||
with self.subTest(url_name=url_name):
|
||||
page = self.client.get(reverse(url_name, kwargs={"pk": domain_request.pk}))
|
||||
self.assertEqual(page.status_code, 403)
|
||||
|
||||
def test_domain_request_status_no_permissions(self):
|
||||
"""Can't access applications without being the creator."""
|
||||
"""Can't access domain requests without being the creator."""
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user)
|
||||
other_user = User()
|
||||
other_user.save()
|
||||
|
@ -2180,23 +2180,23 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
# PermissionDeniedErrors make lots of noise in test output
|
||||
with less_console_noise():
|
||||
for url_name in [
|
||||
"application-status",
|
||||
"application-withdraw-confirmation",
|
||||
"application-withdrawn",
|
||||
"domain-request-status",
|
||||
"domain-request-withdraw-confirmation",
|
||||
"domain-request-withdrawn",
|
||||
]:
|
||||
with self.subTest(url_name=url_name):
|
||||
page = self.client.get(reverse(url_name, kwargs={"pk": domain_request.pk}))
|
||||
self.assertEqual(page.status_code, 403)
|
||||
|
||||
def test_approved_domain_request_not_in_active_requests(self):
|
||||
"""An approved application is not shown in the Active
|
||||
"""An approved domain request is not shown in the Active
|
||||
Requests table on home.html."""
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED, user=self.user)
|
||||
domain_request.save()
|
||||
|
||||
home_page = self.app.get("/")
|
||||
# This works in our test environment because creating
|
||||
# an approved application here does not generate a
|
||||
# an approved domain request here does not generate a
|
||||
# domain object, so we do not expect to see 'city.gov'
|
||||
# in either the Domains or Requests tables.
|
||||
self.assertNotContains(home_page, "city.gov")
|
||||
|
@ -2481,7 +2481,7 @@ class HomeTests(TestWithUser):
|
|||
self.assertContains(home_page, "button-toggle-delete-domain-alert-1")
|
||||
|
||||
# Trigger the delete logic
|
||||
response = self.client.post(reverse("application-delete", kwargs={"pk": domain_request.pk}), follow=True)
|
||||
response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True)
|
||||
|
||||
self.assertNotContains(response, "igorville.gov")
|
||||
|
||||
|
@ -2505,7 +2505,7 @@ class HomeTests(TestWithUser):
|
|||
self.assertContains(home_page, "button-toggle-delete-domain-alert-1")
|
||||
|
||||
# Trigger the delete logic
|
||||
response = self.client.post(reverse("application-delete", kwargs={"pk": domain_request.pk}), follow=True)
|
||||
response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True)
|
||||
|
||||
self.assertNotContains(response, "igorville.gov")
|
||||
|
||||
|
@ -2513,7 +2513,7 @@ class HomeTests(TestWithUser):
|
|||
domain_request.delete()
|
||||
|
||||
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 domain requests not in the status of STARTED or WITHDRAWN"""
|
||||
|
||||
# Given that we are including a subset of items that can be deleted while excluding the rest,
|
||||
# subTest is appropriate here as otherwise we would need many duplicate tests for the same reason.
|
||||
|
@ -2531,7 +2531,7 @@ class HomeTests(TestWithUser):
|
|||
|
||||
# Trigger the delete logic
|
||||
response = self.client.post(
|
||||
reverse("application-delete", kwargs={"pk": domain_request.pk}), follow=True
|
||||
reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True
|
||||
)
|
||||
|
||||
# Check for a 403 error - the end user should not be allowed to do this
|
||||
|
@ -2577,7 +2577,7 @@ class HomeTests(TestWithUser):
|
|||
)
|
||||
domain_request.other_contacts.set([contact_2])
|
||||
|
||||
# Create a second application to attach contacts to
|
||||
# Create a second domain request to attach contacts to
|
||||
site_2 = DraftDomain.objects.create(name="teaville.gov")
|
||||
domain_request_2 = DomainRequest.objects.create(
|
||||
creator=self.user,
|
||||
|
@ -2593,7 +2593,7 @@ class HomeTests(TestWithUser):
|
|||
self.assertContains(home_page, "igorville.gov")
|
||||
|
||||
# Trigger the delete logic
|
||||
response = self.client.post(reverse("application-delete", kwargs={"pk": domain_request.pk}), follow=True)
|
||||
response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request.pk}), follow=True)
|
||||
|
||||
# igorville is now deleted
|
||||
self.assertNotContains(response, "igorville.gov")
|
||||
|
@ -2649,7 +2649,7 @@ class HomeTests(TestWithUser):
|
|||
)
|
||||
domain_request.other_contacts.set([contact_2])
|
||||
|
||||
# Create a second application to attach contacts to
|
||||
# Create a second domain request to attach contacts to
|
||||
site_2 = DraftDomain.objects.create(name="teaville.gov")
|
||||
domain_request_2 = DomainRequest.objects.create(
|
||||
creator=self.user,
|
||||
|
@ -2664,7 +2664,7 @@ class HomeTests(TestWithUser):
|
|||
self.assertContains(home_page, "teaville.gov")
|
||||
|
||||
# Trigger the delete logic
|
||||
response = self.client.post(reverse("application-delete", kwargs={"pk": domain_request_2.pk}), follow=True)
|
||||
response = self.client.post(reverse("domain-request-delete", kwargs={"pk": domain_request_2.pk}), follow=True)
|
||||
|
||||
self.assertNotContains(response, "teaville.gov")
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
# NB: this is included here for reference. Do not change it without
|
||||
# also changing the many places it is hardcoded in the HTML templates
|
||||
URL_NAMESPACE = "domain_request"
|
||||
# name for accessing /application/<id>/edit
|
||||
EDIT_URL_NAME = "edit-application"
|
||||
# name for accessing /domain-request/<id>/edit
|
||||
EDIT_URL_NAME = "edit-domain-request"
|
||||
NEW_URL_NAME = "/request/"
|
||||
# We need to pass our human-readable step titles as context to the templates.
|
||||
TITLES = {
|
||||
|
@ -118,7 +118,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
def prefix(self):
|
||||
"""Namespace the wizard to avoid clashes in session variable names."""
|
||||
# this is a string literal but can be made dynamic if we'd like
|
||||
# users to have multiple applications open for editing simultaneously
|
||||
# users to have multiple domain requests open for editing simultaneously
|
||||
return "wizard_domain_request"
|
||||
|
||||
@property
|
||||
|
@ -148,7 +148,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
)
|
||||
return self._domain_request
|
||||
except DomainRequest.DoesNotExist:
|
||||
logger.debug("Application id %s did not have a DomainRequest" % id)
|
||||
logger.debug("DomainRequest id %s did not have a DomainRequest" % id)
|
||||
|
||||
self._domain_request = DomainRequest.objects.create(creator=self.request.user)
|
||||
|
||||
|
@ -181,7 +181,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
"""Called when the user clicks the submit button, if all forms are valid."""
|
||||
self.domain_request.submit() # change the status to submitted
|
||||
self.domain_request.save()
|
||||
logger.debug("Application object saved: %s", self.domain_request.id)
|
||||
logger.debug("Domain Request object saved: %s", self.domain_request.id)
|
||||
return redirect(reverse(f"{self.URL_NAMESPACE}:finished"))
|
||||
|
||||
def from_model(self, attribute: str, default, *args, **kwargs):
|
||||
|
@ -210,7 +210,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
current_url = resolve(request.path_info).url_name
|
||||
|
||||
# if user visited via an "edit" url, associate the id of the
|
||||
# application they are trying to edit to this wizard instance
|
||||
# domain request they are trying to edit to this wizard instance
|
||||
# and remove any prior wizard data from their session
|
||||
if current_url == self.EDIT_URL_NAME and "id" in kwargs:
|
||||
del self.storage
|
||||
|
@ -309,7 +309,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
return self.pending_domain_requests()
|
||||
|
||||
def approved_domain_requests_exist(self):
|
||||
"""Checks if user is creator of applications with DomainRequestStatus.APPROVED status"""
|
||||
"""Checks if user is creator of domain requests with DomainRequestStatus.APPROVED status"""
|
||||
approved_domain_request_count = DomainRequest.objects.filter(
|
||||
creator=self.request.user, status=DomainRequest.DomainRequestStatus.APPROVED
|
||||
).count()
|
||||
|
@ -323,9 +323,9 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
return self.request.user.permissions.count() > 0
|
||||
|
||||
def pending_domain_requests(self):
|
||||
"""Returns a List of user's applications with one of the following states:
|
||||
"""Returns a List of user's domain requests with one of the following states:
|
||||
DomainRequestStatus.SUBMITTED, DomainRequestStatus.IN_REVIEW, DomainRequestStatus.ACTION_NEEDED"""
|
||||
# if the current application has DomainRequestStatus.ACTION_NEEDED status, this check should not be performed
|
||||
# if the current domain request has DomainRequestStatus.ACTION_NEEDED status, this check should not be performed
|
||||
if self.domain_request.status == DomainRequest.DomainRequestStatus.ACTION_NEEDED:
|
||||
return []
|
||||
check_statuses = [
|
||||
|
@ -639,7 +639,7 @@ class DomainRequestStatus(DomainRequestPermissionView):
|
|||
template_name = "domain_request_status.html"
|
||||
|
||||
|
||||
class ApplicationWithdrawConfirmation(DomainRequestPermissionWithdrawView):
|
||||
class DomainRequestWithdrawConfirmation(DomainRequestPermissionWithdrawView):
|
||||
"""This page will ask user to confirm if they want to withdraw
|
||||
|
||||
The DomainRequestPermissionView restricts access so that only the
|
||||
|
@ -649,7 +649,7 @@ class ApplicationWithdrawConfirmation(DomainRequestPermissionWithdrawView):
|
|||
template_name = "domain_request_withdraw_confirmation.html"
|
||||
|
||||
|
||||
class ApplicationWithdrawn(DomainRequestPermissionWithdrawView):
|
||||
class DomainRequestWithdrawn(DomainRequestPermissionWithdrawView):
|
||||
# this view renders no template
|
||||
template_name = ""
|
||||
|
||||
|
@ -689,8 +689,8 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
|
|||
|
||||
def post(self, request, *args, **kwargs):
|
||||
# Grab all orphaned contacts
|
||||
application: DomainRequest = self.get_object()
|
||||
contacts_to_delete, duplicates = self._get_orphaned_contacts(application)
|
||||
domain_request: DomainRequest = self.get_object()
|
||||
contacts_to_delete, duplicates = self._get_orphaned_contacts(domain_request)
|
||||
|
||||
# Delete the DomainRequest
|
||||
response = super().post(request, *args, **kwargs)
|
||||
|
@ -716,7 +716,7 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
|
|||
and any other contacts linked to the domain_request.
|
||||
|
||||
Parameters:
|
||||
application (DomainRequest): The DomainRequest object for which to find orphaned contacts.
|
||||
domain_request (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.
|
||||
Defaults to False.
|
||||
|
||||
|
|
|
@ -8,25 +8,25 @@ def index(request):
|
|||
context = {}
|
||||
if request.user.is_authenticated:
|
||||
# Get all domain requests the user has access to
|
||||
applications, deletable_domain_requests = _get_domain_requests(request)
|
||||
domain_requests, deletable_domain_requests = _get_domain_requests(request)
|
||||
|
||||
context["domain_requests"] = applications
|
||||
context["domain_requests"] = domain_requests
|
||||
|
||||
# Get all domains the user has access to
|
||||
domains = _get_domains(request)
|
||||
context["domains"] = domains
|
||||
|
||||
# Determine if the user will see applications that they can delete
|
||||
# Determine if the user will see domain requests that they can delete
|
||||
has_deletable_domain_requests = deletable_domain_requests.exists()
|
||||
context["has_deletable_domain_requests"] = has_deletable_domain_requests
|
||||
|
||||
# If they can delete applications, add the delete button to the context
|
||||
# If they can delete domain requests, add the delete button to the context
|
||||
if has_deletable_domain_requests:
|
||||
# Add the delete modal button to the context
|
||||
modal_button = (
|
||||
'<button type="submit" '
|
||||
'class="usa-button usa-button--secondary" '
|
||||
'name="delete-application">Yes, delete request</button>'
|
||||
'name="delete-domain-request">Yes, delete request</button>'
|
||||
)
|
||||
context["modal_button"] = modal_button
|
||||
|
||||
|
@ -37,20 +37,20 @@ def _get_domain_requests(request):
|
|||
"""Given the current request,
|
||||
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 domain requests, and those that are deletable by the user.
|
||||
"""
|
||||
# Let's exclude the approved applications since our
|
||||
# Let's exclude the approved domain requests since our
|
||||
# domain_requests context will be used to populate
|
||||
# the active applications table
|
||||
applications = DomainRequest.objects.filter(creator=request.user).exclude(
|
||||
# the active domain requests table
|
||||
domain_requests = DomainRequest.objects.filter(creator=request.user).exclude(
|
||||
status=DomainRequest.DomainRequestStatus.APPROVED
|
||||
)
|
||||
|
||||
# Create a placeholder DraftDomain for each incomplete draft
|
||||
valid_statuses = [DomainRequest.DomainRequestStatus.STARTED, DomainRequest.DomainRequestStatus.WITHDRAWN]
|
||||
deletable_domain_requests = applications.filter(status__in=valid_statuses)
|
||||
deletable_domain_requests = domain_requests.filter(status__in=valid_statuses)
|
||||
|
||||
return (applications, deletable_domain_requests)
|
||||
return (domain_requests, deletable_domain_requests)
|
||||
|
||||
|
||||
def _get_domains(request):
|
||||
|
|
|
@ -244,9 +244,9 @@ class DomainPermission(PermissionsLoginMixin):
|
|||
if DomainInformation.objects.filter(id=pk).exists():
|
||||
requested_domain = DomainInformation.objects.get(id=pk)
|
||||
|
||||
# if no domain information or application exist, the user
|
||||
# if no domain information or domain request exist, the user
|
||||
# should be able to manage the domain; however, if domain information
|
||||
# and domain request exist, and application is not in valid status,
|
||||
# and domain request exist, and domain request is not in valid status,
|
||||
# user should not be able to manage domain
|
||||
if (
|
||||
requested_domain
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue