Keystoneclient tests from venv-installed client
The keystoneclient tests were using the library installed from a git clone. Rather than do a clone of master, the tests will now just use the keystoneclient installed to the venv. Doing a `git clone` causes problems on any system without reliable Internet access, and since the keystoneclient tests have changed to being for functional tests rather than for verifying backwards-compatibility of the client, this will make things easier. Change-Id: I079fa77501b8987a4724d03a792b084a6d853e21
This commit is contained in:
parent
375ab79272
commit
0c407c5f8d
|
@ -7,7 +7,7 @@ test_command=
|
||||||
|
|
||||||
test_id_option=--load-list $IDFILE
|
test_id_option=--load-list $IDFILE
|
||||||
test_list_option=--list
|
test_list_option=--list
|
||||||
group_regex=.*(test_cert_setup|test_keystoneclient)
|
group_regex=.*(test_cert_setup)
|
||||||
|
|
||||||
|
|
||||||
# NOTE(morganfainberg): If single-worker mode is wanted (e.g. for live tests)
|
# NOTE(morganfainberg): If single-worker mode is wanted (e.g. for live tests)
|
||||||
|
|
|
@ -30,7 +30,6 @@ import six
|
||||||
from six import moves
|
from six import moves
|
||||||
|
|
||||||
from keystone.common import config
|
from keystone.common import config
|
||||||
from keystone.common import environment
|
|
||||||
from keystone import exception
|
from keystone import exception
|
||||||
from keystone.i18n import _, _LE, _LW
|
from keystone.i18n import _, _LE, _LW
|
||||||
from keystone.openstack.common import log
|
from keystone.openstack.common import log
|
||||||
|
@ -157,43 +156,6 @@ def attr_as_boolean(val_attr):
|
||||||
return strutils.bool_from_string(val_attr, default=True)
|
return strutils.bool_from_string(val_attr, default=True)
|
||||||
|
|
||||||
|
|
||||||
# From python 2.7
|
|
||||||
def check_output(*popenargs, **kwargs):
|
|
||||||
r"""Run command with arguments and return its output as a byte string.
|
|
||||||
|
|
||||||
If the exit code was non-zero it raises a CalledProcessError. The
|
|
||||||
CalledProcessError object will have the return code in the returncode
|
|
||||||
attribute and output in the output attribute.
|
|
||||||
|
|
||||||
The arguments are the same as for the Popen constructor. Example:
|
|
||||||
|
|
||||||
>>> check_output(['ls', '-l', '/dev/null'])
|
|
||||||
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
|
|
||||||
|
|
||||||
The stdout argument is not allowed as it is used internally.
|
|
||||||
To capture standard error in the result, use stderr=STDOUT.
|
|
||||||
|
|
||||||
>>> import sys
|
|
||||||
>>> check_output(['/bin/sh', '-c',
|
|
||||||
... 'ls -l non_existent_file ; exit 0'],
|
|
||||||
... stderr=sys.STDOUT)
|
|
||||||
'ls: non_existent_file: No such file or directory\n'
|
|
||||||
"""
|
|
||||||
if 'stdout' in kwargs:
|
|
||||||
raise ValueError('stdout argument not allowed, it will be overridden.')
|
|
||||||
LOG.debug(' '.join(popenargs[0]))
|
|
||||||
process = environment.subprocess.Popen(stdout=environment.subprocess.PIPE,
|
|
||||||
*popenargs, **kwargs)
|
|
||||||
output, unused_err = process.communicate()
|
|
||||||
retcode = process.poll()
|
|
||||||
if retcode:
|
|
||||||
cmd = kwargs.get('args')
|
|
||||||
if cmd is None:
|
|
||||||
cmd = popenargs[0]
|
|
||||||
raise environment.subprocess.CalledProcessError(retcode, cmd)
|
|
||||||
return output
|
|
||||||
|
|
||||||
|
|
||||||
def get_blob_from_credential(credential):
|
def get_blob_from_credential(credential):
|
||||||
try:
|
try:
|
||||||
blob = jsonutils.loads(credential.blob)
|
blob = jsonutils.loads(credential.blob)
|
||||||
|
@ -226,10 +188,6 @@ def convert_v3_to_ec2_credential(credential):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def git(*args):
|
|
||||||
return check_output(['git'] + list(args))
|
|
||||||
|
|
||||||
|
|
||||||
def unixtime(dt_obj):
|
def unixtime(dt_obj):
|
||||||
"""Format datetime object as unix timestamp
|
"""Format datetime object as unix timestamp
|
||||||
|
|
||||||
|
|
|
@ -267,51 +267,6 @@ class TestClient(object):
|
||||||
return self.request('PUT', path=path, headers=headers, body=body)
|
return self.request('PUT', path=path, headers=headers, body=body)
|
||||||
|
|
||||||
|
|
||||||
class NoModule(object):
|
|
||||||
"""A mixin class to provide support for unloading/disabling modules."""
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(NoModule, self).setUp()
|
|
||||||
|
|
||||||
self._finders = []
|
|
||||||
|
|
||||||
def cleanup_finders():
|
|
||||||
for finder in self._finders:
|
|
||||||
sys.meta_path.remove(finder)
|
|
||||||
del self._finders
|
|
||||||
self.addCleanup(cleanup_finders)
|
|
||||||
|
|
||||||
self._cleared_modules = {}
|
|
||||||
|
|
||||||
def cleanup_modules():
|
|
||||||
sys.modules.update(self._cleared_modules)
|
|
||||||
del self._cleared_modules
|
|
||||||
self.addCleanup(cleanup_modules)
|
|
||||||
|
|
||||||
def clear_module(self, module):
|
|
||||||
cleared_modules = {}
|
|
||||||
for fullname in sys.modules.keys():
|
|
||||||
if fullname == module or fullname.startswith(module + '.'):
|
|
||||||
cleared_modules[fullname] = sys.modules.pop(fullname)
|
|
||||||
return cleared_modules
|
|
||||||
|
|
||||||
def disable_module(self, module):
|
|
||||||
"""Ensure ImportError for the specified module."""
|
|
||||||
|
|
||||||
# Clear 'module' references in sys.modules
|
|
||||||
self._cleared_modules.update(self.clear_module(module))
|
|
||||||
|
|
||||||
# Disallow further imports of 'module'
|
|
||||||
class NoModule(object):
|
|
||||||
def find_module(self, fullname, path):
|
|
||||||
if fullname == module or fullname.startswith(module + '.'):
|
|
||||||
raise ImportError
|
|
||||||
|
|
||||||
finder = NoModule()
|
|
||||||
self._finders.append(finder)
|
|
||||||
sys.meta_path.insert(0, finder)
|
|
||||||
|
|
||||||
|
|
||||||
class BaseTestCase(oslotest.BaseTestCase):
|
class BaseTestCase(oslotest.BaseTestCase):
|
||||||
"""Light weight base test class.
|
"""Light weight base test class.
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,10 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from keystoneclient import exceptions as client_exceptions
|
||||||
|
from keystoneclient.v2_0 import client as ks_client
|
||||||
import mock
|
import mock
|
||||||
from oslo.serialization import jsonutils
|
from oslo.serialization import jsonutils
|
||||||
from oslo.utils import timeutils
|
from oslo.utils import timeutils
|
||||||
|
@ -30,15 +31,12 @@ from keystone.tests.ksfixtures import database
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id
|
DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id
|
||||||
OPENSTACK_REPO = os.environ.get('OPENSTACK_REPO',
|
|
||||||
'https://git.openstack.org/openstack')
|
|
||||||
KEYSTONECLIENT_REPO = '%s/python-keystoneclient.git' % OPENSTACK_REPO
|
|
||||||
|
|
||||||
|
|
||||||
class CompatTestCase(tests.NoModule, tests.TestCase):
|
class ClientDrivenTestCase(tests.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CompatTestCase, self).setUp()
|
super(ClientDrivenTestCase, self).setUp()
|
||||||
|
|
||||||
# FIXME(morganfainberg): Since we are running tests through the
|
# FIXME(morganfainberg): Since we are running tests through the
|
||||||
# controllers and some internal api drivers are SQL-only, the correct
|
# controllers and some internal api drivers are SQL-only, the correct
|
||||||
|
@ -65,13 +63,6 @@ class CompatTestCase(tests.NoModule, tests.TestCase):
|
||||||
|
|
||||||
self.addCleanup(self.cleanup_instance('public_server', 'admin_server'))
|
self.addCleanup(self.cleanup_instance('public_server', 'admin_server'))
|
||||||
|
|
||||||
if isinstance(self.checkout_info, str):
|
|
||||||
revdir = self.checkout_info
|
|
||||||
else:
|
|
||||||
revdir = tests.checkout_vendor(*self.checkout_info)
|
|
||||||
self.add_path(revdir)
|
|
||||||
self.clear_module('keystoneclient')
|
|
||||||
|
|
||||||
def _public_url(self):
|
def _public_url(self):
|
||||||
public_port = self.public_server.socket_info['socket'][1]
|
public_port = self.public_server.socket_info['socket'][1]
|
||||||
return "http://localhost:%s/v2.0" % public_port
|
return "http://localhost:%s/v2.0" % public_port
|
||||||
|
@ -81,8 +72,6 @@ class CompatTestCase(tests.NoModule, tests.TestCase):
|
||||||
return "http://localhost:%s/v2.0" % admin_port
|
return "http://localhost:%s/v2.0" % admin_port
|
||||||
|
|
||||||
def _client(self, admin=False, **kwargs):
|
def _client(self, admin=False, **kwargs):
|
||||||
from keystoneclient.v2_0 import client as ks_client
|
|
||||||
|
|
||||||
url = self._admin_url() if admin else self._public_url()
|
url = self._admin_url() if admin else self._public_url()
|
||||||
kc = ks_client.Client(endpoint=url,
|
kc = ks_client.Client(endpoint=url,
|
||||||
auth_url=self._public_url(),
|
auth_url=self._public_url(),
|
||||||
|
@ -114,10 +103,6 @@ class CompatTestCase(tests.NoModule, tests.TestCase):
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
admin=admin)
|
admin=admin)
|
||||||
|
|
||||||
|
|
||||||
class KeystoneClientTests(object):
|
|
||||||
"""Tests for all versions of keystoneclient."""
|
|
||||||
|
|
||||||
def test_authenticate_tenant_name_and_tenants(self):
|
def test_authenticate_tenant_name_and_tenants(self):
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
tenants = client.tenants.list()
|
tenants = client.tenants.list()
|
||||||
|
@ -131,7 +116,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(self.tenant_bar['id'], tenants[0].id)
|
self.assertEqual(self.tenant_bar['id'], tenants[0].id)
|
||||||
|
|
||||||
def test_authenticate_invalid_tenant_id(self):
|
def test_authenticate_invalid_tenant_id(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
self.assertRaises(client_exceptions.Unauthorized,
|
self.assertRaises(client_exceptions.Unauthorized,
|
||||||
self._client,
|
self._client,
|
||||||
username=self.user_foo['name'],
|
username=self.user_foo['name'],
|
||||||
|
@ -153,7 +137,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(self.tenant_bar['id'], tenants[0].id)
|
self.assertEqual(self.tenant_bar['id'], tenants[0].id)
|
||||||
|
|
||||||
def test_authenticate_token_invalid_tenant_id(self):
|
def test_authenticate_token_invalid_tenant_id(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
token = client.auth_token
|
token = client.auth_token
|
||||||
self.assertRaises(client_exceptions.Unauthorized,
|
self.assertRaises(client_exceptions.Unauthorized,
|
||||||
|
@ -161,7 +144,6 @@ class KeystoneClientTests(object):
|
||||||
tenant_id=uuid.uuid4().hex)
|
tenant_id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_authenticate_token_invalid_tenant_name(self):
|
def test_authenticate_token_invalid_tenant_name(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
token = client.auth_token
|
token = client.auth_token
|
||||||
self.assertRaises(client_exceptions.Unauthorized,
|
self.assertRaises(client_exceptions.Unauthorized,
|
||||||
|
@ -177,8 +159,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(self.tenant_bar['id'], tenants[0].id)
|
self.assertEqual(self.tenant_bar['id'], tenants[0].id)
|
||||||
|
|
||||||
def test_authenticate_and_delete_token(self):
|
def test_authenticate_and_delete_token(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
token = client.auth_token
|
token = client.auth_token
|
||||||
token_client = self._client(token=token)
|
token_client = self._client(token=token)
|
||||||
|
@ -191,8 +171,6 @@ class KeystoneClientTests(object):
|
||||||
token_client.tenants.list)
|
token_client.tenants.list)
|
||||||
|
|
||||||
def test_authenticate_no_password(self):
|
def test_authenticate_no_password(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
user_ref = self.user_foo.copy()
|
user_ref = self.user_foo.copy()
|
||||||
user_ref['password'] = None
|
user_ref['password'] = None
|
||||||
self.assertRaises(client_exceptions.AuthorizationFailure,
|
self.assertRaises(client_exceptions.AuthorizationFailure,
|
||||||
|
@ -200,8 +178,6 @@ class KeystoneClientTests(object):
|
||||||
user_ref)
|
user_ref)
|
||||||
|
|
||||||
def test_authenticate_no_username(self):
|
def test_authenticate_no_username(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
user_ref = self.user_foo.copy()
|
user_ref = self.user_foo.copy()
|
||||||
user_ref['name'] = None
|
user_ref['name'] = None
|
||||||
self.assertRaises(client_exceptions.AuthorizationFailure,
|
self.assertRaises(client_exceptions.AuthorizationFailure,
|
||||||
|
@ -209,8 +185,6 @@ class KeystoneClientTests(object):
|
||||||
user_ref)
|
user_ref)
|
||||||
|
|
||||||
def test_authenticate_disabled_tenant(self):
|
def test_authenticate_disabled_tenant(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
admin_client = self.get_client(admin=True)
|
admin_client = self.get_client(admin=True)
|
||||||
|
|
||||||
tenant = {
|
tenant = {
|
||||||
|
@ -261,8 +235,6 @@ class KeystoneClientTests(object):
|
||||||
# FIXME(ja): add a test that admin endpoint returns unauthorized if not
|
# FIXME(ja): add a test that admin endpoint returns unauthorized if not
|
||||||
# admin
|
# admin
|
||||||
def test_tenant_create_update_and_delete(self):
|
def test_tenant_create_update_and_delete(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
tenant_name = 'original_tenant'
|
tenant_name = 'original_tenant'
|
||||||
tenant_description = 'My original tenant!'
|
tenant_description = 'My original tenant!'
|
||||||
tenant_enabled = True
|
tenant_enabled = True
|
||||||
|
@ -316,8 +288,6 @@ class KeystoneClientTests(object):
|
||||||
if t.id == tenant.id])
|
if t.id == tenant.id])
|
||||||
|
|
||||||
def test_tenant_create_update_and_delete_unicode(self):
|
def test_tenant_create_update_and_delete_unicode(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
tenant_name = u'original \u540d\u5b57'
|
tenant_name = u'original \u540d\u5b57'
|
||||||
tenant_description = 'My original tenant!'
|
tenant_description = 'My original tenant!'
|
||||||
tenant_enabled = True
|
tenant_enabled = True
|
||||||
|
@ -372,28 +342,24 @@ class KeystoneClientTests(object):
|
||||||
if t.id == tenant.id])
|
if t.id == tenant.id])
|
||||||
|
|
||||||
def test_tenant_create_no_name(self):
|
def test_tenant_create_no_name(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.BadRequest,
|
self.assertRaises(client_exceptions.BadRequest,
|
||||||
client.tenants.create,
|
client.tenants.create,
|
||||||
tenant_name="")
|
tenant_name="")
|
||||||
|
|
||||||
def test_tenant_delete_404(self):
|
def test_tenant_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.tenants.delete,
|
client.tenants.delete,
|
||||||
tenant=uuid.uuid4().hex)
|
tenant=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_tenant_get_404(self):
|
def test_tenant_get_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.tenants.get,
|
client.tenants.get,
|
||||||
tenant_id=uuid.uuid4().hex)
|
tenant_id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_tenant_update_404(self):
|
def test_tenant_update_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.tenants.update,
|
client.tenants.update,
|
||||||
|
@ -410,8 +376,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(len(default_fixtures.TENANTS), len(tenants))
|
self.assertEqual(len(default_fixtures.TENANTS), len(tenants))
|
||||||
|
|
||||||
def test_invalid_password(self):
|
def test_invalid_password(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
good_client = self._client(username=self.user_foo['name'],
|
good_client = self._client(username=self.user_foo['name'],
|
||||||
password=self.user_foo['password'])
|
password=self.user_foo['password'])
|
||||||
good_client.tenants.list()
|
good_client.tenants.list()
|
||||||
|
@ -422,16 +386,12 @@ class KeystoneClientTests(object):
|
||||||
password=uuid.uuid4().hex)
|
password=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_invalid_user_and_password(self):
|
def test_invalid_user_and_password(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
self.assertRaises(client_exceptions.Unauthorized,
|
self.assertRaises(client_exceptions.Unauthorized,
|
||||||
self._client,
|
self._client,
|
||||||
username=uuid.uuid4().hex,
|
username=uuid.uuid4().hex,
|
||||||
password=uuid.uuid4().hex)
|
password=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_change_password_invalidates_token(self):
|
def test_change_password_invalidates_token(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
|
|
||||||
username = uuid.uuid4().hex
|
username = uuid.uuid4().hex
|
||||||
|
@ -453,8 +413,6 @@ class KeystoneClientTests(object):
|
||||||
token=token_id)
|
token=token_id)
|
||||||
|
|
||||||
def test_disable_tenant_invalidates_token(self):
|
def test_disable_tenant_invalidates_token(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
admin_client = self.get_client(admin=True)
|
admin_client = self.get_client(admin=True)
|
||||||
foo_client = self.get_client(self.user_foo)
|
foo_client = self.get_client(self.user_foo)
|
||||||
tenant_bar = admin_client.tenants.get(self.tenant_bar['id'])
|
tenant_bar = admin_client.tenants.get(self.tenant_bar['id'])
|
||||||
|
@ -473,8 +431,6 @@ class KeystoneClientTests(object):
|
||||||
self.user_foo)
|
self.user_foo)
|
||||||
|
|
||||||
def test_delete_tenant_invalidates_token(self):
|
def test_delete_tenant_invalidates_token(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
admin_client = self.get_client(admin=True)
|
admin_client = self.get_client(admin=True)
|
||||||
foo_client = self.get_client(self.user_foo)
|
foo_client = self.get_client(self.user_foo)
|
||||||
tenant_bar = admin_client.tenants.get(self.tenant_bar['id'])
|
tenant_bar = admin_client.tenants.get(self.tenant_bar['id'])
|
||||||
|
@ -493,8 +449,6 @@ class KeystoneClientTests(object):
|
||||||
self.user_foo)
|
self.user_foo)
|
||||||
|
|
||||||
def test_disable_user_invalidates_token(self):
|
def test_disable_user_invalidates_token(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
admin_client = self.get_client(admin=True)
|
admin_client = self.get_client(admin=True)
|
||||||
foo_client = self.get_client(self.user_foo)
|
foo_client = self.get_client(self.user_foo)
|
||||||
|
|
||||||
|
@ -510,8 +464,6 @@ class KeystoneClientTests(object):
|
||||||
self.user_foo)
|
self.user_foo)
|
||||||
|
|
||||||
def test_delete_user_invalidates_token(self):
|
def test_delete_user_invalidates_token(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
admin_client = self.get_client(admin=True)
|
admin_client = self.get_client(admin=True)
|
||||||
client = self.get_client(admin=False)
|
client = self.get_client(admin=False)
|
||||||
|
|
||||||
|
@ -549,8 +501,6 @@ class KeystoneClientTests(object):
|
||||||
timeutils.parse_isotime(reauthenticated_token.expires))
|
timeutils.parse_isotime(reauthenticated_token.expires))
|
||||||
|
|
||||||
def test_user_create_update_delete(self):
|
def test_user_create_update_delete(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
test_username = 'new_user'
|
test_username = 'new_user'
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
user = client.users.create(name=test_username,
|
user = client.users.create(name=test_username,
|
||||||
|
@ -612,7 +562,6 @@ class KeystoneClientTests(object):
|
||||||
user=user, tenant=self.tenant_bar['id'])
|
user=user, tenant=self.tenant_bar['id'])
|
||||||
|
|
||||||
def test_user_create_no_string_password(self):
|
def test_user_create_no_string_password(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.BadRequest,
|
self.assertRaises(client_exceptions.BadRequest,
|
||||||
client.users.create,
|
client.users.create,
|
||||||
|
@ -621,7 +570,6 @@ class KeystoneClientTests(object):
|
||||||
email=uuid.uuid4().hex)
|
email=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_user_create_no_name(self):
|
def test_user_create_no_name(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.BadRequest,
|
self.assertRaises(client_exceptions.BadRequest,
|
||||||
client.users.create,
|
client.users.create,
|
||||||
|
@ -630,7 +578,6 @@ class KeystoneClientTests(object):
|
||||||
email=uuid.uuid4().hex)
|
email=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_user_create_404(self):
|
def test_user_create_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.users.create,
|
client.users.create,
|
||||||
|
@ -640,21 +587,18 @@ class KeystoneClientTests(object):
|
||||||
tenant_id=uuid.uuid4().hex)
|
tenant_id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_user_get_404(self):
|
def test_user_get_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.users.get,
|
client.users.get,
|
||||||
user=uuid.uuid4().hex)
|
user=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_user_list_404(self):
|
def test_user_list_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.users.list,
|
client.users.list,
|
||||||
tenant_id=uuid.uuid4().hex)
|
tenant_id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_user_update_404(self):
|
def test_user_update_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.users.update,
|
client.users.update,
|
||||||
|
@ -668,7 +612,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(tenant_id, user.tenant_id)
|
self.assertEqual(tenant_id, user.tenant_id)
|
||||||
|
|
||||||
def test_user_update_password_404(self):
|
def test_user_update_password_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.users.update_password,
|
client.users.update_password,
|
||||||
|
@ -676,7 +619,6 @@ class KeystoneClientTests(object):
|
||||||
password=uuid.uuid4().hex)
|
password=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_user_delete_404(self):
|
def test_user_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.users.delete,
|
client.users.delete,
|
||||||
|
@ -700,8 +642,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(self.role_admin['id'], role.id)
|
self.assertEqual(self.role_admin['id'], role.id)
|
||||||
|
|
||||||
def test_role_crud(self):
|
def test_role_crud(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
test_role = 'new_role'
|
test_role = 'new_role'
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
role = client.roles.create(name=test_role)
|
role = client.roles.create(name=test_role)
|
||||||
|
@ -720,28 +660,24 @@ class KeystoneClientTests(object):
|
||||||
role=role.id)
|
role=role.id)
|
||||||
|
|
||||||
def test_role_create_no_name(self):
|
def test_role_create_no_name(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.BadRequest,
|
self.assertRaises(client_exceptions.BadRequest,
|
||||||
client.roles.create,
|
client.roles.create,
|
||||||
name="")
|
name="")
|
||||||
|
|
||||||
def test_role_get_404(self):
|
def test_role_get_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.roles.get,
|
client.roles.get,
|
||||||
role=uuid.uuid4().hex)
|
role=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_role_delete_404(self):
|
def test_role_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.roles.delete,
|
client.roles.delete,
|
||||||
role=uuid.uuid4().hex)
|
role=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_role_list_404(self):
|
def test_role_list_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.roles.roles_for_user,
|
client.roles.roles_for_user,
|
||||||
|
@ -763,7 +699,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertTrue(len(roles) > 0)
|
self.assertTrue(len(roles) > 0)
|
||||||
|
|
||||||
def test_service_crud(self):
|
def test_service_crud(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
|
|
||||||
service_name = uuid.uuid4().hex
|
service_name = uuid.uuid4().hex
|
||||||
|
@ -799,28 +734,24 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(0, len(services))
|
self.assertEqual(0, len(services))
|
||||||
|
|
||||||
def test_service_delete_404(self):
|
def test_service_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.services.delete,
|
client.services.delete,
|
||||||
id=uuid.uuid4().hex)
|
id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_service_get_404(self):
|
def test_service_get_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.services.get,
|
client.services.get,
|
||||||
id=uuid.uuid4().hex)
|
id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_endpoint_delete_404(self):
|
def test_endpoint_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.endpoints.delete,
|
client.endpoints.delete,
|
||||||
id=uuid.uuid4().hex)
|
id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_admin_requires_adminness(self):
|
def test_admin_requires_adminness(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
# FIXME(ja): this should be Unauthorized
|
# FIXME(ja): this should be Unauthorized
|
||||||
exception = client_exceptions.ClientException
|
exception = client_exceptions.ClientException
|
||||||
|
|
||||||
|
@ -889,7 +820,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertNotIn(self.user_two['id'], [x.id for x in user_refs])
|
self.assertNotIn(self.user_two['id'], [x.id for x in user_refs])
|
||||||
|
|
||||||
def test_user_role_add_404(self):
|
def test_user_role_add_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.roles.add_user_role,
|
client.roles.add_user_role,
|
||||||
|
@ -910,7 +840,6 @@ class KeystoneClientTests(object):
|
||||||
role=self.role_member['id'])
|
role=self.role_member['id'])
|
||||||
|
|
||||||
def test_user_role_remove_404(self):
|
def test_user_role_remove_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.roles.remove_user_role,
|
client.roles.remove_user_role,
|
||||||
|
@ -954,8 +883,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(tenants_marker[1].name, tenants[2].name)
|
self.assertEqual(tenants_marker[1].name, tenants[2].name)
|
||||||
|
|
||||||
def test_tenant_list_marker_not_found(self):
|
def test_tenant_list_marker_not_found(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
self.assertRaises(client_exceptions.BadRequest,
|
self.assertRaises(client_exceptions.BadRequest,
|
||||||
client.tenants.list, marker=uuid.uuid4().hex)
|
client.tenants.list, marker=uuid.uuid4().hex)
|
||||||
|
@ -981,8 +908,6 @@ class KeystoneClientTests(object):
|
||||||
self.assertEqual(tenants[1].name, tenants_limited[1].name)
|
self.assertEqual(tenants[1].name, tenants_limited[1].name)
|
||||||
|
|
||||||
def test_tenant_list_limit_bad_value(self):
|
def test_tenant_list_limit_bad_value(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
self.assertRaises(client_exceptions.BadRequest,
|
self.assertRaises(client_exceptions.BadRequest,
|
||||||
client.tenants.list, limit='a')
|
client.tenants.list, limit='a')
|
||||||
|
@ -1021,8 +946,6 @@ class KeystoneClientTests(object):
|
||||||
self.get_client(self.user_two)
|
self.get_client(self.user_two)
|
||||||
|
|
||||||
def test_user_cannot_update_other_users_passwd(self):
|
def test_user_cannot_update_other_users_passwd(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client(self.user_two)
|
client = self.get_client(self.user_two)
|
||||||
|
|
||||||
token_id = client.auth_token
|
token_id = client.auth_token
|
||||||
|
@ -1050,8 +973,6 @@ class KeystoneClientTests(object):
|
||||||
self.get_client, self.user_two)
|
self.get_client, self.user_two)
|
||||||
|
|
||||||
def test_tokens_after_user_update_passwd(self):
|
def test_tokens_after_user_update_passwd(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client(self.user_two)
|
client = self.get_client(self.user_two)
|
||||||
|
|
||||||
token_id = client.auth_token
|
token_id = client.auth_token
|
||||||
|
@ -1080,28 +1001,3 @@ class KeystoneClientTests(object):
|
||||||
self.assertRaises(client_exceptions.Unauthorized, client.tenants.list)
|
self.assertRaises(client_exceptions.Unauthorized, client.tenants.list)
|
||||||
client.auth_token = new_token_id
|
client.auth_token = new_token_id
|
||||||
client.tenants.list()
|
client.tenants.list()
|
||||||
|
|
||||||
|
|
||||||
class KcMasterTestCase(CompatTestCase, KeystoneClientTests):
|
|
||||||
checkout_info = (KEYSTONECLIENT_REPO, 'master')
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
if os.environ.get('KSCTEST_PATH'):
|
|
||||||
self.skip('KSCTEST_PATH env set, running tests with local '
|
|
||||||
'client instead.')
|
|
||||||
super(KcMasterTestCase, self).setUp()
|
|
||||||
|
|
||||||
|
|
||||||
class KcOptTestCase(KcMasterTestCase):
|
|
||||||
# Set KSCTEST_PATH to the keystoneclient directory, then run this test.
|
|
||||||
#
|
|
||||||
# For example, to test your local keystoneclient,
|
|
||||||
#
|
|
||||||
# KSCTEST_PATH=/opt/stack/python-keystoneclient;
|
|
||||||
# tox -e py27 test_keystoneclient.KcOptTestCase
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
self.checkout_info = os.environ.get('KSCTEST_PATH')
|
|
||||||
if not self.checkout_info:
|
|
||||||
self.skip('Set KSCTEST_PATH env to test with local client')
|
|
||||||
super(KcOptTestCase, self).setUp()
|
|
||||||
|
|
|
@ -12,29 +12,27 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient.contrib.ec2 import utils as ec2_utils
|
from keystoneclient.contrib.ec2 import utils as ec2_utils
|
||||||
|
from keystoneclient import exceptions as client_exceptions
|
||||||
|
|
||||||
from keystone import tests
|
from keystone import tests
|
||||||
from keystone.tests import test_keystoneclient
|
from keystone.tests import test_keystoneclient
|
||||||
|
|
||||||
|
|
||||||
class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
class ClientDrivenSqlTestCase(test_keystoneclient.ClientDrivenTestCase):
|
||||||
def config_files(self):
|
def config_files(self):
|
||||||
config_files = super(KcMasterSqlTestCase, self).config_files()
|
config_files = super(ClientDrivenSqlTestCase, self).config_files()
|
||||||
config_files.append(tests.dirs.tests_conf('backend_sql.conf'))
|
config_files.append(tests.dirs.tests_conf('backend_sql.conf'))
|
||||||
return config_files
|
return config_files
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(KcMasterSqlTestCase, self).setUp()
|
super(ClientDrivenSqlTestCase, self).setUp()
|
||||||
self.default_client = self.get_client()
|
self.default_client = self.get_client()
|
||||||
self.addCleanup(self.cleanup_instance('default_client'))
|
self.addCleanup(self.cleanup_instance('default_client'))
|
||||||
|
|
||||||
def test_endpoint_crud(self):
|
def test_endpoint_crud(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
|
|
||||||
service = client.services.create(name=uuid.uuid4().hex,
|
service = client.services.create(name=uuid.uuid4().hex,
|
||||||
|
@ -142,8 +140,6 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
# this test..
|
# this test..
|
||||||
|
|
||||||
def test_ec2_auth_failure(self):
|
def test_ec2_auth_failure(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
credentials, signature = self._generate_default_user_ec2_credentials()
|
credentials, signature = self._generate_default_user_ec2_credentials()
|
||||||
credentials['signature'] = uuid.uuid4().hex
|
credentials['signature'] = uuid.uuid4().hex
|
||||||
self.assertRaises(client_exceptions.Unauthorized,
|
self.assertRaises(client_exceptions.Unauthorized,
|
||||||
|
@ -206,7 +202,6 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
self.assertNotIn(cred_4, creds)
|
self.assertNotIn(cred_4, creds)
|
||||||
|
|
||||||
def test_ec2_credentials_create_404(self):
|
def test_ec2_credentials_create_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
self.default_client.ec2.create,
|
self.default_client.ec2.create,
|
||||||
user_id=uuid.uuid4().hex,
|
user_id=uuid.uuid4().hex,
|
||||||
|
@ -217,38 +212,28 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
tenant_id=uuid.uuid4().hex)
|
tenant_id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_ec2_credentials_delete_404(self):
|
def test_ec2_credentials_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
self.default_client.ec2.delete,
|
self.default_client.ec2.delete,
|
||||||
user_id=uuid.uuid4().hex,
|
user_id=uuid.uuid4().hex,
|
||||||
access=uuid.uuid4().hex)
|
access=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_ec2_credentials_get_404(self):
|
def test_ec2_credentials_get_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
self.default_client.ec2.get,
|
self.default_client.ec2.get,
|
||||||
user_id=uuid.uuid4().hex,
|
user_id=uuid.uuid4().hex,
|
||||||
access=uuid.uuid4().hex)
|
access=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_ec2_credentials_list_404(self):
|
def test_ec2_credentials_list_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
self.default_client.ec2.list,
|
self.default_client.ec2.list,
|
||||||
user_id=uuid.uuid4().hex)
|
user_id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_ec2_credentials_list_user_forbidden(self):
|
def test_ec2_credentials_list_user_forbidden(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
two = self.get_client(self.user_two)
|
two = self.get_client(self.user_two)
|
||||||
self.assertRaises(client_exceptions.Forbidden, two.ec2.list,
|
self.assertRaises(client_exceptions.Forbidden, two.ec2.list,
|
||||||
user_id=self.user_foo['id'])
|
user_id=self.user_foo['id'])
|
||||||
|
|
||||||
def test_ec2_credentials_get_user_forbidden(self):
|
def test_ec2_credentials_get_user_forbidden(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
cred = self.default_client.ec2.create(user_id=self.user_foo['id'],
|
cred = self.default_client.ec2.create(user_id=self.user_foo['id'],
|
||||||
tenant_id=self.tenant_bar['id'])
|
tenant_id=self.tenant_bar['id'])
|
||||||
|
|
||||||
|
@ -260,8 +245,6 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
access=cred.access)
|
access=cred.access)
|
||||||
|
|
||||||
def test_ec2_credentials_delete_user_forbidden(self):
|
def test_ec2_credentials_delete_user_forbidden(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
cred = self.default_client.ec2.create(user_id=self.user_foo['id'],
|
cred = self.default_client.ec2.create(user_id=self.user_foo['id'],
|
||||||
tenant_id=self.tenant_bar['id'])
|
tenant_id=self.tenant_bar['id'])
|
||||||
|
|
||||||
|
@ -273,7 +256,6 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
access=cred.access)
|
access=cred.access)
|
||||||
|
|
||||||
def test_endpoint_create_404(self):
|
def test_endpoint_create_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.endpoints.create,
|
client.endpoints.create,
|
||||||
|
@ -284,15 +266,12 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
internalurl=uuid.uuid4().hex)
|
internalurl=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_endpoint_delete_404(self):
|
def test_endpoint_delete_404(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
client = self.get_client(admin=True)
|
client = self.get_client(admin=True)
|
||||||
self.assertRaises(client_exceptions.NotFound,
|
self.assertRaises(client_exceptions.NotFound,
|
||||||
client.endpoints.delete,
|
client.endpoints.delete,
|
||||||
id=uuid.uuid4().hex)
|
id=uuid.uuid4().hex)
|
||||||
|
|
||||||
def test_policy_crud(self):
|
def test_policy_crud(self):
|
||||||
from keystoneclient import exceptions as client_exceptions
|
|
||||||
|
|
||||||
# FIXME(dolph): this test was written prior to the v3 implementation of
|
# FIXME(dolph): this test was written prior to the v3 implementation of
|
||||||
# the client and essentially refers to a non-existent
|
# the client and essentially refers to a non-existent
|
||||||
# policy manager in the v2 client. this test needs to be
|
# policy manager in the v2 client. this test needs to be
|
||||||
|
@ -363,18 +342,3 @@ class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
|
||||||
policy=policy.id)
|
policy=policy.id)
|
||||||
policies = [x for x in client.policies.list() if x.id == policy.id]
|
policies = [x for x in client.policies.list() if x.id == policy.id]
|
||||||
self.assertEqual(0, len(policies))
|
self.assertEqual(0, len(policies))
|
||||||
|
|
||||||
|
|
||||||
class KcOptTestCase(KcMasterSqlTestCase):
|
|
||||||
# Set KSCTEST_PATH to the keystoneclient directory, then run this test.
|
|
||||||
#
|
|
||||||
# For example, to test your local keystoneclient,
|
|
||||||
#
|
|
||||||
# KSCTEST_PATH=/opt/stack/python-keystoneclient;
|
|
||||||
# tox -e py27 test_keystoneclient_sql.KcOptTestCase
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
self.checkout_info = os.environ.get('KSCTEST_PATH')
|
|
||||||
if not self.checkout_info:
|
|
||||||
self.skip('Set KSCTEST_PATH env to test with local client')
|
|
||||||
super(KcOptTestCase, self).setUp()
|
|
||||||
|
|
|
@ -47,10 +47,6 @@ testrepository>=0.0.18
|
||||||
testtools>=0.9.36,!=1.2.0
|
testtools>=0.9.36,!=1.2.0
|
||||||
testscenarios>=0.4
|
testscenarios>=0.4
|
||||||
|
|
||||||
# for python-keystoneclient
|
|
||||||
requests>=2.2.0,!=2.4.0
|
|
||||||
keyring>=2.1,!=3.3
|
|
||||||
|
|
||||||
# For documentation
|
# For documentation
|
||||||
oslosphinx>=2.2.0 # Apache-2.0
|
oslosphinx>=2.2.0 # Apache-2.0
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,6 @@ testrepository>=0.0.18
|
||||||
testtools>=0.9.36,!=1.2.0
|
testtools>=0.9.36,!=1.2.0
|
||||||
testscenarios>=0.4
|
testscenarios>=0.4
|
||||||
|
|
||||||
# for python-keystoneclient
|
|
||||||
requests>=2.2.0,!=2.4.0
|
|
||||||
keyring>=2.1,!=3.3
|
|
||||||
|
|
||||||
# For documentation
|
# For documentation
|
||||||
oslosphinx>=2.2.0 # Apache-2.0
|
oslosphinx>=2.2.0 # Apache-2.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue