Skip to content

Commit

Permalink
Add missing methods to xml admin_client.
Browse files Browse the repository at this point in the history
This adds methods missing from the xml version of the identity
admin client. These methods are needed by some of the tests in
test_list_server_filters.

Partially fixes bug 1059568

Change-Id: Iec0fd7ff49de78b9681ccfa27963393aff248b5f
  • Loading branch information
Matthew Treinish committed Jan 10, 2013
1 parent 23d4080 commit bf41e10
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tempest/services/identity/xml/admin_client.py
Expand Up @@ -136,6 +136,13 @@ def list_tenants(self):
body = self._parse_array(etree.fromstring(body))
return resp, body

def get_tenant_by_name(self, tenant_name):
resp, tenants = self.list_tenants()
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
raise exceptions.NotFound('No such tenant')

def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
resp, body = self.get_tenant(tenant_id)
Expand Down Expand Up @@ -198,6 +205,13 @@ def list_users_for_tenant(self, tenant_id):
body = self._parse_array(etree.fromstring(body))
return resp, body

def get_user_by_username(self, tenant_id, username):
resp, users = self.list_users_for_tenant(tenant_id)
for user in users:
if user['name'] == username:
return user
raise exceptions.NotFound('No such user')

def create_service(self, name, type, **kwargs):
"""Create a service."""
OS_KSADM = "http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
Expand Down

0 comments on commit bf41e10

Please sign in to comment.