Skip to content

Commit

Permalink
update app settings form and view naming (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jan 16, 2025
1 parent b0c8a66 commit ba80c65
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Changed
- Update UI for site read-only mode (#24)
- **Userprofile**
- Update UI for site read-only mode (#24)
- Rename ``UserAppSettingsForm`` and ``UserAppSettingsView`` (#1544)

Fixed
-----
Expand Down
2 changes: 1 addition & 1 deletion projectroles/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
),
path(
route='site-app-settings',
view=views.SiteAppSettingsFormView.as_view(),
view=views.SiteAppSettingsView.as_view(),
name='site_app_settings',
),
# Remote site and project views
Expand Down
2 changes: 1 addition & 1 deletion projectroles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,7 @@ def get_success_url(self):
# Site App Setting management --------------------------------------------------


class SiteAppSettingsFormView(
class SiteAppSettingsView(
LoginRequiredMixin, LoggedInPermissionMixin, InvalidFormMixin, FormView
):
"""Site app settings form view"""
Expand Down
2 changes: 1 addition & 1 deletion userprofile/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
APP_SETTING_TYPE_STRING = SODAR_CONSTANTS['APP_SETTING_TYPE_STRING']


class UserSettingsForm(SODARForm):
class UserAppSettingsForm(SODARForm):
"""Form for configuring user settings"""

def _set_app_setting_field(self, plugin_name, s_field, s_def):
Expand Down
4 changes: 2 additions & 2 deletions userprofile/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ def test_additional_email_target(self):
)


class TestUserSettingsView(UITestBase):
"""Tests for UserSettingsView"""
class TestUserAppSettingsView(UITestBase):
"""Tests for UserAppSettingsView"""

def setUp(self):
super().setUp()
Expand Down
8 changes: 4 additions & 4 deletions userprofile/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def test_get_additional_email(self):
self.assertEqual(response.context['add_emails'].count(), 2)


class TestUserSettingsView(AppSettingMixin, UserViewTestBase):
"""Tests for UserSettingsView"""
class TestUserAppSettingsView(AppSettingMixin, UserViewTestBase):
"""Tests for UserAppSettingsView"""

def _get_setting(self, name):
return app_settings.get(EXAMPLE_APP_NAME, name, user=self.user)
Expand Down Expand Up @@ -147,7 +147,7 @@ def setUp(self):
)

def test_get(self):
"""Test UserSettingsView GET"""
"""Test UserAppSettingsView GET"""
with self.login(self.user):
response = self.client.get(reverse('userprofile:settings_update'))
self.assertEqual(response.status_code, 200)
Expand Down Expand Up @@ -184,7 +184,7 @@ def test_get(self):
)

def test_post(self):
"""Test UserSettingsView POST"""
"""Test POST"""
self.assertEqual(self._get_setting('user_str_setting'), 'test')
self.assertEqual(self._get_setting('user_int_setting'), 170)
self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion userprofile/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
),
path(
route='settings/update',
view=views.UserSettingsView.as_view(),
view=views.UserAppSettingsView.as_view(),
name='settings_update',
),
path(
Expand Down
8 changes: 4 additions & 4 deletions userprofile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
CurrentUserFormMixin,
)

from userprofile.forms import UserSettingsForm, UserEmailForm
from userprofile.forms import UserAppSettingsForm, UserEmailForm


User = auth.get_user_model()
Expand Down Expand Up @@ -99,16 +99,16 @@ def get_context_data(self, **kwargs):
return result


class UserSettingsView(
class UserAppSettingsView(
LoginRequiredMixin,
LoggedInPermissionMixin,
HTTPRefererMixin,
InvalidFormMixin,
FormView,
):
"""User settings update view"""
"""User app settings form view"""

form_class = UserSettingsForm
form_class = UserAppSettingsForm
permission_required = 'userprofile.update_settings'
template_name = 'userprofile/settings_form.html'
success_url = reverse_lazy('userprofile:detail')
Expand Down

0 comments on commit ba80c65

Please sign in to comment.