mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 06:24:45 +02:00
Test for page jumping logic and fix linting
This commit is contained in:
parent
b2905068b1
commit
427bd132e2
2 changed files with 30 additions and 2 deletions
|
@ -12,7 +12,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.urls import resolve
|
from django.urls import resolve
|
||||||
|
|
||||||
from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore
|
from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore
|
||||||
from formtools.wizard.storage.session import SessionStorage
|
from formtools.wizard.storage.session import SessionStorage # type: ignore
|
||||||
|
|
||||||
from registrar.models import Contact, DomainApplication, Domain
|
from registrar.models import Contact, DomainApplication, Domain
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.contrib.auth import get_user_model
|
||||||
from django_webtest import WebTest # type: ignore
|
from django_webtest import WebTest # type: ignore
|
||||||
|
|
||||||
from registrar.models import DomainApplication, Domain, Contact, Website
|
from registrar.models import DomainApplication, Domain, Contact, Website
|
||||||
from registrar.forms.application_wizard import TITLES
|
from registrar.forms.application_wizard import TITLES, Step
|
||||||
|
|
||||||
from .common import less_console_noise
|
from .common import less_console_noise
|
||||||
|
|
||||||
|
@ -617,6 +617,34 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
contact_page = election_result.follow()
|
contact_page = election_result.follow()
|
||||||
self.assertNotContains(contact_page, "Federal agency")
|
self.assertNotContains(contact_page, "Federal agency")
|
||||||
|
|
||||||
|
def test_application_form_section_skipping(self):
|
||||||
|
"""Can skip forward and back in sections"""
|
||||||
|
type_page = self.app.get(reverse("application")).follow()
|
||||||
|
# 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]
|
||||||
|
|
||||||
|
type_form = type_page.form
|
||||||
|
type_form["organization_type-organization_type"] = "federal"
|
||||||
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
type_result = type_page.form.submit()
|
||||||
|
|
||||||
|
# follow first redirect
|
||||||
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
federal_page = type_result.follow()
|
||||||
|
|
||||||
|
# Now on federal type page, click back to the organization type
|
||||||
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
|
new_page = federal_page.click(TITLES[Step.ORGANIZATION_TYPE], index=0)
|
||||||
|
|
||||||
|
# Should be a link to the organization_federal page
|
||||||
|
self.assertGreater(
|
||||||
|
len(new_page.html.find_all("a", href="/register/organization_federal/")),
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
|
||||||
@skip("WIP")
|
@skip("WIP")
|
||||||
def test_application_edit_restore(self):
|
def test_application_edit_restore(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue