def set_entitlements(self, entitlements: Entitlements): """ Set the entitlements of a portfolio :param entitlements: Entitlements object """ entitlements_as_target = entitlements.to_target() portfolio_as_target = GsPortfolioApi.get_portfolio(self.__portfolio_id) portfolio_as_target.entitlements = entitlements_as_target GsPortfolioApi.update_portfolio(portfolio_as_target)
def test_to_target(): ent = Entitlements(edit=EntitlementBlock(users=[get_fake_user()], groups=[get_fake_group()])) as_target = ent.to_target() assert as_target.edit == ['guid:userId', 'group:groupId']