Merge pull request #452 from cisagov/jon/save_progress_removed

Save Progress button Removed
This commit is contained in:
Jon 2023-03-08 12:08:42 -05:00 committed by GitHub
commit 96c73471e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 120 deletions

View file

@ -70,12 +70,6 @@
class="usa-button"
>Submit your domain request</button>
{% endif %}
<button
type="submit"
name="submit_button"
value="save"
class="usa-button usa-button--outline"
>Save progress</button>
</div>
{% endblock %}

View file

@ -135,19 +135,12 @@ class DomainApplicationTests(TestWithUser, WebTest):
type_form = type_page.form
type_form["organization_type-organization_type"] = "federal"
# test saving the page
# test next button and validate data
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = type_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/organization_type/")
type_result = type_page.form.submit()
# should see results in db
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.organization_type, "federal")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_page.form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(type_result.status_code, 302)
@ -161,19 +154,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
federal_form = federal_page.form
federal_form["organization_federal-federal_type"] = "executive"
# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = federal_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/organization_federal/")
# should see results in db
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.federal_type, "executive")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
federal_result = federal_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.federal_type, "executive")
# the post request should return a redirect to the next form in
# the application
self.assertEquals(federal_result.status_code, 302)
self.assertEquals(federal_result["Location"], "/register/organization_contact/")
num_pages_tested += 1
@ -195,12 +183,10 @@ class DomainApplicationTests(TestWithUser, WebTest):
org_contact_form["organization_contact-zipcode"] = "10002"
org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks"
# test saving the page
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = org_contact_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/organization_contact/")
# should see results in db
org_contact_result = org_contact_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.organization_name, "Testorg")
self.assertEquals(application.address_line1, "address 1")
@ -209,11 +195,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
self.assertEquals(application.state_territory, "NY")
self.assertEquals(application.zipcode, "10002")
self.assertEquals(application.urbanization, "URB Royal Oaks")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
org_contact_result = org_contact_form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(org_contact_result.status_code, 302)
self.assertEquals(
org_contact_result["Location"], "/register/authorizing_official/"
@ -231,23 +214,18 @@ class DomainApplicationTests(TestWithUser, WebTest):
ao_form["authorizing_official-email"] = "testy@town.com"
ao_form["authorizing_official-phone"] = "(201) 555 5555"
# test saving the page
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = ao_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/authorizing_official/")
# should see results in db
ao_result = ao_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.authorizing_official.first_name, "Testy ATO")
self.assertEquals(application.authorizing_official.last_name, "Tester ATO")
self.assertEquals(application.authorizing_official.title, "Chief Tester")
self.assertEquals(application.authorizing_official.email, "testy@town.com")
self.assertEquals(application.authorizing_official.phone, "(201) 555 5555")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
ao_result = ao_form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(ao_result.status_code, 302)
self.assertEquals(ao_result["Location"], "/register/current_sites/")
num_pages_tested += 1
@ -259,22 +237,17 @@ class DomainApplicationTests(TestWithUser, WebTest):
current_sites_form = current_sites_page.form
current_sites_form["current_sites-0-website"] = "www.city.com"
# test saving the page
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = current_sites_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/current_sites/")
# should see results in db
current_sites_result = current_sites_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(
application.current_websites.filter(website="http://www.city.com").count(),
1,
)
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
current_sites_result = current_sites_form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(current_sites_result.status_code, 302)
self.assertEquals(current_sites_result["Location"], "/register/dotgov_domain/")
num_pages_tested += 1
@ -287,21 +260,16 @@ class DomainApplicationTests(TestWithUser, WebTest):
dotgov_form["dotgov_domain-requested_domain"] = "city"
dotgov_form["dotgov_domain-0-alternative_domain"] = "city1"
# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = dotgov_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/dotgov_domain/")
# should see results in db
dotgov_result = dotgov_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.requested_domain.name, "city.gov")
self.assertEquals(
application.alternative_domains.filter(website="city1.gov").count(), 1
)
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
dotgov_result = dotgov_form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(dotgov_result.status_code, 302)
self.assertEquals(dotgov_result["Location"], "/register/purpose/")
num_pages_tested += 1
@ -313,19 +281,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
purpose_form = purpose_page.form
purpose_form["purpose-purpose"] = "For all kinds of things."
# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = purpose_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/purpose/")
# should see results in db
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.purpose, "For all kinds of things.")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
purpose_result = purpose_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.purpose, "For all kinds of things.")
# the post request should return a redirect to the next form in
# the application
self.assertEquals(purpose_result.status_code, 302)
self.assertEquals(purpose_result["Location"], "/register/your_contact/")
num_pages_tested += 1
@ -342,23 +305,18 @@ class DomainApplicationTests(TestWithUser, WebTest):
your_contact_form["your_contact-email"] = "testy-admin@town.com"
your_contact_form["your_contact-phone"] = "(201) 555 5556"
# test saving the page
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = your_contact_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/your_contact/")
# should see results in db
your_contact_result = your_contact_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.submitter.first_name, "Testy you")
self.assertEquals(application.submitter.last_name, "Tester you")
self.assertEquals(application.submitter.title, "Admin Tester")
self.assertEquals(application.submitter.email, "testy-admin@town.com")
self.assertEquals(application.submitter.phone, "(201) 555 5556")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
your_contact_result = your_contact_form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(your_contact_result.status_code, 302)
self.assertEquals(your_contact_result["Location"], "/register/other_contacts/")
num_pages_tested += 1
@ -375,12 +333,10 @@ class DomainApplicationTests(TestWithUser, WebTest):
other_contacts_form["other_contacts-0-email"] = "testy2@town.com"
other_contacts_form["other_contacts-0-phone"] = "(201) 555 5557"
# test saving the page
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = other_contacts_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/other_contacts/")
# should see results in db
other_contacts_result = other_contacts_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(
application.other_contacts.filter(
@ -392,11 +348,8 @@ class DomainApplicationTests(TestWithUser, WebTest):
).count(),
1,
)
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
other_contacts_result = other_contacts_form.submit()
# the post request should return a redirect to the next form in
# the application
self.assertEquals(other_contacts_result.status_code, 302)
self.assertEquals(other_contacts_result["Location"], "/register/anything_else/")
num_pages_tested += 1
@ -409,19 +362,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
anything_else_form["anything_else-anything_else"] = "Nothing else."
# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = anything_else_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/anything_else/")
# should see results in db
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.anything_else, "Nothing else.")
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
anything_else_result = anything_else_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.anything_else, "Nothing else.")
# the post request should return a redirect to the next form in
# the application
self.assertEquals(anything_else_result.status_code, 302)
self.assertEquals(anything_else_result["Location"], "/register/requirements/")
num_pages_tested += 1
@ -434,19 +382,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
requirements_form["requirements-is_policy_acknowledged"] = True
# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = requirements_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/requirements/")
# should see results in db
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.is_policy_acknowledged, True)
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
requirements_result = requirements_form.submit()
# validate that data from this step are being saved
application = DomainApplication.objects.get() # there's only one
self.assertEquals(application.is_policy_acknowledged, True)
# the post request should return a redirect to the next form in
# the application
self.assertEquals(requirements_result.status_code, 302)
self.assertEquals(requirements_result["Location"], "/register/review/")
num_pages_tested += 1
@ -488,12 +431,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
self.assertContains(review_page, "(201) 555-5557")
self.assertContains(review_page, "Nothing else.")
# test saving the page
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
result = review_page.form.submit("submit_button", value="save")
# should remain on the same page
self.assertEquals(result["Location"], "/register/review/")
# final submission results in a redirect to the "finished" URL
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
with less_console_noise():