mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 06:55:08 +02:00
formatted for linter
This commit is contained in:
parent
a90b124b93
commit
cd94342d5c
3 changed files with 31 additions and 33 deletions
|
@ -510,6 +510,7 @@ class HomeTests(TestWithUser):
|
|||
response = self.client.get("/request/", follow=True)
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
|
||||
class UserProfileTests(TestWithUser, WebTest):
|
||||
"""A series of tests that target your profile functionality"""
|
||||
|
||||
|
@ -528,9 +529,6 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
self.domain.delete()
|
||||
Contact.objects.all().delete()
|
||||
|
||||
|
||||
|
||||
# - profile_submission (see your contact tests)
|
||||
# - error_500_main_nav_with_profile_feature_turned_on
|
||||
# - error_403_main_nav_with_profile_feature_turned_on
|
||||
# - error_401_main_nav_with_profile_feature_turned_on
|
||||
|
@ -538,53 +536,52 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
# - error_403_main_nav_with_profile_feature_turned_off
|
||||
# - error_401_main_nav_with_profile_feature_turned_off
|
||||
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_home_page_main_nav_with_profile_feature_on(self):
|
||||
"""test that Your profile is in main nav of home page when profile_feature is on"""
|
||||
with override_flag('profile_feature', active=True):
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get("/")
|
||||
self.assertContains(response, "Your profile")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_home_page_main_nav_with_profile_feature_off(self):
|
||||
"""test that Your profile is not in main nav of home page when profile_feature is off"""
|
||||
with override_flag('profile_feature', active=False):
|
||||
with override_flag("profile_feature", active=False):
|
||||
response = self.client.get("/")
|
||||
self.assertNotContains(response, "Your profile")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_new_request_main_nav_with_profile_feature_on(self):
|
||||
"""test that Your profile is in main nav of new request when profile_feature is on"""
|
||||
with override_flag('profile_feature', active=True):
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get("/request/")
|
||||
self.assertContains(response, "Your profile")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_new_request_main_nav_with_profile_feature_off(self):
|
||||
"""test that Your profile is not in main nav of new request when profile_feature is off"""
|
||||
with override_flag('profile_feature', active=False):
|
||||
with override_flag("profile_feature", active=False):
|
||||
response = self.client.get("/request/")
|
||||
self.assertNotContains(response, "Your profile")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_user_profile_main_nav_with_profile_feature_on(self):
|
||||
"""test that Your profile is in main nav of user profile when profile_feature is on"""
|
||||
with override_flag('profile_feature', active=True):
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get("/user-profile")
|
||||
self.assertContains(response, "Your profile")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_user_profile_returns_404_when_feature_off(self):
|
||||
"""test that Your profile returns 404 when profile_feature is off"""
|
||||
with override_flag('profile_feature', active=False):
|
||||
with override_flag("profile_feature", active=False):
|
||||
response = self.client.get("/user-profile")
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_domain_detail_profile_feature_on(self):
|
||||
"""test that domain detail view when profile_feature is on"""
|
||||
with override_flag('profile_feature', active=True):
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get(reverse("domain", args=[self.domain.pk]))
|
||||
self.assertContains(response, "Your profile")
|
||||
self.assertNotContains(response, "Your contact information")
|
||||
|
@ -592,14 +589,14 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
@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):
|
||||
with override_flag("profile_feature", active=False):
|
||||
response = self.client.get(f"/domain/{self.domain.id}/your-contact-information")
|
||||
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):
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get(f"/domain/{self.domain.id}/your-contact-information")
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
|
@ -616,7 +613,7 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
authorizing_official=contact_user,
|
||||
submitter=contact_user,
|
||||
)
|
||||
with override_flag('profile_feature', active=True):
|
||||
with override_flag("profile_feature", active=True):
|
||||
response = self.client.get(f"/domain-request/{domain_request.id}")
|
||||
self.assertContains(response, "Your profile")
|
||||
response = self.client.get(f"/domain-request/{domain_request.id}/withdraw")
|
||||
|
@ -638,7 +635,7 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
authorizing_official=contact_user,
|
||||
submitter=contact_user,
|
||||
)
|
||||
with override_flag('profile_feature', active=False):
|
||||
with override_flag("profile_feature", active=False):
|
||||
response = self.client.get(f"/domain-request/{domain_request.id}")
|
||||
self.assertNotContains(response, "Your profile")
|
||||
response = self.client.get(f"/domain-request/{domain_request.id}/withdraw")
|
||||
|
@ -651,7 +648,7 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
def test_user_profile_form_submission(self):
|
||||
"""test user profile form submission"""
|
||||
self.app.set_user(self.user.username)
|
||||
with override_flag('profile_feature', active=True):
|
||||
with override_flag("profile_feature", active=True):
|
||||
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)
|
||||
|
@ -670,4 +667,3 @@ class UserProfileTests(TestWithUser, WebTest):
|
|||
profile_page = profile_page.follow()
|
||||
self.assertEqual(profile_page.status_code, 200)
|
||||
self.assertContains(profile_page, "Your profile has been updated")
|
||||
|
||||
|
|
|
@ -575,8 +575,8 @@ class DomainYourContactInformationView(DomainFormBaseView):
|
|||
template_name = "domain_your_contact_information.html"
|
||||
form_class = ContactForm
|
||||
|
||||
@waffle_flag("!profile_feature")
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
@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):
|
||||
|
|
|
@ -14,8 +14,10 @@ from registrar.models import (
|
|||
from registrar.views.utility.permission_views import UserProfilePermissionView
|
||||
from waffle.decorators import flag_is_active, waffle_flag
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class UserProfileView(UserProfilePermissionView, FormMixin):
|
||||
"""
|
||||
Base View for the User Profile. Handles getting and setting the User Profile
|
||||
|
@ -33,8 +35,8 @@ class UserProfileView(UserProfilePermissionView, FormMixin):
|
|||
context = self.get_context_data(object=self.object, form=form)
|
||||
return self.render_to_response(context)
|
||||
|
||||
@waffle_flag("profile_feature")
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
@waffle_flag("profile_feature") # type: ignore
|
||||
def dispatch(self, request, *args, **kwargs): # type: ignore
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue