mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 18:25:58 +02:00
updated tests
This commit is contained in:
parent
2ced462f94
commit
e0df3ed453
2 changed files with 15 additions and 5 deletions
|
@ -530,8 +530,11 @@ class FinishUserProfileTests(TestWithUser, WebTest):
|
|||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
||||
def _submit_form_webtest(self, form, follow=False):
|
||||
page = form.submit()
|
||||
def _submit_form_webtest(self, form, follow=False, name=None):
|
||||
if name:
|
||||
page = form.submit(name=name)
|
||||
else:
|
||||
page = form.submit()
|
||||
self._set_session_cookie()
|
||||
return page.follow() if follow else page
|
||||
|
||||
|
@ -605,6 +608,13 @@ class FinishUserProfileTests(TestWithUser, WebTest):
|
|||
|
||||
self.assertEqual(completed_setup_page.status_code, 200)
|
||||
|
||||
finish_setup_form = completed_setup_page.form
|
||||
|
||||
# Submit the form using the specific submit button to execute the redirect
|
||||
completed_setup_page = self._submit_form_webtest(finish_setup_form, follow=True, name="contact_setup_submit_button")
|
||||
self.assertEqual(completed_setup_page.status_code, 200)
|
||||
|
||||
# Assert that we are still on the
|
||||
# Assert that we're on the domain request page
|
||||
self.assertNotContains(completed_setup_page, "Finish setting up your profile")
|
||||
self.assertNotContains(completed_setup_page, "What contact information should we use to reach you?")
|
||||
|
@ -822,7 +832,7 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
"""tests user profile when profile_feature is on,
|
||||
and when they are redirected from the domain request page"""
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get("/user-profile?return_to_request=True")
|
||||
response = self.client.get("/user-profile?redirect=domain-request:")
|
||||
self.assertContains(response, "Your profile")
|
||||
self.assertContains(response, "Go back to your domain request")
|
||||
self.assertNotContains(response, "Back to manage your domains")
|
||||
|
|
|
@ -62,7 +62,7 @@ class UserProfileView(UserProfilePermissionView, FormMixin):
|
|||
|
||||
# Set the profile_back_button_text based on the redirect parameter
|
||||
if kwargs.get("redirect") == "domain-request:":
|
||||
context["profile_back_button_text"] = "Go back to your request"
|
||||
context["profile_back_button_text"] = "Go back to your domain request"
|
||||
else:
|
||||
context["profile_back_button_text"] = "Go to manage your domains"
|
||||
|
||||
|
@ -159,7 +159,7 @@ class FinishProfileSetupView(UserProfileView):
|
|||
|
||||
# Get the current form and validate it
|
||||
if form.is_valid():
|
||||
self.redirect_page = True
|
||||
self.redirect_page = False
|
||||
if "contact_setup_save_button" in request.POST:
|
||||
# Logic for when the 'Save' button is clicked, which indicates
|
||||
# user should stay on this page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue