mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 10:29:23 +02:00
Continued test cleanup
This commit is contained in:
parent
2713e59795
commit
ff9e73def6
9 changed files with 22 additions and 238 deletions
|
@ -49,7 +49,6 @@ for step, view in [
|
||||||
(Step.CURRENT_SITES, views.CurrentSites),
|
(Step.CURRENT_SITES, views.CurrentSites),
|
||||||
(Step.DOTGOV_DOMAIN, views.DotgovDomain),
|
(Step.DOTGOV_DOMAIN, views.DotgovDomain),
|
||||||
(Step.PURPOSE, views.Purpose),
|
(Step.PURPOSE, views.Purpose),
|
||||||
(Step.YOUR_CONTACT, views.YourContact),
|
|
||||||
(Step.OTHER_CONTACTS, views.OtherContacts),
|
(Step.OTHER_CONTACTS, views.OtherContacts),
|
||||||
(Step.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
(Step.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
||||||
(Step.REQUIREMENTS, views.Requirements),
|
(Step.REQUIREMENTS, views.Requirements),
|
||||||
|
@ -198,11 +197,6 @@ urlpatterns = [
|
||||||
views.DomainDsDataView.as_view(),
|
views.DomainDsDataView.as_view(),
|
||||||
name="domain-dns-dnssec-dsdata",
|
name="domain-dns-dnssec-dsdata",
|
||||||
),
|
),
|
||||||
path(
|
|
||||||
"domain/<int:pk>/your-contact-information",
|
|
||||||
views.DomainYourContactInformationView.as_view(),
|
|
||||||
name="domain-your-contact-information",
|
|
||||||
),
|
|
||||||
path(
|
path(
|
||||||
"domain/<int:pk>/org-name-address",
|
"domain/<int:pk>/org-name-address",
|
||||||
views.DomainOrgNameAddressView.as_view(),
|
views.DomainOrgNameAddressView.as_view(),
|
||||||
|
|
|
@ -649,7 +649,7 @@ class TestDomainInformationAdmin(TestCase):
|
||||||
self.test_helper.assert_response_contains_distinct_values(response, expected_other_employees_fields)
|
self.test_helper.assert_response_contains_distinct_values(response, expected_other_employees_fields)
|
||||||
|
|
||||||
# Test for the copy link
|
# Test for the copy link
|
||||||
self.assertContains(response, "button--clipboard", count=4)
|
self.assertContains(response, "button--clipboard", count=3)
|
||||||
|
|
||||||
# cleanup this test
|
# cleanup this test
|
||||||
domain_info.delete()
|
domain_info.delete()
|
||||||
|
|
|
@ -149,7 +149,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
|
|
||||||
# These should exist in the response
|
# These should exist in the response
|
||||||
expected_values = [
|
expected_values = [
|
||||||
("creator", "Person who submitted the domain request; will not receive email updates"),
|
("creator", "Person who submitted the domain request; will receive email updates"),
|
||||||
("approved_domain", "Domain associated with this request; will be blank until request is approved"),
|
("approved_domain", "Domain associated with this request; will be blank until request is approved"),
|
||||||
("no_other_contacts_rationale", "Required if creator does not list other employees"),
|
("no_other_contacts_rationale", "Required if creator does not list other employees"),
|
||||||
("alternative_domains", "Other domain names the creator provided for consideration"),
|
("alternative_domains", "Other domain names the creator provided for consideration"),
|
||||||
|
@ -1397,7 +1397,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
self.test_helper.assert_response_contains_distinct_values(response, expected_other_employees_fields)
|
self.test_helper.assert_response_contains_distinct_values(response, expected_other_employees_fields)
|
||||||
|
|
||||||
# Test for the copy link
|
# Test for the copy link
|
||||||
self.assertContains(response, "button--clipboard", count=5)
|
self.assertContains(response, "button--clipboard", count=4)
|
||||||
|
|
||||||
# Test that Creator counts display properly
|
# Test that Creator counts display properly
|
||||||
self.assertNotContains(response, "Approved domains")
|
self.assertNotContains(response, "Approved domains")
|
||||||
|
|
|
@ -1006,20 +1006,6 @@ class UserProfileTests(TestWithUser, WebTest):
|
||||||
self.assertContains(response, "Your profile")
|
self.assertContains(response, "Your profile")
|
||||||
self.assertNotContains(response, "Your contact information")
|
self.assertNotContains(response, "Your contact information")
|
||||||
|
|
||||||
@less_console_noise_decorator
|
|
||||||
def test_domain_your_contact_information_when_profile_feature_off(self):
|
|
||||||
"""test that Your contact information is accessible when profile_feature is off"""
|
|
||||||
with override_flag("profile_feature", active=False):
|
|
||||||
response = self.client.get(f"/domain/{self.domain.id}/your-contact-information", follow=True)
|
|
||||||
self.assertContains(response, "Your contact information")
|
|
||||||
|
|
||||||
@less_console_noise_decorator
|
|
||||||
def test_domain_your_contact_information_when_profile_feature_on(self):
|
|
||||||
"""test that Your contact information is not accessible when profile feature is on"""
|
|
||||||
with override_flag("profile_feature", active=True):
|
|
||||||
response = self.client.get(f"/domain/{self.domain.id}/your-contact-information", follow=True)
|
|
||||||
self.assertEqual(response.status_code, 404)
|
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_request_when_profile_feature_on(self):
|
def test_request_when_profile_feature_on(self):
|
||||||
"""test that Your profile is in request page when profile feature is on"""
|
"""test that Your profile is in request page when profile feature is on"""
|
||||||
|
|
|
@ -1602,12 +1602,6 @@ class TestDomainSuborganization(TestDomainOverview):
|
||||||
|
|
||||||
|
|
||||||
class TestDomainContactInformation(TestDomainOverview):
|
class TestDomainContactInformation(TestDomainOverview):
|
||||||
@less_console_noise_decorator
|
|
||||||
def test_domain_your_contact_information(self):
|
|
||||||
"""Can load domain's your contact information page."""
|
|
||||||
page = self.client.get(reverse("domain-your-contact-information", kwargs={"pk": self.domain.id}))
|
|
||||||
self.assertContains(page, "Your contact information")
|
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_domain_your_contact_information_content(self):
|
def test_domain_your_contact_information_content(self):
|
||||||
"""Logged-in user's contact information appears on the page."""
|
"""Logged-in user's contact information appears on the page."""
|
||||||
|
|
|
@ -7,6 +7,7 @@ from api.tests.common import less_console_noise_decorator
|
||||||
from .common import MockSESClient, completed_domain_request # type: ignore
|
from .common import MockSESClient, completed_domain_request # type: ignore
|
||||||
from django_webtest import WebTest # type: ignore
|
from django_webtest import WebTest # type: ignore
|
||||||
import boto3_mocking # type: ignore
|
import boto3_mocking # type: ignore
|
||||||
|
from waffle.testutils import override_flag
|
||||||
|
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
DomainRequest,
|
DomainRequest,
|
||||||
|
@ -348,41 +349,13 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the domain request page
|
# the domain request page
|
||||||
self.assertEqual(purpose_result.status_code, 302)
|
self.assertEqual(purpose_result.status_code, 302)
|
||||||
self.assertEqual(purpose_result["Location"], "/request/your_contact/")
|
self.assertEqual(purpose_result["Location"], "/request/other_contacts/")
|
||||||
num_pages_tested += 1
|
|
||||||
|
|
||||||
# ---- YOUR CONTACT INFO PAGE ----
|
|
||||||
# Follow the redirect to the next form page
|
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
|
||||||
your_contact_page = purpose_result.follow()
|
|
||||||
your_contact_form = your_contact_page.forms[0]
|
|
||||||
|
|
||||||
your_contact_form["your_contact-first_name"] = "Testy you"
|
|
||||||
your_contact_form["your_contact-last_name"] = "Tester you"
|
|
||||||
your_contact_form["your_contact-title"] = "Admin Tester"
|
|
||||||
your_contact_form["your_contact-email"] = "testy-admin@town.com"
|
|
||||||
your_contact_form["your_contact-phone"] = "(201) 555 5556"
|
|
||||||
|
|
||||||
# test next button
|
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
|
||||||
your_contact_result = your_contact_form.submit()
|
|
||||||
# validate that data from this step are being saved
|
|
||||||
domain_request = DomainRequest.objects.get() # there's only one
|
|
||||||
self.assertEqual(domain_request.creator.first_name, self.user.first_name)
|
|
||||||
self.assertEqual(domain_request.creator.last_name, self.user.last_name)
|
|
||||||
self.assertEqual(domain_request.creator.title, self.user.title)
|
|
||||||
self.assertEqual(domain_request.creator.email, self.user.email)
|
|
||||||
self.assertEqual(domain_request.creator.phone, self.user.phone)
|
|
||||||
# the post request should return a redirect to the next form in
|
|
||||||
# the domain request page
|
|
||||||
self.assertEqual(your_contact_result.status_code, 302)
|
|
||||||
self.assertEqual(your_contact_result["Location"], "/request/other_contacts/")
|
|
||||||
num_pages_tested += 1
|
num_pages_tested += 1
|
||||||
|
|
||||||
# ---- OTHER CONTACTS PAGE ----
|
# ---- OTHER CONTACTS PAGE ----
|
||||||
# Follow the redirect to the next form page
|
# Follow the redirect to the next form page
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
other_contacts_page = your_contact_result.follow()
|
other_contacts_page = purpose_result.follow()
|
||||||
|
|
||||||
# This page has 3 forms in 1.
|
# This page has 3 forms in 1.
|
||||||
# Let's set the yes/no radios to enable the other contacts fieldsets
|
# Let's set the yes/no radios to enable the other contacts fieldsets
|
||||||
|
@ -492,11 +465,6 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
self.assertContains(review_page, "city.gov")
|
self.assertContains(review_page, "city.gov")
|
||||||
self.assertContains(review_page, "city1.gov")
|
self.assertContains(review_page, "city1.gov")
|
||||||
self.assertContains(review_page, "For all kinds of things.")
|
self.assertContains(review_page, "For all kinds of things.")
|
||||||
self.assertContains(review_page, "Testy you")
|
|
||||||
self.assertContains(review_page, "Tester you")
|
|
||||||
self.assertContains(review_page, "Admin Tester")
|
|
||||||
self.assertContains(review_page, "testy-admin@town.com")
|
|
||||||
self.assertContains(review_page, "(201) 555-5556")
|
|
||||||
self.assertContains(review_page, "Testy2")
|
self.assertContains(review_page, "Testy2")
|
||||||
self.assertContains(review_page, "Tester2")
|
self.assertContains(review_page, "Tester2")
|
||||||
self.assertContains(review_page, "Another Tester")
|
self.assertContains(review_page, "Another Tester")
|
||||||
|
@ -704,41 +672,13 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
# the post request should return a redirect to the next form in
|
# the post request should return a redirect to the next form in
|
||||||
# the domain request page
|
# the domain request page
|
||||||
self.assertEqual(purpose_result.status_code, 302)
|
self.assertEqual(purpose_result.status_code, 302)
|
||||||
self.assertEqual(purpose_result["Location"], "/request/your_contact/")
|
self.assertEqual(purpose_result["Location"], "/request/other_contacts/")
|
||||||
num_pages_tested += 1
|
|
||||||
|
|
||||||
# ---- YOUR CONTACT INFO PAGE ----
|
|
||||||
# Follow the redirect to the next form page
|
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
|
||||||
your_contact_page = purpose_result.follow()
|
|
||||||
your_contact_form = your_contact_page.forms[0]
|
|
||||||
|
|
||||||
your_contact_form["your_contact-first_name"] = "Testy you"
|
|
||||||
your_contact_form["your_contact-last_name"] = "Tester you"
|
|
||||||
your_contact_form["your_contact-title"] = "Admin Tester"
|
|
||||||
your_contact_form["your_contact-email"] = "testy-admin@town.com"
|
|
||||||
your_contact_form["your_contact-phone"] = "(201) 555 5556"
|
|
||||||
|
|
||||||
# test next button
|
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
|
||||||
your_contact_result = your_contact_form.submit()
|
|
||||||
# validate that data from this step are being saved
|
|
||||||
domain_request = DomainRequest.objects.get() # there's only one
|
|
||||||
self.assertEqual(domain_request.submitter.first_name, "Testy you")
|
|
||||||
self.assertEqual(domain_request.submitter.last_name, "Tester you")
|
|
||||||
self.assertEqual(domain_request.submitter.title, "Admin Tester")
|
|
||||||
self.assertEqual(domain_request.submitter.email, "testy-admin@town.com")
|
|
||||||
self.assertEqual(domain_request.submitter.phone, "(201) 555 5556")
|
|
||||||
# the post request should return a redirect to the next form in
|
|
||||||
# the domain request page
|
|
||||||
self.assertEqual(your_contact_result.status_code, 302)
|
|
||||||
self.assertEqual(your_contact_result["Location"], "/request/other_contacts/")
|
|
||||||
num_pages_tested += 1
|
num_pages_tested += 1
|
||||||
|
|
||||||
# ---- OTHER CONTACTS PAGE ----
|
# ---- OTHER CONTACTS PAGE ----
|
||||||
# Follow the redirect to the next form page
|
# Follow the redirect to the next form page
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
other_contacts_page = your_contact_result.follow()
|
other_contacts_page = purpose_result.follow()
|
||||||
|
|
||||||
# This page has 3 forms in 1.
|
# This page has 3 forms in 1.
|
||||||
# Let's set the yes/no radios to enable the other contacts fieldsets
|
# Let's set the yes/no radios to enable the other contacts fieldsets
|
||||||
|
@ -2264,6 +2204,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
senior_official = domain_request.senior_official
|
senior_official = domain_request.senior_official
|
||||||
self.assertEquals("Testy2", senior_official.first_name)
|
self.assertEquals("Testy2", senior_official.first_name)
|
||||||
|
|
||||||
|
@override_flag("profile_feature", active=True)
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_edit_submitter_in_place(self):
|
def test_edit_submitter_in_place(self):
|
||||||
"""When you:
|
"""When you:
|
||||||
|
@ -2274,13 +2215,6 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
# Populate the database with a domain request that
|
# Populate the database with a domain request that
|
||||||
# has a submitter
|
# has a submitter
|
||||||
# We'll do it from scratch
|
# We'll do it from scratch
|
||||||
you, _ = Contact.objects.get_or_create(
|
|
||||||
first_name="Testy",
|
|
||||||
last_name="Tester",
|
|
||||||
title="Chief Tester",
|
|
||||||
email="testy@town.com",
|
|
||||||
phone="(201) 555 5555",
|
|
||||||
)
|
|
||||||
domain_request, _ = DomainRequest.objects.get_or_create(
|
domain_request, _ = DomainRequest.objects.get_or_create(
|
||||||
generic_org_type="federal",
|
generic_org_type="federal",
|
||||||
federal_type="executive",
|
federal_type="executive",
|
||||||
|
@ -2297,7 +2231,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
|
|
||||||
# submitter_pk is the initial pk of the submitter. set it before update
|
# submitter_pk is the initial pk of the submitter. set it before update
|
||||||
# to be able to verify after update that the same contact object is in place
|
# to be able to verify after update that the same contact object is in place
|
||||||
submitter_pk = you.id
|
creator_pk = self.user.id
|
||||||
|
|
||||||
# prime the form by visiting /edit
|
# prime the form by visiting /edit
|
||||||
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
self.app.get(reverse("edit-domain-request", kwargs={"id": domain_request.pk}))
|
||||||
|
@ -2308,97 +2242,25 @@ class DomainRequestTests(TestWithUser, WebTest):
|
||||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
your_contact_page = self.app.get(reverse("domain-request:your_contact"))
|
profile_page = self.app.get(f"/user-profile")
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
|
||||||
your_contact_form = your_contact_page.forms[0]
|
profile_form = profile_page.forms[0]
|
||||||
|
|
||||||
# Minimal check to ensure the form is loaded
|
# Minimal check to ensure the form is loaded
|
||||||
self.assertEqual(your_contact_form["your_contact-first_name"].value, "Testy")
|
self.assertEqual(profile_form["first_name"].value, self.user.first_name)
|
||||||
|
|
||||||
# update the first name of the contact
|
# update the first name of the contact
|
||||||
your_contact_form["your_contact-first_name"] = "Testy2"
|
profile_form["first_name"] = "Testy2"
|
||||||
|
|
||||||
# Submit the updated form
|
# Submit the updated form
|
||||||
your_contact_form.submit()
|
profile_form.submit()
|
||||||
|
|
||||||
domain_request.refresh_from_db()
|
domain_request.refresh_from_db()
|
||||||
|
|
||||||
updated_submitter = domain_request.submitter
|
updated_creator = domain_request.creator
|
||||||
self.assertEquals(submitter_pk, updated_submitter.id)
|
self.assertEquals(creator_pk, updated_creator.id)
|
||||||
self.assertEquals("Testy2", updated_submitter.first_name)
|
self.assertEquals("Testy2", updated_creator.first_name)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
|
||||||
def test_edit_submitter_creates_new(self):
|
|
||||||
"""When you:
|
|
||||||
1. edit an existing your contact which IS joined to another model,
|
|
||||||
2. then submit,
|
|
||||||
the domain request is linked to a new Contact, and the new Contact is updated."""
|
|
||||||
|
|
||||||
# Populate the database with a domain request that
|
|
||||||
# has submitter assigned to it, the submitter is also
|
|
||||||
# an other contact initially
|
|
||||||
# We'll do it from scratch
|
|
||||||
submitter, _ = Contact.objects.get_or_create(
|
|
||||||
first_name="Testy",
|
|
||||||
last_name="Tester",
|
|
||||||
title="Chief Tester",
|
|
||||||
email="testy@town.com",
|
|
||||||
phone="(201) 555 5555",
|
|
||||||
)
|
|
||||||
domain_request, _ = DomainRequest.objects.get_or_create(
|
|
||||||
generic_org_type="federal",
|
|
||||||
federal_type="executive",
|
|
||||||
purpose="Purpose of the site",
|
|
||||||
anything_else="No",
|
|
||||||
is_policy_acknowledged=True,
|
|
||||||
organization_name="Testorg",
|
|
||||||
address_line1="address 1",
|
|
||||||
state_territory="NY",
|
|
||||||
zipcode="10002",
|
|
||||||
creator=self.user,
|
|
||||||
status="started",
|
|
||||||
)
|
|
||||||
domain_request.other_contacts.add(submitter)
|
|
||||||
|
|
||||||
# submitter_pk is the initial pk of the your contact. set it before update
|
|
||||||
# to be able to verify after update that the other contact is still in place
|
|
||||||
# and not updated, and that the new submitter has a new id
|
|
||||||
submitter_pk = submitter.id
|
|
||||||
|
|
||||||
# prime the form by visiting /edit
|
|
||||||
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
|
|
||||||
# and then setting the cookie on each request.
|
|
||||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
|
||||||
|
|
||||||
your_contact_page = self.app.get(reverse("domain-request:your_contact"))
|
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
|
||||||
|
|
||||||
your_contact_form = your_contact_page.forms[0]
|
|
||||||
|
|
||||||
# Minimal check to ensure the form is loaded
|
|
||||||
self.assertEqual(your_contact_form["your_contact-first_name"].value, "Testy")
|
|
||||||
|
|
||||||
# update the first name of the contact
|
|
||||||
your_contact_form["your_contact-first_name"] = "Testy2"
|
|
||||||
|
|
||||||
# Submit the updated form
|
|
||||||
your_contact_form.submit()
|
|
||||||
|
|
||||||
domain_request.refresh_from_db()
|
|
||||||
|
|
||||||
# assert that the other contact is not updated
|
|
||||||
other_contacts = domain_request.other_contacts.all()
|
|
||||||
other_contact = other_contacts[0]
|
|
||||||
self.assertEquals(submitter_pk, other_contact.id)
|
|
||||||
self.assertEquals("Testy", other_contact.first_name)
|
|
||||||
# assert that the submitter is updated
|
|
||||||
submitter = domain_request.submitter
|
|
||||||
self.assertEquals("Testy2", submitter.first_name)
|
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_domain_request_about_your_organiztion_interstate(self):
|
def test_domain_request_about_your_organiztion_interstate(self):
|
||||||
|
@ -2865,7 +2727,6 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
self.assertContains(detail_page, "city1.gov")
|
self.assertContains(detail_page, "city1.gov")
|
||||||
self.assertContains(detail_page, "Chief Tester")
|
self.assertContains(detail_page, "Chief Tester")
|
||||||
self.assertContains(detail_page, "testy@town.com")
|
self.assertContains(detail_page, "testy@town.com")
|
||||||
self.assertContains(detail_page, "Admin Tester")
|
|
||||||
self.assertContains(detail_page, "Status:")
|
self.assertContains(detail_page, "Status:")
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
@ -2882,7 +2743,6 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
self.assertContains(detail_page, "city.gov")
|
self.assertContains(detail_page, "city.gov")
|
||||||
self.assertContains(detail_page, "Chief Tester")
|
self.assertContains(detail_page, "Chief Tester")
|
||||||
self.assertContains(detail_page, "testy@town.com")
|
self.assertContains(detail_page, "testy@town.com")
|
||||||
self.assertContains(detail_page, "Admin Tester")
|
|
||||||
self.assertContains(detail_page, "Status:")
|
self.assertContains(detail_page, "Status:")
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
@ -2896,7 +2756,6 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
self.assertContains(detail_page, "city1.gov")
|
self.assertContains(detail_page, "city1.gov")
|
||||||
self.assertContains(detail_page, "Chief Tester")
|
self.assertContains(detail_page, "Chief Tester")
|
||||||
self.assertContains(detail_page, "testy@town.com")
|
self.assertContains(detail_page, "testy@town.com")
|
||||||
self.assertContains(detail_page, "Admin Tester")
|
|
||||||
self.assertContains(detail_page, "Status:")
|
self.assertContains(detail_page, "Status:")
|
||||||
# click the "Withdraw request" button
|
# click the "Withdraw request" button
|
||||||
mock_client = MockSESClient()
|
mock_client = MockSESClient()
|
||||||
|
@ -2929,7 +2788,6 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
||||||
self.assertContains(detail_page, "city1.gov")
|
self.assertContains(detail_page, "city1.gov")
|
||||||
self.assertContains(detail_page, "Chief Tester")
|
self.assertContains(detail_page, "Chief Tester")
|
||||||
self.assertContains(detail_page, "testy@town.com")
|
self.assertContains(detail_page, "testy@town.com")
|
||||||
self.assertContains(detail_page, "Admin Tester")
|
|
||||||
self.assertContains(detail_page, "Status:")
|
self.assertContains(detail_page, "Status:")
|
||||||
# Restricted user trying to withdraw results in 403 error
|
# Restricted user trying to withdraw results in 403 error
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
|
@ -3028,10 +2886,10 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
self.assertEqual(detail_page.status_code, 200)
|
self.assertEqual(detail_page.status_code, 200)
|
||||||
|
|
||||||
# 10 unlocked steps, one active step, the review step will have link_usa but not check_circle
|
# 10 unlocked steps, one active step, the review step will have link_usa but not check_circle
|
||||||
self.assertContains(detail_page, "#check_circle", count=10)
|
self.assertContains(detail_page, "#check_circle", count=9)
|
||||||
# Type of organization
|
# Type of organization
|
||||||
self.assertContains(detail_page, "usa-current", count=1)
|
self.assertContains(detail_page, "usa-current", count=1)
|
||||||
self.assertContains(detail_page, "link_usa-checked", count=11)
|
self.assertContains(detail_page, "link_usa-checked", count=10)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.fail(f"Expected a redirect, but got a different response: {response}")
|
self.fail(f"Expected a redirect, but got a different response: {response}")
|
||||||
|
@ -3090,10 +2948,10 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
|
|
||||||
# 5 unlocked steps (so, domain, submitter, other contacts, and current sites
|
# 5 unlocked steps (so, domain, submitter, other contacts, and current sites
|
||||||
# which unlocks if domain exists), one active step, the review step is locked
|
# which unlocks if domain exists), one active step, the review step is locked
|
||||||
self.assertContains(detail_page, "#check_circle", count=5)
|
self.assertContains(detail_page, "#check_circle", count=4)
|
||||||
# Type of organization
|
# Type of organization
|
||||||
self.assertContains(detail_page, "usa-current", count=1)
|
self.assertContains(detail_page, "usa-current", count=1)
|
||||||
self.assertContains(detail_page, "link_usa-checked", count=5)
|
self.assertContains(detail_page, "link_usa-checked", count=4)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.fail(f"Expected a redirect, but got a different response: {response}")
|
self.fail(f"Expected a redirect, but got a different response: {response}")
|
||||||
|
|
|
@ -8,7 +8,6 @@ from .domain import (
|
||||||
DomainNameserversView,
|
DomainNameserversView,
|
||||||
DomainDNSSECView,
|
DomainDNSSECView,
|
||||||
DomainDsDataView,
|
DomainDsDataView,
|
||||||
DomainYourContactInformationView,
|
|
||||||
DomainSecurityEmailView,
|
DomainSecurityEmailView,
|
||||||
DomainUsersView,
|
DomainUsersView,
|
||||||
DomainAddUserView,
|
DomainAddUserView,
|
||||||
|
|
|
@ -637,38 +637,6 @@ class DomainDsDataView(DomainFormBaseView):
|
||||||
return super().form_valid(formset)
|
return super().form_valid(formset)
|
||||||
|
|
||||||
|
|
||||||
class DomainYourContactInformationView(DomainFormBaseView):
|
|
||||||
"""Domain your contact information editing view."""
|
|
||||||
|
|
||||||
template_name = "domain_your_contact_information.html"
|
|
||||||
form_class = UserForm
|
|
||||||
|
|
||||||
@waffle_flag("!profile_feature") # type: ignore
|
|
||||||
def dispatch(self, request, *args, **kwargs): # type: ignore
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
def get_form_kwargs(self, *args, **kwargs):
|
|
||||||
"""Add domain_info.submitter instance to make a bound form."""
|
|
||||||
form_kwargs = super().get_form_kwargs(*args, **kwargs)
|
|
||||||
form_kwargs["instance"] = self.request.user
|
|
||||||
return form_kwargs
|
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
"""Redirect to the your contact information for the domain."""
|
|
||||||
return reverse("domain-your-contact-information", kwargs={"pk": self.object.pk})
|
|
||||||
|
|
||||||
def form_valid(self, form):
|
|
||||||
"""The form is valid, call setter in model."""
|
|
||||||
|
|
||||||
# Post to DB using values from the form
|
|
||||||
form.save()
|
|
||||||
|
|
||||||
messages.success(self.request, "Your contact information for all your domains has been updated.")
|
|
||||||
|
|
||||||
# superclass has the redirect
|
|
||||||
return super().form_valid(form)
|
|
||||||
|
|
||||||
|
|
||||||
class DomainSecurityEmailView(DomainFormBaseView):
|
class DomainSecurityEmailView(DomainFormBaseView):
|
||||||
"""Domain security email editing view."""
|
"""Domain security email editing view."""
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ class Step(StrEnum):
|
||||||
CURRENT_SITES = "current_sites"
|
CURRENT_SITES = "current_sites"
|
||||||
DOTGOV_DOMAIN = "dotgov_domain"
|
DOTGOV_DOMAIN = "dotgov_domain"
|
||||||
PURPOSE = "purpose"
|
PURPOSE = "purpose"
|
||||||
YOUR_CONTACT = "your_contact"
|
|
||||||
OTHER_CONTACTS = "other_contacts"
|
OTHER_CONTACTS = "other_contacts"
|
||||||
ADDITIONAL_DETAILS = "additional_details"
|
ADDITIONAL_DETAILS = "additional_details"
|
||||||
REQUIREMENTS = "requirements"
|
REQUIREMENTS = "requirements"
|
||||||
|
@ -91,7 +90,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
Step.CURRENT_SITES: _("Current websites"),
|
Step.CURRENT_SITES: _("Current websites"),
|
||||||
Step.DOTGOV_DOMAIN: _(".gov domain"),
|
Step.DOTGOV_DOMAIN: _(".gov domain"),
|
||||||
Step.PURPOSE: _("Purpose of your domain"),
|
Step.PURPOSE: _("Purpose of your domain"),
|
||||||
Step.YOUR_CONTACT: _("Your contact information"),
|
|
||||||
Step.OTHER_CONTACTS: _("Other employees from your organization"),
|
Step.OTHER_CONTACTS: _("Other employees from your organization"),
|
||||||
Step.ADDITIONAL_DETAILS: _("Additional details"),
|
Step.ADDITIONAL_DETAILS: _("Additional details"),
|
||||||
Step.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
Step.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
||||||
|
@ -375,7 +373,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
),
|
),
|
||||||
"dotgov_domain": self.domain_request.requested_domain is not None,
|
"dotgov_domain": self.domain_request.requested_domain is not None,
|
||||||
"purpose": self.domain_request.purpose is not None,
|
"purpose": self.domain_request.purpose is not None,
|
||||||
"your_contact": self.domain_request.creator is not None,
|
|
||||||
"other_contacts": (
|
"other_contacts": (
|
||||||
self.domain_request.other_contacts.exists()
|
self.domain_request.other_contacts.exists()
|
||||||
or self.domain_request.no_other_contacts_rationale is not None
|
or self.domain_request.no_other_contacts_rationale is not None
|
||||||
|
@ -439,9 +436,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
if condition:
|
if condition:
|
||||||
step_list.append(step)
|
step_list.append(step)
|
||||||
|
|
||||||
if flag_is_active(self.request, "profile_feature"):
|
|
||||||
step_list.remove(Step.YOUR_CONTACT)
|
|
||||||
|
|
||||||
return step_list
|
return step_list
|
||||||
|
|
||||||
def goto(self, step):
|
def goto(self, step):
|
||||||
|
@ -582,15 +576,6 @@ class Purpose(DomainRequestWizard):
|
||||||
forms = [forms.PurposeForm]
|
forms = [forms.PurposeForm]
|
||||||
|
|
||||||
|
|
||||||
class YourContact(DomainRequestWizard):
|
|
||||||
template_name = "domain_request_your_contact.html"
|
|
||||||
forms = [forms.YourContactForm]
|
|
||||||
|
|
||||||
@waffle_flag("!profile_feature") # type: ignore
|
|
||||||
def dispatch(self, request, *args, **kwargs): # type: ignore
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class OtherContacts(DomainRequestWizard):
|
class OtherContacts(DomainRequestWizard):
|
||||||
template_name = "domain_request_other_contacts.html"
|
template_name = "domain_request_other_contacts.html"
|
||||||
forms = [forms.OtherContactsYesNoForm, forms.OtherContactsFormSet, forms.NoOtherContactsForm]
|
forms = [forms.OtherContactsYesNoForm, forms.OtherContactsFormSet, forms.NoOtherContactsForm]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue