diff options
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/common/openstackkeyring.py | 2 | ||||
| -rw-r--r-- | openstackclient/identity/client.py | 2 | ||||
| -rw-r--r-- | openstackclient/image/client.py | 2 | ||||
| -rw-r--r-- | openstackclient/tests/common/test_restapi.py | 5 | ||||
| -rw-r--r-- | openstackclient/tests/fakes.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/volume/v1/fakes.py | 2 | ||||
| -rw-r--r-- | openstackclient/tests/volume/v1/test_volume.py | 6 |
7 files changed, 13 insertions, 9 deletions
diff --git a/openstackclient/common/openstackkeyring.py b/openstackclient/common/openstackkeyring.py index bf9d5b71..30450e80 100644 --- a/openstackclient/common/openstackkeyring.py +++ b/openstackclient/common/openstackkeyring.py @@ -37,7 +37,7 @@ class OpenStackKeyring(keyring.backends.file.BaseKeyring): block_size = 32 padding = '0' - # init the cipher with the class name, upto block_size + # init the cipher with the class name, up to block_size password = __name__[block_size:] password = password + (block_size - len(password) % block_size) * padding diff --git a/openstackclient/identity/client.py b/openstackclient/identity/client.py index b19388cc..a71dfc7a 100644 --- a/openstackclient/identity/client.py +++ b/openstackclient/identity/client.py @@ -70,4 +70,4 @@ class IdentityClientv2_0(identity_client_v2_0.Client): if name == "projects": return self.tenants else: - raise AttributeError, name + raise AttributeError(name) diff --git a/openstackclient/image/client.py b/openstackclient/image/client.py index 9edffded..ba48a0e9 100644 --- a/openstackclient/image/client.py +++ b/openstackclient/image/client.py @@ -73,7 +73,7 @@ class Client_v1(gc_v1_client.Client): def __init__(self, *args, **kwargs): super(Client_v1, self).__init__(*args, **kwargs) - self.images = ImageManager_v1(self) + self.images = ImageManager_v1(getattr(self, 'http_client', self)) class ImageManager_v1(gc_v1_images.ImageManager): diff --git a/openstackclient/tests/common/test_restapi.py b/openstackclient/tests/common/test_restapi.py index c1e02fcb..291818c1 100644 --- a/openstackclient/tests/common/test_restapi.py +++ b/openstackclient/tests/common/test_restapi.py @@ -19,6 +19,7 @@ import json import mock import requests +import six from openstackclient.common import restapi from openstackclient.tests import utils @@ -55,13 +56,15 @@ fake_headers = { class FakeResponse(requests.Response): - def __init__(self, headers={}, status_code=None, data=None, encoding=None): + def __init__(self, headers={}, status_code=200, data=None, encoding=None): super(FakeResponse, self).__init__() self.status_code = status_code self.headers.update(headers) self._content = json.dumps(data) + if not isinstance(self._content, six.binary_type): + self._content = self._content.encode() @mock.patch('openstackclient.common.restapi.requests.Session') diff --git a/openstackclient/tests/fakes.py b/openstackclient/tests/fakes.py index 01214243..4c50c0be 100644 --- a/openstackclient/tests/fakes.py +++ b/openstackclient/tests/fakes.py @@ -13,6 +13,7 @@ # under the License. # +import six import sys @@ -68,7 +69,7 @@ class FakeResource(object): self._loaded = loaded def _add_details(self, info): - for (k, v) in info.iteritems(): + for (k, v) in six.iteritems(info): setattr(self, k, v) def __repr__(self): diff --git a/openstackclient/tests/volume/v1/fakes.py b/openstackclient/tests/volume/v1/fakes.py index b25dfaf7..d6ef0d39 100644 --- a/openstackclient/tests/volume/v1/fakes.py +++ b/openstackclient/tests/volume/v1/fakes.py @@ -32,7 +32,7 @@ VOLUME = { 'display_description': volume_description, 'size': volume_size, 'status': '', - 'attach_status': 'detatched', + 'attach_status': 'detached', 'metadata': volume_metadata, } diff --git a/openstackclient/tests/volume/v1/test_volume.py b/openstackclient/tests/volume/v1/test_volume.py index 4e033dfe..554e2b2a 100644 --- a/openstackclient/tests/volume/v1/test_volume.py +++ b/openstackclient/tests/volume/v1/test_volume.py @@ -105,7 +105,7 @@ class TestVolumeCreate(TestVolume): ) self.assertEqual(columns, collist) datalist = ( - 'detatched', + 'detached', volume_fakes.volume_description, volume_fakes.volume_name, volume_fakes.volume_id, @@ -181,7 +181,7 @@ class TestVolumeCreate(TestVolume): ) self.assertEqual(columns, collist) datalist = ( - 'detatched', + 'detached', volume_fakes.volume_description, volume_fakes.volume_name, volume_fakes.volume_id, @@ -257,7 +257,7 @@ class TestVolumeCreate(TestVolume): ) self.assertEqual(columns, collist) datalist = ( - 'detatched', + 'detached', volume_fakes.volume_description, volume_fakes.volume_name, volume_fakes.volume_id, |
