def it_can_dispatch_a_diff_command_to_the_app(self, args_, app_controller_): # fixture ---------------------- diff_command = DiffCommand(None) # exercise --------------------- diff_command.execute(args_, app_controller_) # verify ----------------------- app_controller_.diff_pkg.assert_called_once_with( args_.pkg_1_path, args_.pkg_2_path)
def it_should_trigger_parser_error_if_pkg_path_does_not_exist( self, pkg_1_path, pkg_2_path, err_frag, args_, parser_): # fixture ---------------------- args_.pkg_1_path = pkg_1_path args_.pkg_2_path = pkg_2_path diff_command = DiffCommand(parser_) # exercise --------------------- diff_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_diff_command_parser(self, subparsers, parser, diff_argv_): # exercise --------------------- subparser = DiffCommand.add_command_parser_to(subparsers) args = parser.parse_args(diff_argv_) # verify ----------------------- assert args.pkg_1_path == ARG_PKG_PATH assert args.pkg_2_path == ARG_PKG_2_PATH assert isinstance(subparser, argparse.ArgumentParser)