Skip to content

Commit

Permalink
Fixed tests to support new implied permission
Browse files Browse the repository at this point in the history
  • Loading branch information
noliveleger committed May 14, 2021
1 parent 0b97d75 commit e7c077a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions kpi/tests/test_permissions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8
import unittest
from django.contrib.auth.models import User, AnonymousUser
from django.test import TestCase

Expand Down Expand Up @@ -256,7 +257,11 @@ def test_implied_asset_grant_permissions(self):
PERM_CHANGE_ASSET: (PERM_VIEW_ASSET,),
PERM_ADD_SUBMISSIONS: (PERM_VIEW_ASSET,),
PERM_VIEW_SUBMISSIONS: (PERM_VIEW_ASSET,),
PERM_CHANGE_SUBMISSIONS: (PERM_VIEW_ASSET, PERM_VIEW_SUBMISSIONS),
PERM_CHANGE_SUBMISSIONS: (
PERM_VIEW_ASSET,
PERM_VIEW_SUBMISSIONS,
PERM_ADD_SUBMISSIONS,
),
PERM_VALIDATE_SUBMISSIONS: (PERM_VIEW_ASSET, PERM_VIEW_SUBMISSIONS),
}
asset = self.admin_asset
Expand Down Expand Up @@ -293,6 +298,7 @@ def test_remove_implied_asset_permissions(self):
PERM_VIEW_ASSET,
PERM_VIEW_SUBMISSIONS,
PERM_CHANGE_SUBMISSIONS,
PERM_ADD_SUBMISSIONS,
]
self.assertListEqual(
sorted(asset.get_perms(grantee)), sorted(expected_perms)
Expand Down Expand Up @@ -394,7 +400,7 @@ def test_contradict_implied_asset_deny_permissions(self):
)
expected_perms = [
# codename, deny
(PERM_ADD_SUBMISSIONS, True),
(PERM_ADD_SUBMISSIONS, False),
(PERM_CHANGE_ASSET, True),
(PERM_CHANGE_SUBMISSIONS, False),
(PERM_DELETE_SUBMISSIONS, True),
Expand Down Expand Up @@ -473,6 +479,7 @@ def test_calculated_submission_editor_permissions(self):
grantee = self.someuser
asset = self.admin_asset
submission_editor_permissions = [
PERM_ADD_SUBMISSIONS,
PERM_CHANGE_SUBMISSIONS,
PERM_VIEW_ASSET,
PERM_VIEW_SUBMISSIONS,
Expand Down Expand Up @@ -715,6 +722,8 @@ def test_remove_partial_submission_permission(self):
self.assertFalse(grantee.has_perm(PERM_PARTIAL_SUBMISSIONS, asset))
self.assertTrue(asset.asset_partial_permissions.count() == 0)

@unittest.skip(reason='Skip until this branch is merged within '
'`3115-allowed-write-actions-with-partial-perm`')
def test_implied_partial_submission_permission(self):
"""
This test is present even though we can only restrict users to view
Expand Down

0 comments on commit e7c077a

Please sign in to comment.