def it_can_dispatch_a_repackage_command_to_the_app(self, args_, app_controller_): # fixture ---------------------- repackage_command = RepackageCommand(None) # exercise --------------------- repackage_command.execute(args_, app_controller_) # verify ----------------------- app_controller_.repackage.assert_called_once_with( args_.dirpath, args_.new_package)
def it_should_trigger_parser_error_if_dirpath_not_a_directory( self, args_, parser_): # fixture ---------------------- args_.dirpath = 'foobar' repackage_command = RepackageCommand(parser_) # exercise --------------------- repackage_command.validate(args_) # verify ----------------------- parser_.error.assert_called_once_with(ANY) assert 'DIRPATH' in parser_.error.call_args[0][0] assert 'foobar' in parser_.error.call_args[0][0]
def it_should_add_a_repackage_command_parser(self, repackage_argv_, parser, subparsers): # exercise --------------------- subparser = RepackageCommand.add_command_parser_to(subparsers) args = parser.parse_args(repackage_argv_) # verify ----------------------- assert args.dirpath == ARG_DIRPATH assert args.new_package == ARG_NEW_PACKAGE assert isinstance(subparser, argparse.ArgumentParser)