diff --git a/tokens/tests/test_permissions.py b/tokens/tests/test_permissions.py index daeebee7..19a1c583 100644 --- a/tokens/tests/test_permissions.py +++ b/tokens/tests/test_permissions.py @@ -1,4 +1,4 @@ -"""Permission tests for the tokens app""" +"""Tests for UI view permissions in the tokens app""" from django.test import override_settings from django.urls import reverse @@ -12,45 +12,35 @@ class TestTokenPermissions(TestSiteAppPermissionBase): """Tests for token view permissions""" - def test_list(self): - """Test permissions for token list""" + def test_get_list(self): + """Test tUserTokenListView GET""" url = reverse('tokens:list') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) @override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True) - def test_list_anon(self): - """Test permissions for token list with anonymous access""" + def test_get_list_anon(self): + """Test UserTokenListView GET with anonymous access""" url = reverse('tokens:list') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) - def test_create(self): - """Test permissions for token creation""" + def test_get_create(self): + """Test UserTokenCreateView GET""" url = reverse('tokens:create') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) @override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True) - def test_create_anon(self): - """Test permissions for token creation with anonymous access""" + def test_get_create_anon(self): + """Test UserTokenCreateView GET with anonymous access""" url = reverse('tokens:create') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) - def test_delete(self): - """Test permissions for token deletion""" + def test_get_delete(self): + """Test UserTokenDeleteView GET""" token = AuthToken.objects.create(self.regular_user, None) url = reverse('tokens:delete', kwargs={'pk': token[0].pk}) - good_users = [self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, self.regular_user, 200) + self.assert_response(url, self.anonymous, 302) diff --git a/userprofile/tests/test_permissions.py b/userprofile/tests/test_permissions.py index 586e4570..aadceec4 100644 --- a/userprofile/tests/test_permissions.py +++ b/userprofile/tests/test_permissions.py @@ -1,4 +1,4 @@ -"""Tests for permissions in the userprofile app""" +"""Tests for UI view permissions in the userprofile app""" from django.test import override_settings from django.urls import reverse @@ -10,36 +10,28 @@ class TestUserProfilePermissions(TestSiteAppPermissionBase): """Tests for userprofile view permissions""" - def test_profile(self): - """Test permissions for user profile view""" + def test_get_profile(self): + """Test UserDetailView GET""" url = reverse('userprofile:detail') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) @override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True) - def test_profile_anon(self): - """Test permissions for user profile view with anonymous access""" + def test_get_profile_anon(self): + """Test UserDetailView GET with anonymous access""" url = reverse('userprofile:detail') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) - def test_settings_update(self): - """Test permissions for user settings update view""" + def test_get_settings_update(self): + """Test UserSettingUpdateView GET""" url = reverse('userprofile:settings_update') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302) @override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True) - def test_settings_update_anon(self): - """Test permissions for update view with anonymous access""" + def test_get_settings_update_anon(self): + """Test UserSettingUpdateView GET with anonymous access""" url = reverse('userprofile:settings_update') - good_users = [self.superuser, self.regular_user] - bad_users = [self.anonymous] - self.assert_response(url, good_users, 200) - self.assert_response(url, bad_users, 302) + self.assert_response(url, [self.superuser, self.regular_user], 200) + self.assert_response(url, self.anonymous, 302)