[Python] Conditionally set auth attributes (#4988)

* Enhance python API keys

* Run python scripts under ./bin/openapi3

* fix unit test issue

* Fix unit tests

* Fix unit tests

* Invoke bin scripts
This commit is contained in:
Sebastien Rosset
2020-01-16 01:42:23 -08:00
committed by William Cheng
parent b94fe7a40f
commit fa0ef2be25
16 changed files with 440 additions and 235 deletions

View File

@@ -57,6 +57,7 @@ class PetApiTests(unittest.TestCase):
def setUp(self):
config = Configuration()
config.host = HOST
config.access_token = 'ACCESS_TOKEN'
self.api_client = petstore_api.ApiClient(config)
self.pet_api = petstore_api.PetApi(self.api_client)
self.setUpModels()
@@ -107,13 +108,13 @@ class PetApiTests(unittest.TestCase):
mock_pool.expect_request('POST', HOST + '/pet',
body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)),
headers={'Content-Type': 'application/json',
'Authorization': 'Bearer ',
'Authorization': 'Bearer ACCESS_TOKEN',
'User-Agent': 'OpenAPI-Generator/1.0.0/python'},
preload_content=True, timeout=TimeoutWithEqual(total=5))
mock_pool.expect_request('POST', HOST + '/pet',
body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)),
headers={'Content-Type': 'application/json',
'Authorization': 'Bearer ',
'Authorization': 'Bearer ACCESS_TOKEN',
'User-Agent': 'OpenAPI-Generator/1.0.0/python'},
preload_content=True, timeout=TimeoutWithEqual(connect=1, read=2))