Add tests for http basic authentication in python client (#16488)

* add tests for http basic auth in python client

* add new files
This commit is contained in:
William Cheng
2023-09-03 19:11:53 +08:00
committed by GitHub
parent b59719a6ea
commit 47a85e880b
41 changed files with 2096 additions and 30 deletions

View File

@@ -82,20 +82,26 @@ Please follow the [installation](#installation) instruction and execute the foll
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;
import org.openapitools.client.api.AuthApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
// Configure HTTP basic authorization: http_auth
HttpBasicAuth http_auth = (HttpBasicAuth) defaultClient.getAuthentication("http_auth");
http_auth.setUsername("YOUR USERNAME");
http_auth.setPassword("YOUR PASSWORD");
BodyApi apiInstance = new BodyApi(defaultClient);
AuthApi apiInstance = new AuthApi(defaultClient);
try {
File result = apiInstance.testBinaryGif();
String result = apiInstance.testAuthHttpBasic();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BodyApi#testBinaryGif");
System.err.println("Exception when calling AuthApi#testAuthHttpBasic");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
@@ -112,6 +118,7 @@ All URIs are relative to *http://localhost:3000*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AuthApi* | [**testAuthHttpBasic**](docs/AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
@@ -151,7 +158,12 @@ Class | Method | HTTP request | Description
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Endpoints do not require authorization.
Authentication schemes defined for the API:
<a id="http_auth"></a>
### http_auth
- **Type**: HTTP basic authentication
## Recommendation