forked from loafle/openapi-generator-original
[python] Add tests and fix enum path parameters (#16769)
* test: Tests for enum params in path, query and header * fix: Get enum ref values correctly in path parameters Closes #16688 * fix java tests failure --------- Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
@@ -4,11 +4,11 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_header_integer_boolean_string**](HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s)
|
||||
[**test_header_integer_boolean_string_enums**](HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
|
||||
|
||||
|
||||
# **test_header_integer_boolean_string**
|
||||
> str test_header_integer_boolean_string(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header)
|
||||
# **test_header_integer_boolean_string_enums**
|
||||
> str test_header_integer_boolean_string_enums(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header, enum_nonref_string_header=enum_nonref_string_header, enum_ref_string_header=enum_ref_string_header)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
@@ -20,6 +20,7 @@ Test header parameter(s)
|
||||
import time
|
||||
import os
|
||||
import openapi_client
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
@@ -37,14 +38,16 @@ with openapi_client.ApiClient(configuration) as api_client:
|
||||
integer_header = 56 # int | (optional)
|
||||
boolean_header = True # bool | (optional)
|
||||
string_header = 'string_header_example' # str | (optional)
|
||||
enum_nonref_string_header = 'enum_nonref_string_header_example' # str | (optional)
|
||||
enum_ref_string_header = openapi_client.StringEnumRef() # StringEnumRef | (optional)
|
||||
|
||||
try:
|
||||
# Test header parameter(s)
|
||||
api_response = api_instance.test_header_integer_boolean_string(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header)
|
||||
print("The response of HeaderApi->test_header_integer_boolean_string:\n")
|
||||
api_response = api_instance.test_header_integer_boolean_string_enums(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header, enum_nonref_string_header=enum_nonref_string_header, enum_ref_string_header=enum_ref_string_header)
|
||||
print("The response of HeaderApi->test_header_integer_boolean_string_enums:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling HeaderApi->test_header_integer_boolean_string: %s\n" % e)
|
||||
print("Exception when calling HeaderApi->test_header_integer_boolean_string_enums: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
@@ -56,6 +59,8 @@ Name | Type | Description | Notes
|
||||
**integer_header** | **int**| | [optional]
|
||||
**boolean_header** | **bool**| | [optional]
|
||||
**string_header** | **str**| | [optional]
|
||||
**enum_nonref_string_header** | **str**| | [optional]
|
||||
**enum_ref_string_header** | [**StringEnumRef**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**tests_path_string_path_string_integer_path_integer**](PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||
[**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
|
||||
|
||||
|
||||
# **tests_path_string_path_string_integer_path_integer**
|
||||
> str tests_path_string_path_string_integer_path_integer(path_string, path_integer)
|
||||
# **tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**
|
||||
> str tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
@@ -20,6 +20,7 @@ Test path parameter(s)
|
||||
import time
|
||||
import os
|
||||
import openapi_client
|
||||
from openapi_client.models.string_enum_ref import StringEnumRef
|
||||
from openapi_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
@@ -36,14 +37,16 @@ with openapi_client.ApiClient(configuration) as api_client:
|
||||
api_instance = openapi_client.PathApi(api_client)
|
||||
path_string = 'path_string_example' # str |
|
||||
path_integer = 56 # int |
|
||||
enum_nonref_string_path = 'enum_nonref_string_path_example' # str |
|
||||
enum_ref_string_path = openapi_client.StringEnumRef() # StringEnumRef |
|
||||
|
||||
try:
|
||||
# Test path parameter(s)
|
||||
api_response = api_instance.tests_path_string_path_string_integer_path_integer(path_string, path_integer)
|
||||
print("The response of PathApi->tests_path_string_path_string_integer_path_integer:\n")
|
||||
api_response = api_instance.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
print("The response of PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer: %s\n" % e)
|
||||
print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
@@ -54,6 +57,8 @@ Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**path_string** | **str**| |
|
||||
**path_integer** | **int**| |
|
||||
**enum_nonref_string_path** | **str**| |
|
||||
**enum_ref_string_path** | [**StringEnumRef**](.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **test_enum_ref_string**
|
||||
> str test_enum_ref_string(enum_ref_string_query=enum_ref_string_query)
|
||||
> str test_enum_ref_string(enum_nonref_string_query=enum_nonref_string_query, enum_ref_string_query=enum_ref_string_query)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@@ -42,11 +42,12 @@ configuration = openapi_client.Configuration(
|
||||
with openapi_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = openapi_client.QueryApi(api_client)
|
||||
enum_nonref_string_query = 'enum_nonref_string_query_example' # str | (optional)
|
||||
enum_ref_string_query = openapi_client.StringEnumRef() # StringEnumRef | (optional)
|
||||
|
||||
try:
|
||||
# Test query parameter(s)
|
||||
api_response = api_instance.test_enum_ref_string(enum_ref_string_query=enum_ref_string_query)
|
||||
api_response = api_instance.test_enum_ref_string(enum_nonref_string_query=enum_nonref_string_query, enum_ref_string_query=enum_ref_string_query)
|
||||
print("The response of QueryApi->test_enum_ref_string:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
@@ -59,6 +60,7 @@ with openapi_client.ApiClient(configuration) as api_client:
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enum_nonref_string_query** | **str**| | [optional]
|
||||
**enum_ref_string_query** | [**StringEnumRef**](.md)| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
Reference in New Issue
Block a user