diff options
author | Matt Riedemann <mriedem@us.ibm.com> | 2016-03-23 12:35:33 -0400 |
---|---|---|
committer | Matt Riedemann <mriedem@us.ibm.com> | 2016-03-23 20:12:59 -0400 |
commit | 92bbae6d09b8db4ed9659de79d172d672902a3a5 (patch) | |
tree | 39ff123252a6b210446c81499e935a54ea726998 /novaclient | |
parent | abe6707d26859c08a031d53ca316d31aaff6bc3b (diff) | |
download | python-novaclient-92bbae6d09b8db4ed9659de79d172d672902a3a5.tar.gz |
Use keystoneclient python bindings for testing
The keystone CLI has been deprecated for a long time
in favor of python-openstackclient and
Icbe15814bc4faf33f513f9654440068795eae807 finally removes
the CLI from python-keystoneclient. This will be in the 3.0
release of python-keystoneclient.
tempest-lib is using the keystone CLI and the novaclient
functional tests are using tempest-lib (which is also
deprecated now).
This change removes the usage of the keystone CLI from
python-keystoneclient via tempest-lib and replaces it
with simply using the keystone v2 python bindings from
the client.
Change-Id: I557acefbf363304ce24ac81566bb651cbfe09176
Diffstat (limited to 'novaclient')
-rw-r--r-- | novaclient/tests/functional/base.py | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py index d51a19d7..9595915b 100644 --- a/novaclient/tests/functional/base.py +++ b/novaclient/tests/functional/base.py @@ -15,6 +15,7 @@ import time import uuid import fixtures +from keystoneclient.v2_0 import client as keystoneclient import os_client_config import six import tempest_lib.cli.base @@ -201,6 +202,11 @@ class ClientTestBase(testtools.TestCase): cli_dir=cli_dir, insecure=insecure) + self.keystone = keystoneclient.Client(username=user, + password=passwd, + tenant_name=tenant, + auth_url=auth_url) + def nova(self, action, flags='', params='', fail_ok=False, endpoint_type='publicURL', merge_stderr=False): if self.COMPUTE_API_VERSION: @@ -352,27 +358,19 @@ class TenantTestBase(ClientTestBase): def setUp(self): super(TenantTestBase, self).setUp() - tenant = self.cli_clients.keystone( - 'tenant-create --name %s --enabled True' % + tenant = self.keystone.tenants.create( self.name_generate('v' + self.COMPUTE_API_VERSION)) - self.tenant_name = self._get_value_from_the_table(tenant, "name") - self.tenant_id = self._get_value_from_the_table( - self.cli_clients.keystone( - 'tenant-get %s' % self.tenant_name), 'id') - self.addCleanup(self.cli_clients.keystone, - "tenant-delete %s" % self.tenant_name) + self.tenant_id = tenant.id + self.addCleanup(self.keystone.tenants.delete, self.tenant_id) user_name = self.name_generate('v' + self.COMPUTE_API_VERSION) password = 'password' - user = self.cli_clients.keystone( - "user-create --name %(name)s --pass %(pass)s --tenant %(tenant)s" % - {"name": user_name, "pass": password, "tenant": self.tenant_name}) - self.user_id = self._get_value_from_the_table(user, "id") - self.addCleanup(self.cli_clients.keystone, - "user-delete %s" % self.user_id) + self.user_id = self.keystone.users.create( + user_name, password, tenant_id=self.tenant_id).id + self.addCleanup(self.keystone.users.delete, self.user_id) self.cli_clients_2 = tempest_lib.cli.base.CLIClient( username=user_name, password=password, - tenant_name=self.tenant_name, + tenant_name=tenant.name, uri=self.cli_clients.uri, cli_dir=self.cli_clients.cli_dir) |