def test_generateEXML_unacquired_perm_added_role( self ): ACI = 'Access contents information' ROLES = [ 'Manager', 'Owner' ] site = Folder(id='site').__of__(self.app) site.manage_permission( ACI, ROLES ) configurator = self._makeOne( site ).__of__( site ) self._compareDOM( configurator.generateXML(), _UNACQUIRED_EXPORT )
def test_generateEXML_unacquired_perm( self ): ACI = 'Access contents information' ROLES = [ 'Manager', 'Owner', 'ZZZ' ] site = Folder(id='site').__of__(self.app) existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:] existing_roles.append( 'ZZZ' ) site.__ac_roles__ = existing_roles site.manage_permission( ACI, ROLES ) configurator = self._makeOne( site ).__of__( site ) self._compareDOM( configurator.generateXML(), _COMBINED_EXPORT )
def test_generateEXML_unacquired_perm(self): ACI = 'Access contents information' ROLES = ['Manager', 'Owner', 'ZZZ'] site = Folder(id='site').__of__(self.app) existing_roles = list(getattr(site, '__ac_roles__', []))[:] existing_roles.append('ZZZ') site.__ac_roles__ = existing_roles site.manage_permission(ACI, ROLES) configurator = self._makeOne(site).__of__(site) self._compareDOM(configurator.generateXML(), _COMBINED_EXPORT)
def test_listPermissions_no_acquire(self): ACI = 'Access contents information' ROLES = ['Manager', 'Owner'] site = Folder(id='site').__of__(self.app) site.manage_permission(ACI, ROLES) configurator = self._makeOne(site) self.assertEqual(len(configurator.listPermissions()), 1) info = configurator.listPermissions()[0] self.assertEqual(info['name'], ACI) self.assertEqual(info['roles'], ROLES) self.failIf(info['acquire'])
def test_listPermissions_acquire( self ): ACI = 'Access contents information' ROLES = [ 'Manager', 'Owner' ] site = Folder(id='site').__of__(self.app) site.manage_permission( ACI, ROLES, acquire=1 ) configurator = self._makeOne( site ) self.assertEqual( len( configurator.listPermissions() ), 1 ) info = configurator.listPermissions()[ 0 ] self.assertEqual( info[ 'name' ], ACI ) self.assertEqual( info[ 'roles' ], ROLES ) self.failUnless( info[ 'acquire' ] )