def test_custom_basket_command(): ok = [] def noop(**kwargs): ok.append(kwargs) def get_custom_command(command, **kwargs): if command == "test_custom_basket_command": return noop old_n_receivers = len(get_basket_command_handler.receivers) try: get_basket_command_handler.connect(get_custom_command, dispatch_uid="test_custom_basket_command") commands = get_basket_command_dispatcher(request=get_request_with_basket()) commands.handle("test_custom_basket_command") assert ok # heh. finally: get_basket_command_handler.disconnect(dispatch_uid="test_custom_basket_command") assert old_n_receivers == len(get_basket_command_handler.receivers)
def test_custom_basket_command(): ok = [] def noop(**kwargs): ok.append(kwargs) def get_custom_command(command, **kwargs): if command == "test_custom_basket_command": return noop old_n_receivers = len(get_basket_command_handler.receivers) try: get_basket_command_handler.connect(get_custom_command, dispatch_uid="test_custom_basket_command") commands = get_basket_command_dispatcher(request=get_request_with_basket()) commands.handle("test_custom_basket_command") assert ok # heh. finally: get_basket_command_handler.disconnect(dispatch_uid="test_custom_basket_command") assert old_n_receivers == len(get_basket_command_handler.receivers)