Add test cases to cover different collection formats (#3640)

* add test cases to cover different collection format

* add space params to retrofit 1.x

* add space params to retrofit 2.x

* rename url to localVarUrl

* fix exception in haskell servant
This commit is contained in:
William Cheng
2019-08-15 11:09:12 +08:00
committed by GitHub
parent 286cdfdfa2
commit c3535cf9ca
185 changed files with 8369 additions and 190 deletions

View File

@@ -985,5 +985,92 @@ module Petstore
end
return data, status_code, headers
end
# To test the collection format in query parameters
# @param pipe [Array<String>]
# @param ioutil [Array<String>]
# @param http [Array<String>]
# @param url [Array<String>]
# @param context [Array<String>]
# @param [Hash] opts the optional parameters
# @return [nil]
def test_query_parameter_collection_format(pipe, ioutil, http, url, context, opts = {})
test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, opts)
nil
end
# To test the collection format in query parameters
# @param pipe [Array<String>]
# @param ioutil [Array<String>]
# @param http [Array<String>]
# @param url [Array<String>]
# @param context [Array<String>]
# @param [Hash] opts the optional parameters
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FakeApi.test_query_parameter_collection_format ...'
end
# verify the required parameter 'pipe' is set
if @api_client.config.client_side_validation && pipe.nil?
fail ArgumentError, "Missing the required parameter 'pipe' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'ioutil' is set
if @api_client.config.client_side_validation && ioutil.nil?
fail ArgumentError, "Missing the required parameter 'ioutil' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'http' is set
if @api_client.config.client_side_validation && http.nil?
fail ArgumentError, "Missing the required parameter 'http' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'url' is set
if @api_client.config.client_side_validation && url.nil?
fail ArgumentError, "Missing the required parameter 'url' when calling FakeApi.test_query_parameter_collection_format"
end
# verify the required parameter 'context' is set
if @api_client.config.client_side_validation && context.nil?
fail ArgumentError, "Missing the required parameter 'context' when calling FakeApi.test_query_parameter_collection_format"
end
# resource path
local_var_path = '/fake/test-query-paramters'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'pipe'] = @api_client.build_collection_param(pipe, :multi)
query_params[:'ioutil'] = @api_client.build_collection_param(ioutil, :csv)
query_params[:'http'] = @api_client.build_collection_param(http, :space)
query_params[:'url'] = @api_client.build_collection_param(url, :csv)
query_params[:'context'] = @api_client.build_collection_param(context, :multi)
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:body]
# return_type
return_type = opts[:return_type]
# auth_names
auth_names = opts[:auth_names] || []
new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FakeApi#test_query_parameter_collection_format\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end