Fuelclient version 10 handled

In python-fuelclient >= 10 APIClient was renamed to DefaultAPIClient
Number of saving items decreased in the
test_get_resource_values_effective_lot_of_data
for fix test timeout error on the CI servers.

Change-Id: Icdad2f7acfc6a05684bb2d9e8f73d18a252f20e6
Closes-Bug: #1627944
This commit is contained in:
Alexander Kislitsky 2016-09-27 11:30:05 +03:00
parent 3705aa1526
commit bb6c1932a4
3 changed files with 14 additions and 6 deletions

View File

@ -25,8 +25,15 @@ from tuning_box import client as tb_client
class FuelHTTPClient(tb_client.HTTPClient): class FuelHTTPClient(tb_client.HTTPClient):
if hasattr(fc_client, 'DefaultAPIClient'):
# Handling python-fuelclient version >= 10.0
fc_api = fc_client.DefaultAPIClient
else:
# Handling python-fuelclient version <= 9.0
fc_api = fc_client.APIClient
def __init__(self): def __init__(self):
service_catalog = fc_client.APIClient.keystone_client.service_catalog service_catalog = self.fc_api.keystone_client.service_catalog
base_url = service_catalog.url_for( base_url = service_catalog.url_for(
service_type='config', service_type='config',
endpoint_type='publicURL', endpoint_type='publicURL',
@ -35,8 +42,8 @@ class FuelHTTPClient(tb_client.HTTPClient):
def default_headers(self): def default_headers(self):
headers = super(FuelHTTPClient, self).default_headers() headers = super(FuelHTTPClient, self).default_headers()
if fc_client.APIClient.auth_token: if self.fc_api.auth_token:
headers['X-Auth-Token'] = fc_client.APIClient.auth_token headers['X-Auth-Token'] = self.fc_api.auth_token
return headers return headers

View File

@ -77,9 +77,10 @@ class TestShowEnvironment(testscenarios.WithScenarios, _BaseCLITest):
scenarios = [ scenarios = [
(s[0], dict(zip(('mock_url', 'args', 'expected_result'), s[1]))) (s[0], dict(zip(('mock_url', 'args', 'expected_result'), s[1])))
for s in [ for s in [
('json', ('/environments/9', 'env show 9 -f json', ('json', ('/environments/9', 'env show 9 -f json -c id',
'{\n "id": 1\n}')), '{\n "id": 1\n}')),
('yaml', ('/environments/9', 'env show 9 -f yaml', 'id: 1\n')) ('yaml', ('/environments/9', 'env show 9 -f yaml -c id',
'id: 1\n'))
] ]
] ]
mock_url = None mock_url = None

View File

@ -382,7 +382,7 @@ class TestResourceValues(BaseTest):
keys_on_root = 10000 keys_on_root = 10000
keys_on_lvl1 = 15000 keys_on_lvl1 = 15000
keys_on_lvl2 = 20000 keys_on_lvl2 = 20000
values_on_level = 500 values_on_level = 100
# Adding values on the root level # Adding values on the root level
self._add_resource_values( self._add_resource_values(