From: Kyr Shatskyy Date: Mon, 22 Jul 2024 07:33:02 +0000 (+0200) Subject: mgr/dashboard: use assertEqual in test_iscsi X-Git-Tag: v20.0.0~1455^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F58709%2Fhead;p=ceph.git mgr/dashboard: use assertEqual in test_iscsi Python asks in multiple places to use assertEqual instead of assertEquals: DeprecationWarning: Please use assertEqual instead. Signed-off-by: Kyr Shatskyy --- diff --git a/src/pybind/mgr/dashboard/tests/test_iscsi.py b/src/pybind/mgr/dashboard/tests/test_iscsi.py index f3f786c2928e..6b19c8967312 100644 --- a/src/pybind/mgr/dashboard/tests/test_iscsi.py +++ b/src/pybind/mgr/dashboard/tests/test_iscsi.py @@ -225,8 +225,8 @@ class IscsiTestController(ControllerTestCase, KVStoreMockMixin): # pylint: disable=protected-access with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(None, None, None, None, None, None) - self.assertEquals(ctx.exception.__str__(), - "Target IQN is required") + self.assertEqual(ctx.exception.__str__(), + "Target IQN is required") def test_validate_error_portals(self): # pylint: disable=protected-access @@ -238,13 +238,13 @@ class IscsiTestController(ControllerTestCase, KVStoreMockMixin): settings = {'config': {'minimum_gateways': 1}} with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings) - self.assertEquals(ctx.exception.__str__(), - "At least one portal is required") + self.assertEqual(ctx.exception.__str__(), + "At least one portal is required") settings = {'config': {'minimum_gateways': 2}} with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings) - self.assertEquals(ctx.exception.__str__(), - "At least 2 portals are required") + self.assertEqual(ctx.exception.__str__(), + "At least 2 portals are required") def test_validate_error_target_control(self): # pylint: disable=protected-access @@ -266,15 +266,15 @@ class IscsiTestController(ControllerTestCase, KVStoreMockMixin): } with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings) - self.assertEquals(ctx.exception.__str__(), - "Target control target_name must be >= 1") + self.assertEqual(ctx.exception.__str__(), + "Target control target_name must be >= 1") target_controls = { 'target_name': 3 } with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings) - self.assertEquals(ctx.exception.__str__(), - "Target control target_name must be <= 2") + self.assertEqual(ctx.exception.__str__(), + "Target control target_name must be <= 2") @mock.patch('dashboard.controllers.iscsi.IscsiTarget._validate_image') def test_validate_error_disk_control(self, _validate_image_mock): @@ -301,13 +301,13 @@ class IscsiTestController(ControllerTestCase, KVStoreMockMixin): } with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings) - self.assertEquals(ctx.exception.__str__(), - "Disk control max_data_area_mb must be >= 129") + self.assertEqual(ctx.exception.__str__(), + "Disk control max_data_area_mb must be >= 129") settings['disk_controls_limits']['user:rbd']['max_data_area_mb']['min'] = 1 with self.assertRaises(DashboardException) as ctx: IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings) - self.assertEquals(ctx.exception.__str__(), - "Disk control max_data_area_mb must be <= 127") + self.assertEqual(ctx.exception.__str__(), + "Disk control max_data_area_mb must be <= 127") @mock.patch('dashboard.controllers.iscsi.IscsiTarget._validate_image') def test_delete(self, _validate_image_mock):