def test__rbacNeedsFull(self): service = self.make_service(sentinel.listener) changes = [ RBACSync(action=RBAC_ACTION.ADD), RBACSync(action=RBAC_ACTION.UPDATE), RBACSync(action=RBAC_ACTION.REMOVE), RBACSync(action=RBAC_ACTION.FULL), ] self.assertTrue(service._rbacNeedsFull(changes))
def test__rbacDifference(self): service = self.make_service(sentinel.listener) changes = [ RBACSync(action=RBAC_ACTION.UPDATE, resource_id=1, resource_name='r-1'), RBACSync(action=RBAC_ACTION.ADD, resource_id=2, resource_name='r-2'), RBACSync(action=RBAC_ACTION.UPDATE, resource_id=3, resource_name='r-3'), RBACSync(action=RBAC_ACTION.REMOVE, resource_id=1, resource_name='r-1'), RBACSync(action=RBAC_ACTION.UPDATE, resource_id=3, resource_name='r-3-updated'), RBACSync(action=RBAC_ACTION.ADD, resource_id=4, resource_name='r-4'), RBACSync(action=RBAC_ACTION.REMOVE, resource_id=4, resource_name='r-4'), ] self.assertEquals(([ Resource(identifier=2, name='r-2'), Resource(identifier=3, name='r-3-updated'), ], { 1, }), service._rbacDifference(changes))