Fix unit tests

This commit is contained in:
zandercymatics 2024-05-28 14:16:09 -06:00
parent e34c724264
commit 82394c6d04
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 14 additions and 17 deletions

View file

@ -33,7 +33,7 @@
Your contact information
</legend>
{% with show_edit_button=True show_readonly=True group_classes="usa-form-editable--no-border padding-top-2" %}
{% with show_edit_button=True show_readonly=True group_classes="usa-form-editable usa-form-editable--no-border padding-top-2" %}
{% input_with_errors form.full_name %}
{% endwith %}
@ -52,7 +52,7 @@
</div>
{% public_site_url "help/account-management/#get-help-with-login.gov" as login_help_url %}
{% with show_readonly=True add_class="display-none" group_classes="usa-form-editable padding-top-2 bold-usa-label" %}
{% with show_readonly=True add_class="display-none" group_classes="usa-form-editable usa-form-editable padding-top-2 bold-usa-label" %}
{% with link_href=login_help_url %}
{% with sublabel_text="We recommend using your work email for your .gov account. If the wrong email is displayed below, youll need to update your Login.gov account and log back in. Get help with your Login.gov account." %}
{% with link_text="Get help with your Login.gov account" target_blank=True do_not_show_max_chars=True %}
@ -62,11 +62,11 @@
{% endwith %}
{% endwith %}
{% with show_edit_button=True show_readonly=True group_classes="padding-top-2" %}
{% with show_edit_button=True show_readonly=True group_classes="usa-form-editable padding-top-2" %}
{% input_with_errors form.title %}
{% endwith %}
{% with show_edit_button=True show_readonly=True group_classes="padding-top-2" %}
{% with show_edit_button=True show_readonly=True group_classes="usa-form-editable padding-top-2" %}
{% with add_class="usa-input--medium" %}
{% input_with_errors form.phone %}
{% endwith %}

View file

@ -97,10 +97,6 @@ def input_with_errors(context, field=None): # noqa: C901
# Used such that we can toggle it with JS
if "display-none" not in classes:
classes.append("display-none")
# Tag that this form contains the edit button.
if "usa-form-editable" not in group_classes:
group_classes.append("usa-form-editable")
attrs["id"] = field.auto_id

View file

@ -628,9 +628,12 @@ class FinishUserProfileTests(TestWithUser, WebTest):
completed_setup_page = self._submit_form_webtest(finish_setup_page.form, follow=True)
self.assertEqual(completed_setup_page.status_code, 200)
# Assert that we're on the domain request page
self.assertContains(completed_setup_page, "How well reach you")
self.assertContains(completed_setup_page, "Your contact information")
self.assertNotContains(completed_setup_page, "Finish setting up your profile")
self.assertNotContains(completed_setup_page, "What contact information should we use to reach you?")
self.assertContains(completed_setup_page, "Youre about to start your .gov domain request")
@less_console_noise_decorator
def test_new_user_with_profile_feature_off(self):
@ -645,8 +648,11 @@ class FinishUserProfileTests(TestWithUser, WebTest):
when profile_feature is off but not the setup page"""
with override_flag("profile_feature", active=False):
response = self.client.get("/request/")
self.assertContains(response, "How well reach you")
self.assertContains(response, "Your contact information")
self.assertNotContains(response, "Finish setting up your profile")
self.assertNotContains(response, "What contact information should we use to reach you?")
self.assertContains(response, "Youre about to start your .gov domain request")
class UserProfileTests(TestWithUser, WebTest):
@ -806,11 +812,6 @@ class UserProfileTests(TestWithUser, WebTest):
profile_page = self.app.get(reverse("user-profile"))
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
profile_form = profile_page.form
profile_page = profile_form.submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
profile_form = profile_page.form
profile_form["title"] = "sample title"
profile_form["phone"] = "(201) 555-1212"