]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove duplicate keys from dictionary
authorYuji Hagiwara <hagiwarayuj@nttdata.co.jp>
Tue, 18 Aug 2015 05:00:49 +0000 (14:00 +0900)
committerYuji Hagiwara <hagiwarayuj@nttdata.co.jp>
Wed, 19 Aug 2015 04:42:22 +0000 (13:42 +0900)
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
cinder/tests/unit/api/v1/test_volumes.py
cinder/tests/unit/api/v2/stubs.py
cinder/tests/unit/api/v2/test_volumes.py
cinder/tests/unit/scheduler/test_host_manager.py
cinder/tests/unit/test_emc_vmax.py
cinder/tests/unit/test_ibm_xiv_ds8k.py
cinder/tests/unit/volume/drivers/test_hgst.py

index 5b31b538b8a5f335825cd3415a1998d03507dc46..8050a5e7d330951752df424300710f973ff3652e 100644 (file)
@@ -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)
 
index 2c76c1064b97e2f6a40e58e3698bce9924742be5..f4371c2f9c17c15501e89902216a3b5bb53154d3 100644 (file)
@@ -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",
index 9e9192be839854bdae0c8a04d86aac4757524f4b..010877b4e19e499c89cd07694a662a5f249fe7be 100644 (file)
@@ -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,
index 5b8ad4c11bb479c6f5998d810591959df32708b8..724a3c4d37eaf2fd960b020ca2d590e22be3855c 100644 (file)
@@ -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",
index 732db311d17afc0cb6f890624487c6dc10a76385..90cbe6ebbac6e7c100ce3a70d4528ab0b46009b6 100644 (file)
@@ -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',
                  }
             ],
index 7d7109bf8be53f5dadecbf92cd19c26801fe8ff0..fe8c3bd0ba9eb548aa027372fd898e8d6b20fe74 100644 (file)
@@ -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),
index 0de54469348a7db20a5ebceaa4b0eeeb630b5a22..e7fe0a769bd09d6e5cde7125f0becf42ada0d21f 100644 (file)
@@ -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,
index d968ef4bbaefcdaf36b1a9203efc15a06c241767..ec816f7363afa1fd68091697258c47c018b8fb3b 100644 (file)
@@ -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'}}