Skip to content

Commit

Permalink
update siteinfo perm tests (#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Sep 18, 2023
1 parent e8027e1 commit 5006f9c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions siteinfo/tests/test_permissions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Permission tests for the siteinfo app"""
"""Tests for UI view permissions in the siteinfo app"""

from django.test import override_settings
from django.urls import reverse
Expand All @@ -7,19 +7,21 @@
from projectroles.tests.test_permissions import TestSiteAppPermissionBase


class TestSiteInfoPermissions(TestSiteAppPermissionBase):
"""Tests for siteinfo view permissions"""
class TestSiteInfoViewPermissions(TestSiteAppPermissionBase):
"""Tests for SiteInfoView permissions"""

def setUp(self):
super().setUp()
self.url = reverse('siteinfo:info')

def test_site_info(self):
"""Test site info view"""
url = reverse('siteinfo:info')
"""Test SiteInfoView GET"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_site_info_anon(self):
"""Test site info view with anonymous access"""
url = reverse('siteinfo:info')
self.assert_response(url, self.anonymous, 302)
"""Test GET with anonymous access"""
self.assert_response(self.url, self.anonymous, 302)

0 comments on commit 5006f9c

Please sign in to comment.