Skip to content

Commit 5e08ee3

Browse files
authored
Merge pull request ceph#58709 from kshtsk/wip-assert-equal-please
mgr/dashboard: use assertEqual in test_iscsi
2 parents a23254d + 8d7cea5 commit 5e08ee3

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/pybind/mgr/dashboard/tests/test_iscsi.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ def test_validate_error_iqn(self):
225225
# pylint: disable=protected-access
226226
with self.assertRaises(DashboardException) as ctx:
227227
IscsiTarget._validate(None, None, None, None, None, None)
228-
self.assertEquals(ctx.exception.__str__(),
229-
"Target IQN is required")
228+
self.assertEqual(ctx.exception.__str__(),
229+
"Target IQN is required")
230230

231231
def test_validate_error_portals(self):
232232
# pylint: disable=protected-access
@@ -238,13 +238,13 @@ def test_validate_error_portals(self):
238238
settings = {'config': {'minimum_gateways': 1}}
239239
with self.assertRaises(DashboardException) as ctx:
240240
IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings)
241-
self.assertEquals(ctx.exception.__str__(),
242-
"At least one portal is required")
241+
self.assertEqual(ctx.exception.__str__(),
242+
"At least one portal is required")
243243
settings = {'config': {'minimum_gateways': 2}}
244244
with self.assertRaises(DashboardException) as ctx:
245245
IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings)
246-
self.assertEquals(ctx.exception.__str__(),
247-
"At least 2 portals are required")
246+
self.assertEqual(ctx.exception.__str__(),
247+
"At least 2 portals are required")
248248

249249
def test_validate_error_target_control(self):
250250
# pylint: disable=protected-access
@@ -266,15 +266,15 @@ def test_validate_error_target_control(self):
266266
}
267267
with self.assertRaises(DashboardException) as ctx:
268268
IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings)
269-
self.assertEquals(ctx.exception.__str__(),
270-
"Target control target_name must be >= 1")
269+
self.assertEqual(ctx.exception.__str__(),
270+
"Target control target_name must be >= 1")
271271
target_controls = {
272272
'target_name': 3
273273
}
274274
with self.assertRaises(DashboardException) as ctx:
275275
IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings)
276-
self.assertEquals(ctx.exception.__str__(),
277-
"Target control target_name must be <= 2")
276+
self.assertEqual(ctx.exception.__str__(),
277+
"Target control target_name must be <= 2")
278278

279279
@mock.patch('dashboard.controllers.iscsi.IscsiTarget._validate_image')
280280
def test_validate_error_disk_control(self, _validate_image_mock):
@@ -301,13 +301,13 @@ def test_validate_error_disk_control(self, _validate_image_mock):
301301
}
302302
with self.assertRaises(DashboardException) as ctx:
303303
IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings)
304-
self.assertEquals(ctx.exception.__str__(),
305-
"Disk control max_data_area_mb must be >= 129")
304+
self.assertEqual(ctx.exception.__str__(),
305+
"Disk control max_data_area_mb must be >= 129")
306306
settings['disk_controls_limits']['user:rbd']['max_data_area_mb']['min'] = 1
307307
with self.assertRaises(DashboardException) as ctx:
308308
IscsiTarget._validate(target_iqn, target_controls, portals, disks, groups, settings)
309-
self.assertEquals(ctx.exception.__str__(),
310-
"Disk control max_data_area_mb must be <= 127")
309+
self.assertEqual(ctx.exception.__str__(),
310+
"Disk control max_data_area_mb must be <= 127")
311311

312312
@mock.patch('dashboard.controllers.iscsi.IscsiTarget._validate_image')
313313
def test_delete(self, _validate_image_mock):

0 commit comments

Comments
 (0)