Merge "Add support for multiple users"

This commit is contained in:
Jenkins 2015-01-20 16:36:54 +00:00 committed by Gerrit Code Review
commit 695bda3cbe
3 changed files with 34 additions and 4 deletions

View File

@ -58,6 +58,22 @@ class TestBase(fixtures.BaseTestFixture):
serialize_format='json',
deserialize_format='json')
if cls.auth_config.multi_user:
alt_auth_token, alt_project_id = cls.auth_client.authenticate_user(
cls.auth_config.base_url,
cls.auth_config.alt_user_name,
cls.auth_config.alt_api_key)
if cls.test_config.project_id_in_url:
cls.alt_url = cls.config.base_url + '/v1.0/' + alt_project_id
else:
cls.alt_url = cls.config.base_url + '/v1.0'
cls.alt_user_client = client.PoppyClient(
cls.alt_url, alt_auth_token,
alt_project_id,
serialize_format='json',
deserialize_format='json')
def assertSchema(self, response_json, expected_schema):
"""Verify response schema aligns with the expected schema."""
try:

View File

@ -98,9 +98,19 @@ class AuthConfig(data_interfaces.ConfigSectionInterface):
return self.get_raw('api_key')
@property
def tenant_id(self):
"""The user's tenant_id, if applicable."""
return self.get('tenant_id')
def multi_user(self):
"""Flag to indicate if the tests need multiple accounts."""
return self.get_boolean('multi_user')
@property
def alt_user_name(self):
"""The name of the alternate user, if applicable."""
return self.get('alt_user_name')
@property
def alt_api_key(self):
"""The alternate user's api key, if applicable."""
return self.get_raw('alt_api_key')
class FastlyConfig(data_interfaces.ConfigSectionInterface):

View File

@ -4,10 +4,14 @@
[auth]
auth_enabled=False
username={user name of the cloud account}
user_name={user name of the cloud account}
api_key={api key for this user name}
base_url=https://identity.api.rackspacecloud.com/v2.0
multi_user=False
alt_user_name={user name of the alternate cloud account}
alt_api_key={api key of the alternate cloud account}
[poppy]
base_url=http://0.0.0.0:8888
flavor = {"flavor1": ["provider_1"], "flavor2": ["provider_2", "provider_3"]}