def it_can_dispatch_a_substitute_command_to_the_app( self, args_, app_controller_): # fixture ---------------------- substitute_command = SubstituteCommand(None) # exercise --------------------- substitute_command.execute(args_, app_controller_) # verify ----------------------- app_controller_.substitute.assert_called_once_with( args_.filename, args_.src_pkg_path, args_.tgt_pkg_path, args_.result_pkg_path)
def it_should_trigger_parser_error_if_pkg_path_does_not_exist( self, src_pkg_path, tgt_pkg_path, err_frag, args_, parser_): # fixture ---------------------- args_.src_pkg_path = src_pkg_path args_.tgt_pkg_path = tgt_pkg_path substitute_command = SubstituteCommand(parser_) # exercise --------------------- substitute_command.validate(args_) # verify ----------------------- parser_.error.assert_called_once_with(ANY) assert err_frag in parser_.error.call_args[0][0]
def it_should_add_a_substitute_command_parser(self, substitute_argv_, parser, subparsers): # exercise --------------------- subparser = SubstituteCommand.add_command_parser_to(subparsers) args = parser.parse_args(substitute_argv_) # verify ----------------------- assert args.filename == ARG_FILENAME assert args.src_pkg_path == ARG_SRC_PKG_PATH assert args.tgt_pkg_path == ARG_TGT_PKG_PATH assert args.result_pkg_path == ARG_RESULT_PKG_PATH assert isinstance(subparser, argparse.ArgumentParser)