def test_basket_cancel_rebalance(mocker): # construct inputs and mock response inputs = CustomBasketsRebalanceAction(comment='test cancel') mock_response = f'Rebalance submission for {basket_id} has been cancelled' # setup mock session and api response mock_session() mocker.return_value = mock_response # run test response = GsIndexApi.cancel_rebalance(basket_id, inputs) assert response == mock_response
def cancel_rebalance(self) -> Dict: """ Cancel the most recent rebalance submission **Usage** Cancel the basket's most recent rebalance submission if it has not yet been approved **Examples** Cancel the basket's most recent rebalance submission >>> from gs_quant.markets.baskets import Basket >>> >>> basket = Basket.get("GSMBXXXX") >>> basket.cancel_rebalance() **See also** :func:`get_rebalance_approval_status` :func:`update` """ return GsIndexApi.cancel_rebalance(self.id)