]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Replace assertEquals with assertEqual - 2/2
authorZhongyue Luo <zhongyue.nah@intel.com>
Fri, 16 Aug 2013 01:55:54 +0000 (09:55 +0800)
committerZhongyue Luo <zhongyue.nah@intel.com>
Mon, 9 Sep 2013 07:50:56 +0000 (15:50 +0800)
The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals
therefore we should use assertEqual instead.

This patch replaces the remaining assertEquals to assertEqual

Change-Id: I4e726ce414382e0d5bf982fad20363d61e00967a

21 files changed:
cinder/tests/api/v1/test_volumes.py
cinder/tests/db/test_qos_specs.py
cinder/tests/db/test_transfers.py
cinder/tests/image/test_glance.py
cinder/tests/test_backup_ceph.py
cinder/tests/test_block_device.py
cinder/tests/test_create_volume_flow.py
cinder/tests/test_exception.py
cinder/tests/test_glusterfs.py
cinder/tests/test_huawei_t_dorado.py
cinder/tests/test_image_utils.py
cinder/tests/test_nfs.py
cinder/tests/test_rbd.py
cinder/tests/test_utils.py
cinder/tests/test_vmware_vmdk.py
cinder/tests/test_volume_transfer.py
cinder/tests/test_volume_types_extra_specs.py
cinder/tests/test_volume_utils.py
cinder/tests/test_xenapi_sm.py
cinder/tests/test_xiv_ds8k.py
cinder/tests/test_zadara.py

index c08f35906b083987da2fe2d65f91ff642e4be4f1..48fda37be98e66c650c723f3460a24608cb16a54 100644 (file)
@@ -115,8 +115,8 @@ class VolumeApiTest(test.TestCase):
         body = {"volume": vol}
         req = fakes.HTTPRequest.blank('/v1/volumes')
         res_dict = self.controller.create(req, body)
-        self.assertEquals(res_dict['volume']['volume_type'],
-                          db_vol_type['name'])
+        self.assertEqual(res_dict['volume']['volume_type'],
+                         db_vol_type['name'])
 
     def test_volume_creation_fails_with_bad_size(self):
         vol = {"size": '',
index 86f8ab66a11b35df03fe868fb480506f60dba222..88357fc19b2984d4d6648cdec582394686999309 100644 (file)
@@ -99,8 +99,8 @@ class QualityOfServiceSpecsTableTestCase(test.TestCase):
         spec_id3 = self._create_qos_specs('Name3', value3)
 
         specs = db.qos_specs_get_all(self.ctxt)
-        self.assertEquals(len(specs), 3,
-                          "Unexpected number of qos specs records")
+        self.assertEqual(len(specs), 3,
+                         "Unexpected number of qos specs records")
 
         expected1 = dict(name='Name1', id=spec_id1, consumer='front-end')
         expected2 = dict(name='Name2', id=spec_id2, consumer='back-end')
index 3e7b45a781fc23d22eb2ccc7653b85de8c6c07bd..d62a923381b913c0dd703821ffc731c4b0d93a06 100644 (file)
@@ -79,12 +79,10 @@ class TransfersTableTestCase(test.TestCase):
                           db.transfer_get_all,
                           self.ctxt)
         xfer = db.transfer_get_all(context.get_admin_context())
-        self.assertEquals(len(xfer), 2,
-                          "Unexpected number of transfer records")
+        self.assertEqual(len(xfer), 2, "Unexpected number of transfer records")
 
         xfer = db.transfer_get_all_by_project(self.ctxt, self.ctxt.project_id)
-        self.assertEquals(len(xfer), 2,
-                          "Unexpected number of transfer records")
+        self.assertEqual(len(xfer), 2, "Unexpected number of transfer records")
 
         nctxt = context.RequestContext(user_id='new_user_id',
                                        project_id='new_project_id')
@@ -93,8 +91,7 @@ class TransfersTableTestCase(test.TestCase):
                           nctxt, self.ctxt.project_id)
         xfer = db.transfer_get_all_by_project(nctxt.elevated(),
                                               self.ctxt.project_id)
-        self.assertEquals(len(xfer), 2,
-                          "Unexpected number of transfer records")
+        self.assertEqual(len(xfer), 2, "Unexpected number of transfer records")
 
     def test_transfer_destroy(self):
         volume_id = utils.create_volume(self.ctxt)['id']
@@ -103,16 +100,14 @@ class TransfersTableTestCase(test.TestCase):
         xfer_id2 = self._create_transfer(volume_id2)
 
         xfer = db.transfer_get_all(context.get_admin_context())
-        self.assertEquals(len(xfer), 2,
-                          "Unexpected number of transfer records")
+        self.assertEqual(len(xfer), 2, "Unexpected number of transfer records")
         self.assertFalse(xfer[0]['deleted'], "Deleted flag is set")
 
         db.transfer_destroy(self.ctxt, xfer_id1)
         xfer = db.transfer_get_all(context.get_admin_context())
-        self.assertEquals(len(xfer), 1,
-                          "Unexpected number of transfer records")
-        self.assertEquals(xfer[0]['id'], xfer_id2,
-                          "Unexpected value for Transfer id")
+        self.assertEqual(len(xfer), 1, "Unexpected number of transfer records")
+        self.assertEqual(xfer[0]['id'], xfer_id2,
+                         "Unexpected value for Transfer id")
 
         nctxt = context.RequestContext(user_id='new_user_id',
                                        project_id='new_project_id')
@@ -121,5 +116,4 @@ class TransfersTableTestCase(test.TestCase):
 
         db.transfer_destroy(nctxt.elevated(), xfer_id2)
         xfer = db.transfer_get_all(context.get_admin_context())
-        self.assertEquals(len(xfer), 0,
-                          "Unexpected number of transfer records")
+        self.assertEqual(len(xfer), 0, "Unexpected number of transfer records")
index e9d94986b59c01be420e4cd60be25ebe0583040b..d37435d5800d2065359973c6ebc84555dc4ca9d5 100644 (file)
@@ -200,8 +200,8 @@ class TestGlanceImageService(test.TestCase):
         image_id = self.service.create(self.context, fixture)['id']
 
         self.assertNotEquals(None, image_id)
-        self.assertEquals(num_images + 1,
-                          len(self.service.detail(self.context)))
+        self.assertEqual(num_images + 1,
+                         len(self.service.detail(self.context)))
 
     def test_create_and_show_non_existing_image(self):
         fixture = self._make_fixture(name='test image')
@@ -536,8 +536,7 @@ class TestGlanceImageService(test.TestCase):
         (service, same_id) = glance.get_remote_image_service(self.context,
                                                              image_url)
         self.assertEqual(same_id, image_id)
-        self.assertEquals(service._client.netloc,
-                          'something-less-likely')
+        self.assertEqual(service._client.netloc, 'something-less-likely')
         for ipv6_url in ('[::1]', '::1', '[::1]:444'):
             image_url = 'http://%s/%s' % (ipv6_url, image_id)
             (service, same_id) = glance.get_remote_image_service(self.context,
@@ -568,25 +567,25 @@ class TestGlanceClientVersion(test.TestCase):
         """Test glance version set by flag is honoured."""
         client_wrapper_v1 = glance.GlanceClientWrapper('fake', 'fake_host',
                                                        9292)
-        self.assertEquals(client_wrapper_v1.client.__module__,
-                          'glanceclient.v1.client')
+        self.assertEqual(client_wrapper_v1.client.__module__,
+                         'glanceclient.v1.client')
         self.flags(glance_api_version=2)
         client_wrapper_v2 = glance.GlanceClientWrapper('fake', 'fake_host',
                                                        9292)
-        self.assertEquals(client_wrapper_v2.client.__module__,
-                          'glanceclient.v2.client')
+        self.assertEqual(client_wrapper_v2.client.__module__,
+                         'glanceclient.v2.client')
         CONF.reset()
 
     def test_glance_version_by_arg(self):
         """Test glance version set by arg to GlanceClientWrapper"""
         client_wrapper_v1 = glance.GlanceClientWrapper('fake', 'fake_host',
                                                        9292, version=1)
-        self.assertEquals(client_wrapper_v1.client.__module__,
-                          'glanceclient.v1.client')
+        self.assertEqual(client_wrapper_v1.client.__module__,
+                         'glanceclient.v1.client')
         client_wrapper_v2 = glance.GlanceClientWrapper('fake', 'fake_host',
                                                        9292, version=2)
-        self.assertEquals(client_wrapper_v2.client.__module__,
-                          'glanceclient.v2.client')
+        self.assertEqual(client_wrapper_v2.client.__module__,
+                         'glanceclient.v2.client')
 
 
 def _create_failing_glance_client(info):
index 24636a8a9490827aedcbf2045fd7afa97dca1de9..5de12f63150f11bb8ceaa55df832d6f244523422 100644 (file)
@@ -308,8 +308,8 @@ class BackupCephTestCase(test.TestCase):
                           self.volume_id)
 
         name = self.service._get_backup_base_name(self.volume_id, '1234')
-        self.assertEquals(name, "volume-%s.backup.%s" %
-                          (self.volume_id, '1234'))
+        self.assertEqual(name,
+                         "volume-%s.backup.%s" % (self.volume_id, '1234'))
 
     def test_backup_volume_from_rbd(self):
         self._create_volume_db_entry(self.volume_id, 1)
index 10201f9912c9e5c97cf52eb59501d4b2fa9e69b8..2cc0d208c500281eeeb19153ba93f7b49b8dce74 100644 (file)
@@ -45,7 +45,7 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
         self.drv.local_path(TEST_VOLUME1).AndReturn('/dev/loop1')
         self.mox.ReplayAll()
         data = self.drv.initialize_connection(TEST_VOLUME1, TEST_CONNECTOR)
-        self.assertEquals(data, {
+        self.assertEqual(data, {
             'driver_volume_type': 'local',
             'data': {'device_path': '/dev/loop1'}
         })
@@ -97,7 +97,7 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
             .AndReturn('dev_path')
         self.mox.ReplayAll()
         result = self.drv.create_volume(TEST_VOLUME)
-        self.assertEquals(result, {
+        self.assertEqual(result, {
             'provider_location': 'None:3260,None None '
                                  'None dev_path'})
 
@@ -112,17 +112,17 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
             AndReturn('BlockDeviceDriver')
         self.mox.ReplayAll()
         self.drv._update_volume_stats()
-        self.assertEquals(self.drv._stats,
-                          {'total_capacity_gb': 2,
-                           'free_capacity_gb': 2,
-                           'reserved_percentage':
-                           self.configuration.reserved_percentage,
-                           'QoS_support': False,
-                           'vendor_name': "Open Source",
-                           'driver_version': self.drv.VERSION,
-                           'storage_protocol': 'unknown',
-                           'volume_backend_name': 'BlockDeviceDriver',
-                           })
+        self.assertEqual(self.drv._stats,
+                         {'total_capacity_gb': 2,
+                          'free_capacity_gb': 2,
+                          'reserved_percentage':
+                          self.configuration.reserved_percentage,
+                          'QoS_support': False,
+                          'vendor_name': "Open Source",
+                          'driver_version': self.drv.VERSION,
+                          'storage_protocol': 'unknown',
+                          'volume_backend_name': 'BlockDeviceDriver',
+                          })
 
     def test_create_cloned_volume(self):
         TEST_SRC = {'id': '1',
@@ -140,9 +140,9 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
         volutils.copy_volume('/dev/loop1', dev, 2048,
                              execute=self.drv._execute)
         self.mox.ReplayAll()
-        self.assertEquals(self.drv.create_cloned_volume(TEST_VOLUME, TEST_SRC),
-                          {'provider_location': 'None:3260,'
-                                                'None None None /dev/loop2'})
+        self.assertEqual(self.drv.create_cloned_volume(TEST_VOLUME, TEST_SRC),
+                         {'provider_location': 'None:3260,'
+                                               'None None None /dev/loop2'})
 
     def test_copy_image_to_volume(self):
         TEST_VOLUME = {'provider_location': '1 2 3 /dev/loop1'}
@@ -201,9 +201,8 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
         for dev in self.configuration.available_devices:
             self.drv._get_device_size(dev).AndReturn(1)
         self.mox.ReplayAll()
-        self.assertEquals(self.drv._devices_sizes(),
-                          {'/dev/loop1': 1,
-                           '/dev/loop2': 1})
+        self.assertEqual(self.drv._devices_sizes(),
+                         {'/dev/loop1': 1, '/dev/loop2': 1})
 
     def test_find_appropriate_size_device_no_free_disks(self):
         size = 1
@@ -236,5 +235,5 @@ class TestBlockDeviceDriver(cinder.test.TestCase):
         self.mox.StubOutWithMock(self.drv, '_get_used_devices')
         self.drv._get_used_devices().AndReturn(set())
         self.mox.ReplayAll()
-        self.assertEquals(self.drv.find_appropriate_size_device(size),
-                          '/dev/loop2')
+        self.assertEqual(self.drv.find_appropriate_size_device(size),
+                         '/dev/loop2')
index 42de019594e6261adbfee051bd927353187419f5..e3e7452bd39d5c3cfb7f9307fbb5b36270b0ca85 100644 (file)
@@ -31,7 +31,7 @@ class fake_sheduler_rpc_api(object):
                       image_id=None, request_spec=None,
                       filter_properties=None):
 
-        self.test_inst.assertEquals(self.expected_spec, request_spec)
+        self.test_inst.assertEqual(self.expected_spec, request_spec)
 
 
 class fake_volume_api(object):
@@ -45,13 +45,10 @@ class fake_volume_api(object):
                       snapshot_id=None, image_id=None,
                       source_volid=None):
 
-        self.test_inst.assertEquals(self.expected_spec, request_spec)
-        self.test_inst.assertEquals(request_spec['source_volid'],
-                                    source_volid)
-        self.test_inst.assertEquals(request_spec['snapshot_id'],
-                                    snapshot_id)
-        self.test_inst.assertEquals(request_spec['image_id'],
-                                    image_id)
+        self.test_inst.assertEqual(self.expected_spec, request_spec)
+        self.test_inst.assertEqual(request_spec['source_volid'], source_volid)
+        self.test_inst.assertEqual(request_spec['snapshot_id'], snapshot_id)
+        self.test_inst.assertEqual(request_spec['image_id'], image_id)
 
 
 class fake_db(object):
index 31dc61cb06ca6b94b6e0856c7c1f237099811a49..b5617d5d32df5f459739f0de88ebdbe77aefa919 100644 (file)
@@ -59,8 +59,7 @@ class CinderExceptionTestCase(test.TestCase):
         self.assertEqual(unicode(exc), 'default message')
 
     def test_error_msg(self):
-        self.assertEquals(unicode(exception.CinderException('test')),
-                          'test')
+        self.assertEqual(unicode(exception.CinderException('test')), 'test')
 
     def test_default_error_msg_with_kwargs(self):
         class FakeCinderException(exception.CinderException):
index f203d668b574ffcec185c3e91358a483588f41f3..0141c2501498c580ac9b93451b921cbfa1653a79 100644 (file)
@@ -225,9 +225,8 @@ class GlusterFsDriverTestCase(test.TestCase):
 
         mox.ReplayAll()
 
-        self.assertEquals((df_avail, df_total_size),
-                          drv._get_available_capacity(
-                              self.TEST_EXPORT1))
+        self.assertEqual((df_avail, df_total_size),
+                         drv._get_available_capacity(self.TEST_EXPORT1))
 
         mox.VerifyAll()
 
@@ -270,9 +269,8 @@ class GlusterFsDriverTestCase(test.TestCase):
 
         mox.ReplayAll()
 
-        self.assertEquals((df_total_size - du_used, df_total_size),
-                          drv._get_available_capacity(
-                              self.TEST_EXPORT1))
+        self.assertEqual((df_total_size - du_used, df_total_size),
+                         drv._get_available_capacity(self.TEST_EXPORT1))
 
         mox.VerifyAll()
 
@@ -907,8 +905,8 @@ class GlusterFsDriverTestCase(test.TestCase):
         mox.ReplayAll()
 
         expected_file = 'volume-%s.%s' % (self.VOLUME_UUID, self.SNAP_UUID)
-        self.assertEquals(drv._get_backing_file(qemu_img_info_output),
-                          expected_file)
+        self.assertEqual(drv._get_backing_file(qemu_img_info_output),
+                         expected_file)
 
         mox.VerifyAll()
 
@@ -971,8 +969,8 @@ class GlusterFsDriverTestCase(test.TestCase):
 
         info = drv._read_info_file(info_path)
 
-        self.assertEquals(info[self.VOLUME_UUID],
-                          'volume-%s' % self.VOLUME_UUID)
+        self.assertEqual(info[self.VOLUME_UUID],
+                         'volume-%s' % self.VOLUME_UUID)
 
         mox.VerifyAll()
 
index 43442e6821b2e0b086acbc67db25a46876a6432d..86e6024ad676284e6a15b77f7ed04821ba9f87c0 100644 (file)
@@ -1387,10 +1387,10 @@ class HuaweiTISCSIDriverTestCase(test.TestCase):
         self.assertEqual(LUN_INFO['Owner Controller'], 'A')
         ret = self.driver.initialize_connection(FAKE_VOLUME, FAKE_CONNECTOR)
         iscsi_propers = ret['data']
-        self.assertEquals(iscsi_propers['target_iqn'],
-                          INITIATOR_SETTING['TargetIQN-form'])
-        self.assertEquals(iscsi_propers['target_portal'],
-                          INITIATOR_SETTING['Initiator TargetIP'] + ':3260')
+        self.assertEqual(iscsi_propers['target_iqn'],
+                         INITIATOR_SETTING['TargetIQN-form'])
+        self.assertEqual(iscsi_propers['target_portal'],
+                         INITIATOR_SETTING['Initiator TargetIP'] + ':3260')
         self.assertEqual(MAP_INFO["DEV LUN ID"], LUN_INFO['ID'])
         self.assertEqual(MAP_INFO["INI Port Info"],
                          FAKE_CONNECTOR['initiator'])
@@ -1526,8 +1526,8 @@ class HuaweiTFCDriverTestCase(test.TestCase):
         self.driver.create_volume(FAKE_VOLUME)
         ret = self.driver.initialize_connection(FAKE_VOLUME, FAKE_CONNECTOR)
         fc_properties = ret['data']
-        self.assertEquals(fc_properties['target_wwn'],
-                          INITIATOR_SETTING['WWN'])
+        self.assertEqual(fc_properties['target_wwn'],
+                         INITIATOR_SETTING['WWN'])
         self.assertEqual(MAP_INFO["DEV LUN ID"], LUN_INFO['ID'])
 
         self.driver.terminate_connection(FAKE_VOLUME, FAKE_CONNECTOR)
@@ -1659,10 +1659,10 @@ class HuaweiDorado2100G2ISCSIDriverTestCase(HuaweiTISCSIDriverTestCase):
         self.driver.create_volume(FAKE_VOLUME)
         ret = self.driver.initialize_connection(FAKE_VOLUME, FAKE_CONNECTOR)
         iscsi_propers = ret['data']
-        self.assertEquals(iscsi_propers['target_iqn'],
-                          INITIATOR_SETTING['TargetIQN-form'])
-        self.assertEquals(iscsi_propers['target_portal'],
-                          INITIATOR_SETTING['Initiator TargetIP'] + ':3260')
+        self.assertEqual(iscsi_propers['target_iqn'],
+                         INITIATOR_SETTING['TargetIQN-form'])
+        self.assertEqual(iscsi_propers['target_portal'],
+                         INITIATOR_SETTING['Initiator TargetIP'] + ':3260')
         self.assertEqual(MAP_INFO["DEV LUN ID"], LUN_INFO['ID'])
         self.assertEqual(MAP_INFO["INI Port Info"],
                          FAKE_CONNECTOR['initiator'])
index d73b35494e151a652bb1272da12158e239ed06d3..a6f7a11e3e985785ae5b8fb1ad23e1a5c4f20ab4 100644 (file)
@@ -132,8 +132,7 @@ class TestUtils(test.TestCase):
         self.assertEqual(inf.snapshots[0]['tag'], 'snap1')
         self.assertEqual(inf.snapshots[0]['vm_size'], '1.7G')
         self.assertEqual(inf.snapshots[0]['date'], '2011-10-04')
-        self.assertEquals(inf.snapshots[0]['vm_clock'],
-                          '19:04:00 32:06:34.974')
+        self.assertEqual(inf.snapshots[0]['vm_clock'], '19:04:00 32:06:34.974')
 
         self.assertEqual(str(inf), TEST_STR)
 
@@ -594,7 +593,7 @@ class TestDiscoverChain(test.TestCase):
         result = image_utils.discover_vhd_chain('some/path')
         mox.VerifyAll()
 
-        self.assertEquals(
+        self.assertEqual(
             ['some/path/0.vhd', 'some/path/1.vhd'], result)
 
 
index f9c2c1836743495ea982f33fc0da5ea985bf0d6a..48bf0c78fee3e6f01e41176d41238ce6d7a4e6ca 100644 (file)
@@ -228,8 +228,8 @@ class NfsDriverTestCase(test.TestCase):
 
         mox.ReplayAll()
 
-        self.assertEquals((stat_total_size, stat_avail, du_used),
-                          drv._get_capacity_info(self.TEST_NFS_EXPORT1))
+        self.assertEqual((stat_total_size, stat_avail, du_used),
+                         drv._get_capacity_info(self.TEST_NFS_EXPORT1))
 
         mox.VerifyAll()
 
@@ -261,8 +261,8 @@ class NfsDriverTestCase(test.TestCase):
 
         mox.ReplayAll()
 
-        self.assertEquals((stat_total_size, stat_avail, du_used),
-                          drv._get_capacity_info(self.TEST_NFS_EXPORT_SPACES))
+        self.assertEqual((stat_total_size, stat_avail, du_used),
+                         drv._get_capacity_info(self.TEST_NFS_EXPORT_SPACES))
 
         mox.VerifyAll()
 
index a58bb8e43e9efa5873c1bb8d077c53fb6646e7a2..843dbc85597409c39bb829c3254af0183608a2be 100644 (file)
@@ -562,8 +562,8 @@ class ManagedRBDTestCase(DriverTestCase):
         self.assertEqual(expected, actual)
 
         self.stubs.Set(self.volume.driver, '_is_cloneable', lambda x: True)
-        self.assertEquals(expected,
-                          self.volume.driver.clone_image(object(), None, None))
+        self.assertEqual(expected,
+                         self.volume.driver.clone_image(object(), None, None))
 
         # Test Success Case(s)
         expected = ({'provider_location': None}, True)
index 387381bdbedc3aeb321e3b1f124ec46feff4ce4f..25684c2256025fc3e6e81ec631569f8a46bfe55f 100644 (file)
@@ -81,8 +81,7 @@ exit 1
                                                           'always get passed '
                                                           'correctly')
             runs = int(runs.strip())
-            self.assertEquals(runs, 10,
-                              'Ran %d times instead of 10.' % (runs,))
+            self.assertEqual(runs, 10, 'Ran %d times instead of 10.' % (runs,))
         finally:
             os.unlink(tmpfilename)
             os.unlink(tmpfilename2)
@@ -193,8 +192,8 @@ class GetFromPathTestCase(test.TestCase):
 
         input = [{'a': {'b': {'c': 'c_1'}}},
                  {'a': {'b': {'c': 'c_2'}}}]
-        self.assertEquals([{'b': {'c': 'c_1'}}, {'b': {'c': 'c_2'}}],
-                          f(input, "a"))
+        self.assertEqual([{'b': {'c': 'c_1'}}, {'b': {'c': 'c_2'}}],
+                         f(input, "a"))
         self.assertEqual([{'c': 'c_1'}, {'c': 'c_2'}], f(input, "a/b"))
         self.assertEqual(['c_1', 'c_2'], f(input, "a/b/c"))
 
@@ -548,126 +547,126 @@ class AuditPeriodTest(test.TestCase):
 
     def test_hour(self):
         begin, end = utils.last_completed_audit_period(unit='hour')
-        self.assertEquals(begin,
-                          datetime.datetime(hour=7,
-                                            day=5,
-                                            month=3,
-                                            year=2012))
-        self.assertEquals(end, datetime.datetime(hour=8,
-                                                 day=5,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin,
+                         datetime.datetime(hour=7,
+                                           day=5,
+                                           month=3,
+                                           year=2012))
+        self.assertEqual(end, datetime.datetime(hour=8,
+                                                day=5,
+                                                month=3,
+                                                year=2012))
 
     def test_hour_with_offset_before_current(self):
         begin, end = utils.last_completed_audit_period(unit='hour@10')
-        self.assertEquals(begin, datetime.datetime(minute=10,
-                                                   hour=7,
-                                                   day=5,
-                                                   month=3,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(minute=10,
-                                                 hour=8,
-                                                 day=5,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(minute=10,
+                                                  hour=7,
+                                                  day=5,
+                                                  month=3,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(minute=10,
+                                                hour=8,
+                                                day=5,
+                                                month=3,
+                                                year=2012))
 
     def test_hour_with_offset_after_current(self):
         begin, end = utils.last_completed_audit_period(unit='hour@30')
-        self.assertEquals(begin, datetime.datetime(minute=30,
-                                                   hour=6,
-                                                   day=5,
-                                                   month=3,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(minute=30,
-                                                 hour=7,
-                                                 day=5,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(minute=30,
+                                                  hour=6,
+                                                  day=5,
+                                                  month=3,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(minute=30,
+                                                hour=7,
+                                                day=5,
+                                                month=3,
+                                                year=2012))
 
     def test_day(self):
         begin, end = utils.last_completed_audit_period(unit='day')
-        self.assertEquals(begin, datetime.datetime(day=4,
-                                                   month=3,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(day=5,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(day=4,
+                                                  month=3,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(day=5,
+                                                month=3,
+                                                year=2012))
 
     def test_day_with_offset_before_current(self):
         begin, end = utils.last_completed_audit_period(unit='day@6')
-        self.assertEquals(begin, datetime.datetime(hour=6,
-                                                   day=4,
-                                                   month=3,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(hour=6,
-                                                 day=5,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(hour=6,
+                                                  day=4,
+                                                  month=3,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(hour=6,
+                                                day=5,
+                                                month=3,
+                                                year=2012))
 
     def test_day_with_offset_after_current(self):
         begin, end = utils.last_completed_audit_period(unit='day@10')
-        self.assertEquals(begin, datetime.datetime(hour=10,
-                                                   day=3,
-                                                   month=3,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(hour=10,
-                                                 day=4,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(hour=10,
+                                                  day=3,
+                                                  month=3,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(hour=10,
+                                                day=4,
+                                                month=3,
+                                                year=2012))
 
     def test_month(self):
         begin, end = utils.last_completed_audit_period(unit='month')
-        self.assertEquals(begin, datetime.datetime(day=1,
-                                                   month=2,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(day=1,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(day=1,
+                                                  month=2,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(day=1,
+                                                month=3,
+                                                year=2012))
 
     def test_month_with_offset_before_current(self):
         begin, end = utils.last_completed_audit_period(unit='month@2')
-        self.assertEquals(begin, datetime.datetime(day=2,
-                                                   month=2,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(day=2,
-                                                 month=3,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(day=2,
+                                                  month=2,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(day=2,
+                                                month=3,
+                                                year=2012))
 
     def test_month_with_offset_after_current(self):
         begin, end = utils.last_completed_audit_period(unit='month@15')
-        self.assertEquals(begin, datetime.datetime(day=15,
-                                                   month=1,
-                                                   year=2012))
-        self.assertEquals(end, datetime.datetime(day=15,
-                                                 month=2,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(day=15,
+                                                  month=1,
+                                                  year=2012))
+        self.assertEqual(end, datetime.datetime(day=15,
+                                                month=2,
+                                                year=2012))
 
     def test_year(self):
         begin, end = utils.last_completed_audit_period(unit='year')
-        self.assertEquals(begin, datetime.datetime(day=1,
-                                                   month=1,
-                                                   year=2011))
-        self.assertEquals(end, datetime.datetime(day=1,
-                                                 month=1,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(day=1,
+                                                  month=1,
+                                                  year=2011))
+        self.assertEqual(end, datetime.datetime(day=1,
+                                                month=1,
+                                                year=2012))
 
     def test_year_with_offset_before_current(self):
         begin, end = utils.last_completed_audit_period(unit='year@2')
-        self.assertEquals(begin, datetime.datetime(day=1,
-                                                   month=2,
-                                                   year=2011))
-        self.assertEquals(end, datetime.datetime(day=1,
-                                                 month=2,
-                                                 year=2012))
+        self.assertEqual(begin, datetime.datetime(day=1,
+                                                  month=2,
+                                                  year=2011))
+        self.assertEqual(end, datetime.datetime(day=1,
+                                                month=2,
+                                                year=2012))
 
     def test_year_with_offset_after_current(self):
         begin, end = utils.last_completed_audit_period(unit='year@6')
-        self.assertEquals(begin, datetime.datetime(day=1,
-                                                   month=6,
-                                                   year=2010))
-        self.assertEquals(end, datetime.datetime(day=1,
-                                                 month=6,
-                                                 year=2011))
+        self.assertEqual(begin, datetime.datetime(day=1,
+                                                  month=6,
+                                                  year=2010))
+        self.assertEqual(end, datetime.datetime(day=1,
+                                                month=6,
+                                                year=2011))
 
 
 class FakeSSHClient(object):
index 0f1268605d62b1b7541928ce55c51d0ae3bec9cf..c684f767ba2428f505dacf3a30ce343d572afe70 100644 (file)
@@ -567,8 +567,8 @@ class VMwareEsxVmdkDriverTestCase(test.TestCase):
         """Test _get_disk_type."""
         volume = FakeObject()
         volume['volume_type_id'] = None
-        self.assertEquals(vmdk.VMwareEsxVmdkDriver._get_disk_type(volume),
-                          'thin')
+        self.assertEqual(vmdk.VMwareEsxVmdkDriver._get_disk_type(volume),
+                         'thin')
 
     def test_init_conn_with_instance_no_backing(self):
         """Test initialize_connection with instance and without backing."""
@@ -1089,8 +1089,8 @@ class VMwareEsxVmdkDriverTestCase(test.TestCase):
 
         m.ReplayAll()
         actual_vmdk_path = self._volumeops.get_vmdk_path(backing)
-        self.assertEquals(backingInfo.__class__.__name__,
-                          'VirtualDiskFlatVer2BackingInfo')
+        self.assertEqual(backingInfo.__class__.__name__,
+                         'VirtualDiskFlatVer2BackingInfo')
         self.assertEqual(virtualDisk.__class__.__name__, 'VirtualDisk')
         self.assertEqual(actual_vmdk_path, vmdk_path)
         m.UnsetStubs()
index 1baa74c9f4a7521a356cf530a12a9073256d5982..2c82d731b6dc41322d927d0675e8ef796fc68143 100644 (file)
@@ -43,13 +43,12 @@ class VolumeTransferTestCase(test.TestCase):
                                      updated_at=self.updated_at)
         response = tx_api.create(self.ctxt, '1', 'Description')
         volume = db.volume_get(self.ctxt, '1')
-        self.assertEquals('awaiting-transfer', volume['status'],
-                          'Unexpected state')
+        self.assertEqual('awaiting-transfer', volume['status'],
+                         'Unexpected state')
 
         tx_api.delete(self.ctxt, response['id'])
         volume = db.volume_get(self.ctxt, '1')
-        self.assertEquals('available', volume['status'],
-                          'Unexpected state')
+        self.assertEqual('available', volume['status'], 'Unexpected state')
 
     def test_transfer_invalid_volume(self):
         tx_api = transfer_api.API()
@@ -59,8 +58,7 @@ class VolumeTransferTestCase(test.TestCase):
                           tx_api.create,
                           self.ctxt, '1', 'Description')
         volume = db.volume_get(self.ctxt, '1')
-        self.assertEquals('in-use', volume['status'],
-                          'Unexpected state')
+        self.assertEqual('in-use', volume['status'], 'Unexpected state')
 
     def test_transfer_accept(self):
         tx_api = transfer_api.API()
@@ -68,8 +66,8 @@ class VolumeTransferTestCase(test.TestCase):
                                      updated_at=self.updated_at)
         transfer = tx_api.create(self.ctxt, '1', 'Description')
         volume = db.volume_get(self.ctxt, '1')
-        self.assertEquals('awaiting-transfer', volume['status'],
-                          'Unexpected state')
+        self.assertEqual('awaiting-transfer', volume['status'],
+                         'Unexpected state')
 
         self.assertRaises(exception.TransferNotFound,
                           tx_api.accept,
@@ -91,15 +89,15 @@ class VolumeTransferTestCase(test.TestCase):
                                  transfer['id'],
                                  transfer['auth_key'])
         volume = db.volume_get(self.ctxt, '1')
-        self.assertEquals(volume['project_id'], 'new_project_id',
-                          'Unexpected project id')
-        self.assertEquals(volume['user_id'], 'new_user_id',
-                          'Unexpected user id')
-
-        self.assertEquals(volume['id'], response['volume_id'],
-                          'Unexpected volume id in response.')
-        self.assertEquals(transfer['id'], response['id'],
-                          'Unexpected transfer id in response.')
+        self.assertEqual(volume['project_id'], 'new_project_id',
+                         'Unexpected project id')
+        self.assertEqual(volume['user_id'], 'new_user_id',
+                         'Unexpected user id')
+
+        self.assertEqual(volume['id'], response['volume_id'],
+                         'Unexpected volume id in response.')
+        self.assertEqual(transfer['id'], response['id'],
+                         'Unexpected transfer id in response.')
 
     def test_transfer_get(self):
         tx_api = transfer_api.API()
index 2ccdcc4c22db898cfdee5296c63aa6d8e2297f7e..0d690e81dd8dfb12e78a5bc41351a958cdb0998c 100644 (file)
@@ -98,8 +98,7 @@ class VolumeTypeExtraSpecsTestCase(test.TestCase):
         volume_type = db.volume_type_get(
             context.get_admin_context(),
             self.volume_type1_id)
-        self.assertEquals(volume_type['extra_specs'],
-                          self.vol_type1_specs)
+        self.assertEqual(volume_type['extra_specs'], self.vol_type1_specs)
 
         volume_type = db.volume_type_get(
             context.get_admin_context(),
@@ -110,8 +109,7 @@ class VolumeTypeExtraSpecsTestCase(test.TestCase):
         volume_type = db.volume_type_get_by_name(
             context.get_admin_context(),
             self.vol_type1['name'])
-        self.assertEquals(volume_type['extra_specs'],
-                          self.vol_type1_specs)
+        self.assertEqual(volume_type['extra_specs'], self.vol_type1_specs)
 
         volume_type = db.volume_type_get_by_name(
             context.get_admin_context(),
@@ -123,8 +121,8 @@ class VolumeTypeExtraSpecsTestCase(test.TestCase):
 
         types = db.volume_type_get_all(context.get_admin_context())
 
-        self.assertEquals(
+        self.assertEqual(
             types[self.vol_type1['name']]['extra_specs'], expected_specs)
 
-        self.assertEquals(
+        self.assertEqual(
             types[self.vol_type2_noextra['name']]['extra_specs'], {})
index d951ac8929fb54d519473bf15a755c96414419e0..434936fb67084b6628c9a23af5ab1376c83f6199 100644 (file)
@@ -98,25 +98,25 @@ class UsageInfoTestCase(test.TestCase):
 
     def test_get_host_from_queue_simple(self):
         fullname = "%s.%s@%s" % (self.QUEUE_NAME, self.HOSTNAME, self.BACKEND)
-        self.assertEquals(volume_utils.get_host_from_queue(fullname),
-                          self.HOSTNAME)
+        self.assertEqual(volume_utils.get_host_from_queue(fullname),
+                         self.HOSTNAME)
 
     def test_get_host_from_queue_ip(self):
         fullname = "%s.%s@%s" % (self.QUEUE_NAME, self.HOSTIP, self.BACKEND)
-        self.assertEquals(volume_utils.get_host_from_queue(fullname),
-                          self.HOSTIP)
+        self.assertEqual(volume_utils.get_host_from_queue(fullname),
+                         self.HOSTIP)
 
     def test_get_host_from_queue_multi_at_symbol(self):
         fullname = "%s.%s@%s" % (self.QUEUE_NAME, self.HOSTNAME,
                                  self.MULTI_AT_BACKEND)
-        self.assertEquals(volume_utils.get_host_from_queue(fullname),
-                          self.HOSTNAME)
+        self.assertEqual(volume_utils.get_host_from_queue(fullname),
+                         self.HOSTNAME)
 
     def test_get_host_from_queue_ip_multi_at_symbol(self):
         fullname = "%s.%s@%s" % (self.QUEUE_NAME, self.HOSTIP,
                                  self.MULTI_AT_BACKEND)
-        self.assertEquals(volume_utils.get_host_from_queue(fullname),
-                          self.HOSTIP)
+        self.assertEqual(volume_utils.get_host_from_queue(fullname),
+                         self.HOSTIP)
 
 
 class LVMVolumeDriverTestCase(test.TestCase):
index 4c1e796acbf7a54008b56767e733075fa480e9c9..d619d257066164ffe8061309ef6d6a3ea1a043ad 100644 (file)
@@ -151,7 +151,7 @@ class DriverTestCase(test.TestCase):
         )
         mock.VerifyAll()
 
-        self.assertEquals(
+        self.assertEqual(
             dict(
                 driver_volume_type='xensm',
                 data=dict(
@@ -183,7 +183,7 @@ class DriverTestCase(test.TestCase):
         )
         mock.VerifyAll()
 
-        self.assertEquals(
+        self.assertEqual(
             dict(
                 driver_volume_type='xensm',
                 data=dict(
@@ -233,7 +233,7 @@ class DriverTestCase(test.TestCase):
         mock.ReplayAll()
         result = drv.create_snapshot(snapshot)
         mock.VerifyAll()
-        self.assertEquals(
+        self.assertEqual(
             dict(provider_location="copied-sr/copied-vdi"),
             result)
 
@@ -254,7 +254,7 @@ class DriverTestCase(test.TestCase):
         result = drv.create_volume_from_snapshot(volume, snapshot)
         mock.VerifyAll()
 
-        self.assertEquals(
+        self.assertEqual(
             dict(provider_location='copied-sr/copied-vdi'), result)
 
     def test_delete_snapshot(self):
@@ -502,7 +502,7 @@ class ToolsTest(test.TestCase):
         mock_open = mock.Mock(return_value=mock_context_manager)
 
         with mock.patch('__builtin__.open', mock_open):
-            self.assertEquals(
+            self.assertEqual(
                 'blah', tools._stripped_first_line_of('/somefile'))
 
         mock_open.assert_called_once_with('/somefile', 'rb')
index cbb1776ff1007a290b85fa50c664a33cbd3b108c..ce9671720fb1941c733bc99556da61152d51da29 100644 (file)
@@ -137,16 +137,16 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
     def test_initialized_should_set_xiv_ds8k_info(self):
         """Test that the san flags are passed to the IBM proxy."""
 
-        self.assertEquals(
+        self.assertEqual(
             self.driver.xiv_ds8k_proxy.xiv_ds8k_info['xiv_ds8k_user'],
             self.driver.configuration.san_login)
-        self.assertEquals(
+        self.assertEqual(
             self.driver.xiv_ds8k_proxy.xiv_ds8k_info['xiv_ds8k_pass'],
             self.driver.configuration.san_password)
-        self.assertEquals(
+        self.assertEqual(
             self.driver.xiv_ds8k_proxy.xiv_ds8k_info['xiv_ds8k_address'],
             self.driver.configuration.san_ip)
-        self.assertEquals(
+        self.assertEqual(
             self.driver.xiv_ds8k_proxy.xiv_ds8k_info['xiv_ds8k_vol_pool'],
             self.driver.configuration.san_clustername)
 
index 5e1c4f687ef50ac83cdb464f8568288876eb2ebc..b1113d6fdf1e90ccecfd69c5cdc7bdd14724e78c 100644 (file)
@@ -784,14 +784,14 @@ class ZadaraVPSADriverTestCase(test.TestCase):
         self.assertEqual(data['total_capacity_gb'], 'infinite')
         self.assertEqual(data['free_capacity_gb'], 'infinite')
 
-        self.assertEquals(data,
-                          {'total_capacity_gb': 'infinite',
-                           'free_capacity_gb': 'infinite',
-                           'reserved_percentage':
-                           self.configuration.reserved_percentage,
-                           'QoS_support': False,
-                           'vendor_name': 'Zadara Storage',
-                           'driver_version': self.driver.VERSION,
-                           'storage_protocol': 'iSCSI',
-                           'volume_backend_name': 'ZadaraVPSAISCSIDriver',
-                           })
+        self.assertEqual(data,
+                         {'total_capacity_gb': 'infinite',
+                          'free_capacity_gb': 'infinite',
+                          'reserved_percentage':
+                          self.configuration.reserved_percentage,
+                          'QoS_support': False,
+                          'vendor_name': 'Zadara Storage',
+                          'driver_version': self.driver.VERSION,
+                          'storage_protocol': 'iSCSI',
+                          'volume_backend_name': 'ZadaraVPSAISCSIDriver',
+                          })