From 88ef1d973b7393303442a316dc175e89f233a165 Mon Sep 17 00:00:00 2001 From: Yuji Hagiwara Date: Tue, 18 Aug 2015 14:00:49 +0900 Subject: [PATCH] Remove duplicate keys from dictionary There are several places where duplicate keys are added in the dictionary. Remove all such occurrences throughout the code. Change-Id: Ib1e6cccb82fdfcde9e3080afca7bebdb61d6f5ad Closes-Bug: #1485846 --- cinder/tests/unit/api/test_common.py | 2 +- cinder/tests/unit/api/v1/test_volumes.py | 2 -- cinder/tests/unit/api/v2/stubs.py | 1 - cinder/tests/unit/api/v2/test_volumes.py | 1 - cinder/tests/unit/scheduler/test_host_manager.py | 1 - cinder/tests/unit/test_emc_vmax.py | 10 ++++------ cinder/tests/unit/test_ibm_xiv_ds8k.py | 1 - cinder/tests/unit/volume/drivers/test_hgst.py | 2 +- 8 files changed, 6 insertions(+), 14 deletions(-) diff --git a/cinder/tests/unit/api/test_common.py b/cinder/tests/unit/api/test_common.py index 5b31b538b..8050a5e7d 100644 --- a/cinder/tests/unit/api/test_common.py +++ b/cinder/tests/unit/api/test_common.py @@ -290,7 +290,7 @@ class SortParamUtilsTest(test.TestCase): common.get_sort_params(params) self.assertEqual({}, params) - params = {'sort_dir': 'key1', 'sort_dir': 'dir1'} + params = {'sort_key': 'key1', 'sort_dir': 'dir1'} common.get_sort_params(params) self.assertEqual({}, params) diff --git a/cinder/tests/unit/api/v1/test_volumes.py b/cinder/tests/unit/api/v1/test_volumes.py index 2c76c1064..f4371c2f9 100644 --- a/cinder/tests/unit/api/v1/test_volumes.py +++ b/cinder/tests/unit/api/v1/test_volumes.py @@ -84,7 +84,6 @@ class VolumeApiTest(test.TestCase): 'display_description': 'Volume Test Desc', 'availability_zone': 'zone1:host1', 'display_name': 'Volume Test Name', - 'encrypted': False, 'attachments': [], 'multiattach': 'false', 'bootable': 'false', @@ -973,7 +972,6 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase): request = self.deserializer.deserialize(self_request) expected = { "volume": { - "display_name": "Volume-xml", "size": "1", "display_name": "Volume-xml", "display_description": "description", diff --git a/cinder/tests/unit/api/v2/stubs.py b/cinder/tests/unit/api/v2/stubs.py index 9e9192be8..010877b4e 100644 --- a/cinder/tests/unit/api/v2/stubs.py +++ b/cinder/tests/unit/api/v2/stubs.py @@ -46,7 +46,6 @@ def stub_volume(id, **kwargs): 'status': DEFAULT_VOL_STATUS, 'migration_status': None, 'attach_status': 'attached', - 'bootable': 'false', 'name': 'vol name', 'display_name': DEFAULT_VOL_NAME, 'display_description': DEFAULT_VOL_DESCRIPTION, diff --git a/cinder/tests/unit/api/v2/test_volumes.py b/cinder/tests/unit/api/v2/test_volumes.py index 5b8ad4c11..724a3c4d3 100644 --- a/cinder/tests/unit/api/v2/test_volumes.py +++ b/cinder/tests/unit/api/v2/test_volumes.py @@ -1575,7 +1575,6 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase): request = self.deserializer.deserialize(self_request) expected = { "volume": { - "name": "Volume-xml", "size": "1", "name": "Volume-xml", "description": "description", diff --git a/cinder/tests/unit/scheduler/test_host_manager.py b/cinder/tests/unit/scheduler/test_host_manager.py index 732db311d..90cbe6ebb 100644 --- a/cinder/tests/unit/scheduler/test_host_manager.py +++ b/cinder/tests/unit/scheduler/test_host_manager.py @@ -441,7 +441,6 @@ class HostStateTestCase(test.TestCase): 'reserved_percentage': 0, 'dying_disks': 200, 'super_hero_1': 'superman', - 'super_hero_2': ' ', 'super_hero_2': 'Hulk', } ], diff --git a/cinder/tests/unit/test_emc_vmax.py b/cinder/tests/unit/test_emc_vmax.py index 7d7109bf8..fe8c3bd0b 100644 --- a/cinder/tests/unit/test_emc_vmax.py +++ b/cinder/tests/unit/test_emc_vmax.py @@ -411,12 +411,11 @@ class EMCVMAXCommonData(object): 'volume_type_id': 'sourceid', 'display_name': 'sourceVolume', 'name': 'sourceVolume', - 'id': 'sourceVolume', 'device_id': '1', 'volume_name': 'vmax-154326', 'provider_auth': None, - 'project_id': - 'project', 'id': '2', + 'project_id': 'project', + 'id': '2', 'host': fake_host, 'provider_location': six.text_type(provider_location), @@ -426,12 +425,11 @@ class EMCVMAXCommonData(object): 'volume_type_id': 'sourceid', 'display_name': 'sourceVolume', 'name': 'sourceVolume', - 'id': 'sourceVolume', 'device_id': '1', 'volume_name': 'vmax-154326', 'provider_auth': None, - 'project_id': - 'project', 'id': '2', + 'project_id': 'project', + 'id': '2', 'host': fake_host_v3, 'provider_location': six.text_type(provider_location), diff --git a/cinder/tests/unit/test_ibm_xiv_ds8k.py b/cinder/tests/unit/test_ibm_xiv_ds8k.py index 0de544693..e7fe0a769 100644 --- a/cinder/tests/unit/test_ibm_xiv_ds8k.py +++ b/cinder/tests/unit/test_ibm_xiv_ds8k.py @@ -125,7 +125,6 @@ class XIVDS8KFakeProxyDriver(object): return {'driver_volume_type': 'iscsi', 'data': {'target_discovered': True, - 'target_discovered': True, 'target_portal': self.xiv_ds8k_portal, 'target_iqn': self.xiv_ds8k_iqn, 'target_lun': lun_id, diff --git a/cinder/tests/unit/volume/drivers/test_hgst.py b/cinder/tests/unit/volume/drivers/test_hgst.py index d968ef4bb..ec816f736 100644 --- a/cinder/tests/unit/volume/drivers/test_hgst.py +++ b/cinder/tests/unit/volume/drivers/test_hgst.py @@ -466,7 +466,7 @@ class HGSTTestCase(test.TestCase): def test_create_snapshot(self, mock_ghn): """Test creating a snapshot, ensure full data of original copied.""" # Now snapshot the volume and check commands - snapshot = {'volume_name': 'volume10', 'volume_size': 10, + snapshot = {'volume_name': 'volume10', 'volume_id': 'xxx', 'display_name': 'snap10', 'name': '123abc', 'volume_size': 10, 'id': '123abc', 'volume': {'provider_id': 'space10'}} -- 2.45.2