From 1b581fa3d85386c07fcef2038be253a49ea66f5b Mon Sep 17 00:00:00 2001 From: Fernando Ojeda Date: Tue, 9 Apr 2019 12:07:42 -0400 Subject: [PATCH 1/5] Fix object storage credentials. --- .../CLI/object_storage/credential/__init__.py | 42 ++++++++++ .../CLI/object_storage/credential/create.py | 28 +++++++ .../CLI/object_storage/credential/delete.py | 22 ++++++ .../CLI/object_storage/credential/limit.py | 24 ++++++ .../CLI/object_storage/credential/list.py | 29 +++++++ SoftLayer/CLI/routes.py | 2 + ..._Network_Storage_Hub_Cleversafe_Account.py | 39 ++++++++++ SoftLayer/managers/object_storage.py | 44 +++++++++++ tests/CLI/modules/object_storage_tests.py | 70 +++++++++++++++++ tests/managers/object_storage_tests.py | 77 +++++++++++++++++++ 10 files changed, 377 insertions(+) create mode 100644 SoftLayer/CLI/object_storage/credential/__init__.py create mode 100644 SoftLayer/CLI/object_storage/credential/create.py create mode 100644 SoftLayer/CLI/object_storage/credential/delete.py create mode 100644 SoftLayer/CLI/object_storage/credential/limit.py create mode 100644 SoftLayer/CLI/object_storage/credential/list.py create mode 100644 SoftLayer/fixtures/SoftLayer_Network_Storage_Hub_Cleversafe_Account.py diff --git a/SoftLayer/CLI/object_storage/credential/__init__.py b/SoftLayer/CLI/object_storage/credential/__init__.py new file mode 100644 index 000000000..1f71754bb --- /dev/null +++ b/SoftLayer/CLI/object_storage/credential/__init__.py @@ -0,0 +1,42 @@ +"""Manages Object Storage S3 Credentials.""" +# :license: MIT, see LICENSE for more details. + +import importlib +import os + +import click + +CONTEXT = {'help_option_names': ['-h', '--help'], + 'max_content_width': 999} + + +class CapacityCommands(click.MultiCommand): + """Loads module for object storage S3 credentials related commands.""" + + def __init__(self, **attrs): + click.MultiCommand.__init__(self, **attrs) + self.path = os.path.dirname(__file__) + + def list_commands(self, ctx): + """List all sub-commands.""" + commands = [] + for filename in os.listdir(self.path): + if filename == '__init__.py': + continue + if filename.endswith('.py'): + commands.append(filename[:-3].replace("_", "-")) + commands.sort() + return commands + + def get_command(self, ctx, cmd_name): + """Get command for click.""" + path = "%s.%s" % (__name__, cmd_name) + path = path.replace("-", "_") + module = importlib.import_module(path) + return getattr(module, 'cli') + + +# Required to get the sub-sub-sub command to work. +@click.group(cls=CapacityCommands, context_settings=CONTEXT) +def cli(): + """Base command for all object storage credentials S3 related concerns""" diff --git a/SoftLayer/CLI/object_storage/credential/create.py b/SoftLayer/CLI/object_storage/credential/create.py new file mode 100644 index 000000000..934ac7651 --- /dev/null +++ b/SoftLayer/CLI/object_storage/credential/create.py @@ -0,0 +1,28 @@ +"""Create credentials for an IBM Cloud Object Storage Account.""" +# :license: MIT, see LICENSE for more details. + +import click + +import SoftLayer +from SoftLayer.CLI import environment +from SoftLayer.CLI import formatting + + +@click.command() +@click.argument('identifier') +@environment.pass_env +def cli(env, identifier): + """Create credentials for an IBM Cloud Object Storage Account""" + + mgr = SoftLayer.ObjectStorageManager(env.client) + credential = mgr.create_credential(identifier) + table = formatting.Table(['id', 'password', 'username', 'type_name']) + table.sortby = 'id' + table.add_row([ + credential['id'], + credential['password'], + credential['username'], + credential['type']['name'] + ]) + + env.fout(table) diff --git a/SoftLayer/CLI/object_storage/credential/delete.py b/SoftLayer/CLI/object_storage/credential/delete.py new file mode 100644 index 000000000..c5a9ab682 --- /dev/null +++ b/SoftLayer/CLI/object_storage/credential/delete.py @@ -0,0 +1,22 @@ +"""Delete the credential of an Object Storage Account.""" +# :license: MIT, see LICENSE for more details. + +import click + +import SoftLayer +from SoftLayer.CLI import environment, exceptions + + +@click.command() +@click.argument('identifier') +@click.option('--credential_id', '-id', type=click.INT, + help="This is the credential id associated with the volume") +@environment.pass_env +def cli(env, identifier, credential_id): + """Delete the credential of an Object Storage Account.""" + + mgr = SoftLayer.ObjectStorageManager(env.client) + credential = mgr.delete_credential(identifier, credential_id=credential_id) + + if credential: + env.fout("The credential was deleted successful") diff --git a/SoftLayer/CLI/object_storage/credential/limit.py b/SoftLayer/CLI/object_storage/credential/limit.py new file mode 100644 index 000000000..96d293eae --- /dev/null +++ b/SoftLayer/CLI/object_storage/credential/limit.py @@ -0,0 +1,24 @@ +""" Credential limits for this IBM Cloud Object Storage account.""" +# :license: MIT, see LICENSE for more details. + +import click + +import SoftLayer +from SoftLayer.CLI import environment +from SoftLayer.CLI import formatting + + +@click.command() +@click.argument('identifier') +@environment.pass_env +def cli(env, identifier): + """ Credential limits for this IBM Cloud Object Storage account.""" + + mgr = SoftLayer.ObjectStorageManager(env.client) + limit = mgr.limit_credential(identifier) + table = formatting.Table(['limit']) + table.add_row([ + limit, + ]) + + env.fout(table) diff --git a/SoftLayer/CLI/object_storage/credential/list.py b/SoftLayer/CLI/object_storage/credential/list.py new file mode 100644 index 000000000..2cf81ca3c --- /dev/null +++ b/SoftLayer/CLI/object_storage/credential/list.py @@ -0,0 +1,29 @@ +"""Retrieve credentials used for generating an AWS signature. Max of 2.""" +# :license: MIT, see LICENSE for more details. + +import click + +import SoftLayer +from SoftLayer.CLI import environment +from SoftLayer.CLI import formatting + + +@click.command() +@click.argument('identifier') +@environment.pass_env +def cli(env, identifier): + """Retrieve credentials used for generating an AWS signature. Max of 2.""" + + mgr = SoftLayer.ObjectStorageManager(env.client) + list = mgr.list_credential(identifier) + table = formatting.Table(['id', 'password', 'username', 'type_name']) + + for credential in list: + table.add_row([ + credential['id'], + credential['password'], + credential['username'], + credential['type']['name'] + ]) + + env.fout(table) diff --git a/SoftLayer/CLI/routes.py b/SoftLayer/CLI/routes.py index c04233c52..97551aeff 100644 --- a/SoftLayer/CLI/routes.py +++ b/SoftLayer/CLI/routes.py @@ -199,6 +199,8 @@ 'SoftLayer.CLI.object_storage.list_accounts:cli'), ('object-storage:endpoints', 'SoftLayer.CLI.object_storage.list_endpoints:cli'), + ('object-storage:credential', + 'SoftLayer.CLI.object_storage.credential:cli'), ('order', 'SoftLayer.CLI.order'), ('order:category-list', 'SoftLayer.CLI.order.category_list:cli'), diff --git a/SoftLayer/fixtures/SoftLayer_Network_Storage_Hub_Cleversafe_Account.py b/SoftLayer/fixtures/SoftLayer_Network_Storage_Hub_Cleversafe_Account.py new file mode 100644 index 000000000..4bc3f4fc7 --- /dev/null +++ b/SoftLayer/fixtures/SoftLayer_Network_Storage_Hub_Cleversafe_Account.py @@ -0,0 +1,39 @@ +credentialCreate = { + "accountId": "12345", + "createDate": "2019-04-05T13:25:25-06:00", + "id": 11111, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAFhDOjHqYJva", + "username": "XfHhBNBPlPdlWyaPPJAI", + "type": { + "description": "A credential for generating S3 Compatible Signatures.", + "keyName": "S3_COMPATIBLE_SIGNATURE", + "name": "S3 Compatible Signature" + } +} + +getCredentials = [ + { + "accountId": "12345", + "createDate": "2019-04-05T13:25:25-06:00", + "id": 11111, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAFhDOjHqYJva", + "username": "XfHhBNBPlPdlWyaPPJAI", + "type": { + "description": "A credential for generating S3 Compatible Signatures.", + "keyName": "S3_COMPATIBLE_SIGNATURE", + "name": "S3 Compatible Signature" + } + }, + { + "accountId": "12345", + "createDate": "2019-04-05T13:25:25-06:00", + "id": 11111, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAFhDOjHqYJva", + "username": "XfHhBNBPlPdlWyaPPJAI", + "type": { + "description": "A credential for generating S3 Compatible Signatures.", + "keyName": "S3_COMPATIBLE_SIGNATURE", + "name": "S3 Compatible Signature" + } + } +] diff --git a/SoftLayer/managers/object_storage.py b/SoftLayer/managers/object_storage.py index b25a457e1..2560d26c8 100644 --- a/SoftLayer/managers/object_storage.py +++ b/SoftLayer/managers/object_storage.py @@ -52,3 +52,47 @@ def list_endpoints(self): }) return endpoints + + def create_credential(self, identifier): + """Create object storage credential. + + :param int identifier: The object storage account identifier. + + """ + + return self.client.call('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialCreate', + id=identifier) + + def delete_credential(self, identifier, credential_id=None): + """Delete the object storage credential. + + :param int id: The object storage account identifier. + :param int credential_id: The credential id to be deleted. + + """ + credential = { + 'id': credential_id + } + + return self.client.call('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialDelete', + credential, id=identifier) + + def limit_credential(self, identifier): + """Limit object storage credentials. + + :param int identifier: The object storage account identifier. + + """ + + return self.client.call('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentialLimit', + id=identifier) + + def list_credential(self, identifier): + """List the object storage credentials. + + :param int identifier: The object storage account identifier. + + """ + + return self.client.call('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentials', + id=identifier) diff --git a/tests/CLI/modules/object_storage_tests.py b/tests/CLI/modules/object_storage_tests.py index 7c8e7ec96..28856a964 100644 --- a/tests/CLI/modules/object_storage_tests.py +++ b/tests/CLI/modules/object_storage_tests.py @@ -37,3 +37,73 @@ def test_list_endpoints(self): [{'datacenter': 'dal05', 'private': 'https://dal05/auth/v1.0/', 'public': 'https://dal05/auth/v1.0/'}]) + + def test_create_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialCreate') + accounts.return_value = { + "accountId": "12345", + "createDate": "2019-04-05T13:25:25-06:00", + "id": 11111, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCy", + "username": "XfHhBNBPlPdl", + "type": { + "description": "A credential for generating S3 Compatible Signatures.", + "keyName": "S3_COMPATIBLE_SIGNATURE", + "name": "S3 Compatible Signature" + } + } + + result = self.run_command(['object-storage', 'credential', 'create', '100']) + + self.assert_no_fail(result) + self.assertEqual(json.loads(result.output), + [{'id': 11111, + 'password': 'nwUEUsx6PiEoN0B1Xe9z9hUCy', + 'type_name': 'S3 Compatible Signature', + 'username': 'XfHhBNBPlPdl'}] + ) + + def test_delete_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialDelete') + accounts.return_value = True + + result = self.run_command(['object-storage', 'credential', 'delete', '-id=100', '100']) + + self.assert_no_fail(result) + self.assertEqual(json.loads(result.output), + 'The credential was deleted successful' + ) + + def test_limit_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentialLimit') + accounts.return_value = 2 + + result = self.run_command(['object-storage', 'credential', 'limit', '100']) + + self.assert_no_fail(result) + self.assertEqual(json.loads(result.output), [{'limit': 2}]) + + def test_list_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentials') + accounts.return_value = [{'id': 1103123, + 'password': 'nwUEUsx6PiEoN0B1Xe9z9hUCyXM', + 'type': {'name': 'S3 Compatible Signature'}, + 'username': 'XfHhBNBPlPdlWya'}, + {'id': 1103333, + 'password': 'nwUEUsx6PiEoN0B1Xe9z9', + 'type': {'name': 'S3 Compatible Signature'}, + 'username': 'XfHhBNBPlPd'}] + + result = self.run_command(['object-storage', 'credential', 'list', '100']) + + self.assert_no_fail(result) + print(json.loads(result.output)) + self.assertEqual(json.loads(result.output), + [{'id': 1103123, + 'password': 'nwUEUsx6PiEoN0B1Xe9z9hUCyXM', + 'type_name': 'S3 Compatible Signature', + 'username': 'XfHhBNBPlPdlWya'}, + {'id': 1103333, + 'password': 'nwUEUsx6PiEoN0B1Xe9z9', + 'type_name': 'S3 Compatible Signature', + 'username': 'XfHhBNBPlPd'}]) diff --git a/tests/managers/object_storage_tests.py b/tests/managers/object_storage_tests.py index 478e5158b..c10524466 100644 --- a/tests/managers/object_storage_tests.py +++ b/tests/managers/object_storage_tests.py @@ -42,3 +42,80 @@ def test_list_endpoints_no_results(self): endpoints = self.object_storage.list_endpoints() self.assertEqual(endpoints, []) + + def test_create_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialCreate') + accounts.return_value = { + "id": 1103123, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAF", + "username": "XfHhBNBPlPdlWyaP", + "type": { + "name": "S3 Compatible Signature" + } + } + credential = self.object_storage.create_credential(100) + self.assertEqual(credential, + { + "id": 1103123, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAF", + "username": "XfHhBNBPlPdlWyaP", + "type": { + "name": "S3 Compatible Signature" + } + }) + + def test_delete_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialDelete') + accounts.return_value = 'The credential was deleted successful' + + credential = self.object_storage.delete_credential(100) + self.assertEqual(credential, 'The credential was deleted successful') + + def test_limit_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentialLimit') + accounts.return_value = 2 + + credential = self.object_storage.limit_credential(100) + self.assertEqual(credential, 2) + + def test_list_credential(self): + accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentials') + accounts.return_value = [ + { + "id": 1103123, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXsf4sf", + "username": "XfHhBNBPlPdlWyaP3fsd", + "type": { + "name": "S3 Compatible Signature" + } + }, + { + "id": 1102341, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAF", + "username": "XfHhBNBPlPdlWyaP", + "type": { + "name": "S3 Compatible Signature" + } + } + ] + credential = self.object_storage.list_credential(100) + self.assertEqual(credential, + [ + { + "id": 1103123, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXsf4sf", + "username": "XfHhBNBPlPdlWyaP3fsd", + "type": { + "name": "S3 Compatible Signature" + } + }, + { + "id": 1102341, + "password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAF", + "username": "XfHhBNBPlPdlWyaP", + "type": { + "name": "S3 Compatible Signature" + } + } + ] + ) From 05ffff52edd22bb1d59ab18be8d4109d9450c313 Mon Sep 17 00:00:00 2001 From: Fernando Ojeda Date: Tue, 9 Apr 2019 12:18:18 -0400 Subject: [PATCH 2/5] Refactor object storage credentials. --- SoftLayer/CLI/object_storage/credential/delete.py | 2 +- SoftLayer/CLI/object_storage/credential/limit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SoftLayer/CLI/object_storage/credential/delete.py b/SoftLayer/CLI/object_storage/credential/delete.py index c5a9ab682..10d7dc655 100644 --- a/SoftLayer/CLI/object_storage/credential/delete.py +++ b/SoftLayer/CLI/object_storage/credential/delete.py @@ -4,7 +4,7 @@ import click import SoftLayer -from SoftLayer.CLI import environment, exceptions +from SoftLayer.CLI import environment @click.command() diff --git a/SoftLayer/CLI/object_storage/credential/limit.py b/SoftLayer/CLI/object_storage/credential/limit.py index 96d293eae..a82d414e8 100644 --- a/SoftLayer/CLI/object_storage/credential/limit.py +++ b/SoftLayer/CLI/object_storage/credential/limit.py @@ -12,7 +12,7 @@ @click.argument('identifier') @environment.pass_env def cli(env, identifier): - """ Credential limits for this IBM Cloud Object Storage account.""" + """Credential limits for this IBM Cloud Object Storage account.""" mgr = SoftLayer.ObjectStorageManager(env.client) limit = mgr.limit_credential(identifier) From 9479d91dac81b9fa1554a4c79dd820672af88d7c Mon Sep 17 00:00:00 2001 From: Fernando Ojeda Date: Tue, 9 Apr 2019 14:44:59 -0400 Subject: [PATCH 3/5] Refactor object storage credentials. --- SoftLayer/CLI/object_storage/credential/limit.py | 4 ++-- SoftLayer/CLI/object_storage/credential/list.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SoftLayer/CLI/object_storage/credential/limit.py b/SoftLayer/CLI/object_storage/credential/limit.py index a82d414e8..cc3ad115c 100644 --- a/SoftLayer/CLI/object_storage/credential/limit.py +++ b/SoftLayer/CLI/object_storage/credential/limit.py @@ -15,10 +15,10 @@ def cli(env, identifier): """Credential limits for this IBM Cloud Object Storage account.""" mgr = SoftLayer.ObjectStorageManager(env.client) - limit = mgr.limit_credential(identifier) + credential_limit = mgr.limit_credential(identifier) table = formatting.Table(['limit']) table.add_row([ - limit, + credential_limit, ]) env.fout(table) diff --git a/SoftLayer/CLI/object_storage/credential/list.py b/SoftLayer/CLI/object_storage/credential/list.py index 2cf81ca3c..647e4224c 100644 --- a/SoftLayer/CLI/object_storage/credential/list.py +++ b/SoftLayer/CLI/object_storage/credential/list.py @@ -15,10 +15,10 @@ def cli(env, identifier): """Retrieve credentials used for generating an AWS signature. Max of 2.""" mgr = SoftLayer.ObjectStorageManager(env.client) - list = mgr.list_credential(identifier) + credential_list = mgr.list_credential(identifier) table = formatting.Table(['id', 'password', 'username', 'type_name']) - for credential in list: + for credential in credential_list: table.add_row([ credential['id'], credential['password'], From 1bd5deb16cab80f8a51c19135263b47a04eca0d4 Mon Sep 17 00:00:00 2001 From: Fernando Ojeda Date: Tue, 23 Apr 2019 13:22:26 -0400 Subject: [PATCH 4/5] Refactor object storage credentials. --- SoftLayer/CLI/object_storage/credential/delete.py | 5 ++--- tests/CLI/modules/object_storage_tests.py | 6 ++---- tests/managers/object_storage_tests.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/SoftLayer/CLI/object_storage/credential/delete.py b/SoftLayer/CLI/object_storage/credential/delete.py index 10d7dc655..7b066ba59 100644 --- a/SoftLayer/CLI/object_storage/credential/delete.py +++ b/SoftLayer/CLI/object_storage/credential/delete.py @@ -9,7 +9,7 @@ @click.command() @click.argument('identifier') -@click.option('--credential_id', '-id', type=click.INT, +@click.option('--credential_id', '-c', type=click.INT, help="This is the credential id associated with the volume") @environment.pass_env def cli(env, identifier, credential_id): @@ -18,5 +18,4 @@ def cli(env, identifier, credential_id): mgr = SoftLayer.ObjectStorageManager(env.client) credential = mgr.delete_credential(identifier, credential_id=credential_id) - if credential: - env.fout("The credential was deleted successful") + env.fout(credential) diff --git a/tests/CLI/modules/object_storage_tests.py b/tests/CLI/modules/object_storage_tests.py index 28856a964..8b9672da6 100644 --- a/tests/CLI/modules/object_storage_tests.py +++ b/tests/CLI/modules/object_storage_tests.py @@ -67,12 +67,10 @@ def test_delete_credential(self): accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialDelete') accounts.return_value = True - result = self.run_command(['object-storage', 'credential', 'delete', '-id=100', '100']) + result = self.run_command(['object-storage', 'credential', 'delete', '-c=100', '100']) self.assert_no_fail(result) - self.assertEqual(json.loads(result.output), - 'The credential was deleted successful' - ) + self.assertEqual(json.loads(result.output), True) def test_limit_credential(self): accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentialLimit') diff --git a/tests/managers/object_storage_tests.py b/tests/managers/object_storage_tests.py index c10524466..0bcca1274 100644 --- a/tests/managers/object_storage_tests.py +++ b/tests/managers/object_storage_tests.py @@ -69,7 +69,7 @@ def test_delete_credential(self): accounts.return_value = 'The credential was deleted successful' credential = self.object_storage.delete_credential(100) - self.assertEqual(credential, 'The credential was deleted successful') + self.assertEqual(credential, True) def test_limit_credential(self): accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentialLimit') From 665ad1d1d924649f1153aa8d7df6d268b1c1b1da Mon Sep 17 00:00:00 2001 From: Fernando Ojeda Date: Tue, 23 Apr 2019 14:37:37 -0400 Subject: [PATCH 5/5] Refactor object storage credentials. --- tests/CLI/modules/object_storage_tests.py | 5 ++--- tests/managers/object_storage_tests.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/CLI/modules/object_storage_tests.py b/tests/CLI/modules/object_storage_tests.py index 8b9672da6..74d70152e 100644 --- a/tests/CLI/modules/object_storage_tests.py +++ b/tests/CLI/modules/object_storage_tests.py @@ -67,10 +67,10 @@ def test_delete_credential(self): accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialDelete') accounts.return_value = True - result = self.run_command(['object-storage', 'credential', 'delete', '-c=100', '100']) + result = self.run_command(['object-storage', 'credential', 'delete', '-c', 100, '100']) self.assert_no_fail(result) - self.assertEqual(json.loads(result.output), True) + self.assertEqual(result.output, 'True\n') def test_limit_credential(self): accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'getCredentialLimit') @@ -95,7 +95,6 @@ def test_list_credential(self): result = self.run_command(['object-storage', 'credential', 'list', '100']) self.assert_no_fail(result) - print(json.loads(result.output)) self.assertEqual(json.loads(result.output), [{'id': 1103123, 'password': 'nwUEUsx6PiEoN0B1Xe9z9hUCyXM', diff --git a/tests/managers/object_storage_tests.py b/tests/managers/object_storage_tests.py index 0bcca1274..e5042080d 100644 --- a/tests/managers/object_storage_tests.py +++ b/tests/managers/object_storage_tests.py @@ -66,7 +66,7 @@ def test_create_credential(self): def test_delete_credential(self): accounts = self.set_mock('SoftLayer_Network_Storage_Hub_Cleversafe_Account', 'credentialDelete') - accounts.return_value = 'The credential was deleted successful' + accounts.return_value = True credential = self.object_storage.delete_credential(100) self.assertEqual(credential, True)