def test_doActionFor_mixture(self): wftool = self.site.portal_workflow wf = self._getDummyWorkflow() # This time, disallow Authenticated and Manager wf.states['confidential'].permission_roles = {'View': ('Authenticated', 'Manager'),} dummy = DummyContent() # Now, if the item is normally granted to these roles dummy.manage_permission('View', ['Authenticated', 'Manager', 'Owner',], acquire=1) dummy = self.site._setObject('dummy', dummy) # These are the roles we know about self.assertEqual(['Anonymous', 'Authenticated', 'Manager', 'Owner'], sorted(dummy.validRoles())) self.assertEqual(wf._getStatusOf(dummy), {'state': 'nonconfidential', 'comments': ''}) # Then in the non-confidential state (no permissions ticked) we still have that role self.assertEquals(['Authenticated', 'Manager', 'Owner'], sorted(rolesForPermissionOn('View', dummy))) wf.doActionFor(dummy, 'make_confidential', comment='foo' ) self.assertEqual(wf._getStatusOf(dummy), {'state': 'confidential', 'comments': 'foo'}) # But after moving to confidential, which disallows Anonymous and Authenticated, # we are left with Owner and Manager self.assertEquals(['Owner'], sorted(rolesForPermissionOn('View', dummy)))
def test_doActionFor_anonymous(self): wftool = self.site.portal_workflow wf = self._getDummyWorkflow() dummy = DummyContent() # Now, if the item is normally granted to anonymous... dummy.manage_permission('View', ['Anonymous'], acquire=1) dummy = self.site._setObject('dummy', dummy) # These are the roles we know about self.assertEquals(['Anonymous', 'Authenticated', 'Manager', 'Owner'], sorted(dummy.validRoles())) self.assertEqual( wf._getStatusOf(dummy), {'state': 'confidential', 'comments': ''} ) self.assertEquals(['Manager', 'Owner'], sorted(rolesForPermissionOn('View', dummy)))