Skip to content

Commit

Permalink
Adjust test to reflect authorization code
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Mar 27, 2020
1 parent 5634849 commit 45620a5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/core/test_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,17 @@ def test_permits_refers_to_context_to_check_permissions(self):
self.assertTrue(allowed)

def test_permits_refers_to_context_to_check_permission_principals(self):
self.context.check_permission.return_value = False
self.context.check_permission.side_effect = (False, True)
self.context.current_object = None
self.context.resource_name = "object"
self.context.fetch_shared_objects = mock.MagicMock(return_value=[])

allowed = self.authz.permits(self.context, self.principals, "dynamic")

self.assertTrue(allowed)
self.context.check_permission.assert_called_with(
self.principals, [("/articles/43/comments", "object:create")]
)

def test_permits_reads_the_context(self):
self.authz.permits(self.context, self.principals, "dynamic")
Expand Down

0 comments on commit 45620a5

Please sign in to comment.