Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Merge "Add support for multiple users"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 20, 2015
2 parents be36615 + 8dee003 commit 695bda3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
16 changes: 16 additions & 0 deletions tests/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ def setUpClass(cls):
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:
Expand Down
16 changes: 13 additions & 3 deletions tests/api/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,19 @@ def api_key(self):
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):
Expand Down
6 changes: 5 additions & 1 deletion tests/etc/api.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down

0 comments on commit 695bda3

Please sign in to comment.