def test_create_common_parser_passed_usage_string(self, mock_func):
     mock_parser = Mock()
     mock_parser.parse_args.return_value = lambda: Mock(), []
     mock_func.return_value = mock_parser
     archivepgsql_parse_args(args=[])
     kwargs = mock_func.call_args_list[0][1]
     expected_usage_suffix = '[options]'
     self.assertTrue(kwargs['usage'].endswith(expected_usage_suffix))
Example #2
0
def archivepgsql_handle_args():
    parser, options, args = archivepgsql_parse_args()

    try:
        archivepgsql_validate_options_and_args(options, args)
    except Exception, e:
        stdout.write(str(e) + '\n')
        parser.print_help()
        raise e
 def test_create_common_parser_used(self, mock_func):
     mock_parser = Mock()
     mock_parser.parse_args.return_value = lambda: Mock(), []
     mock_func.return_value = mock_parser
     archivepgsql_parse_args(args=[])
     self.assertTrue(mock_func.called)
 def validate():
     parser, options, args = archivepgsql_parse_args(args=[
         '--config', self.config_path, 'pg_xlog/some_arg'])
     archivepgsql_validate_options_and_args(options, args)