mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-16 06:24:12 +02:00
Linting
This commit is contained in:
parent
1d44a4027e
commit
244753210b
5 changed files with 13 additions and 40 deletions
|
@ -269,26 +269,6 @@ class CreateOrUpdateOrganizationTypeHelper:
|
|||
return True
|
||||
|
||||
|
||||
def to_database(form, obj):
|
||||
"""
|
||||
Adds the form's cleaned data to `obj` and saves `obj`.
|
||||
|
||||
Does nothing if form is not valid.
|
||||
"""
|
||||
if not form.is_valid():
|
||||
return None
|
||||
for name, value in form.cleaned_data.items():
|
||||
setattr(obj, name, value)
|
||||
obj.save()
|
||||
|
||||
|
||||
def from_database(form_class, obj):
|
||||
"""Returns a dict of form field values gotten from `obj`."""
|
||||
if obj is None:
|
||||
return {}
|
||||
return {name: getattr(obj, name) for name in form_class.declared_fields.keys()} # type: ignore
|
||||
|
||||
|
||||
def replace_url_queryparams(url_to_modify: str, query_params: dict[Any, list]):
|
||||
"""
|
||||
Replaces the query parameters of a given URL.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Contains middleware used in settings.py
|
||||
"""
|
||||
|
||||
from urllib.parse import urlparse, urlunparse, parse_qs, urlencode
|
||||
from urllib.parse import parse_qs
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from waffle.decorators import flag_is_active
|
||||
|
@ -41,7 +41,7 @@ class CheckUserProfileMiddleware:
|
|||
request.user.contact.first_name,
|
||||
request.user.contact.last_name,
|
||||
request.user.contact.title,
|
||||
request.user.contact.phone
|
||||
request.user.contact.phone,
|
||||
]
|
||||
if None in user_values:
|
||||
finished_setup = False
|
||||
|
|
|
@ -522,6 +522,7 @@ class HomeTests(TestWithUser):
|
|||
|
||||
class FinishUserProfileTests(TestWithUser, WebTest):
|
||||
"""A series of tests that target the finish setup page for user profile"""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.user.title = None
|
||||
|
@ -619,7 +620,6 @@ class FinishUserProfileTests(TestWithUser, WebTest):
|
|||
self.assertContains(completed_setup_page, "How we’ll reach you")
|
||||
self.assertContains(completed_setup_page, "Your contact information")
|
||||
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_new_user_with_profile_feature_off(self):
|
||||
"""Tests that a new user is not redirected to the profile setup page when profile_feature is off"""
|
||||
|
|
|
@ -89,7 +89,6 @@ class UserProfileView(UserProfilePermissionView, FormMixin):
|
|||
return None
|
||||
|
||||
|
||||
|
||||
class FinishProfileSetupView(UserProfileView):
|
||||
"""This view forces the user into providing additional details that
|
||||
we may have missed from Login.gov"""
|
||||
|
@ -139,7 +138,6 @@ class FinishProfileSetupView(UserProfileView):
|
|||
f'and log back in. <a class="usa-link" href={help_url}>Get help with your Login.gov account.</a>'
|
||||
) # nosec
|
||||
|
||||
|
||||
def get_success_message(self, cleaned_data):
|
||||
"""Content of the returned success message"""
|
||||
return "Your profile has been successfully updated."
|
||||
|
@ -227,10 +225,7 @@ class FinishProfileSetupView(UserProfileView):
|
|||
"""
|
||||
|
||||
# These redirect types redirect to the same page
|
||||
self_redirect = [
|
||||
self.RedirectType.BACK_TO_SELF,
|
||||
self.RedirectType.COMPLETE_SETUP
|
||||
]
|
||||
self_redirect = [self.RedirectType.BACK_TO_SELF, self.RedirectType.COMPLETE_SETUP]
|
||||
|
||||
# Maps the redirect type to a URL
|
||||
base_url = ""
|
||||
|
@ -256,4 +251,3 @@ class FinishProfileSetupView(UserProfileView):
|
|||
# Generate the full url from the given query params
|
||||
full_url = replace_url_queryparams(base_url, query_params)
|
||||
return full_url
|
||||
|
||||
|
|
|
@ -161,4 +161,3 @@ class UserProfilePermissionView(UserProfilePermission, DetailView, abc.ABC):
|
|||
@abc.abstractmethod
|
||||
def template_name(self):
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue