From eafcc2fc64df6d8c8c2e3b709e9d4e7d5e7be9b7 Mon Sep 17 00:00:00 2001 From: zhangtongjian Date: Thu, 12 Jan 2023 09:02:11 +0800 Subject: [PATCH] Fix the wrong use of variable assertions in unit tests When comparing variables, should use assertEqual Closed-Bug: #2002460 Change-Id: Iec2e9eec8fea6e5453704c22235fb860211af1a3 --- cyborg/tests/unit/api/controllers/v2/test_device_profiles.py | 4 ++-- cyborg/tests/unit/api/controllers/v2/test_devices.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cyborg/tests/unit/api/controllers/v2/test_device_profiles.py b/cyborg/tests/unit/api/controllers/v2/test_device_profiles.py index 377c3232..8ec8fb15 100644 --- a/cyborg/tests/unit/api/controllers/v2/test_device_profiles.py +++ b/cyborg/tests/unit/api/controllers/v2/test_device_profiles.py @@ -97,7 +97,7 @@ class TestDeviceProfileController(v2_test.APITestV2): result = isinstance(out_dps, list) self.assertTrue(result) - self.assertTrue(len(out_dps), len(self.fake_dp_objs)) + self.assertEqual(len(out_dps), len(self.fake_dp_objs)) for in_dp, out_dp in zip(self.fake_dp_objs, out_dps): self._validate_dp(in_dp, out_dp) @@ -112,7 +112,7 @@ class TestDeviceProfileController(v2_test.APITestV2): result = isinstance(out_dps, list) self.assertTrue(result) - self.assertTrue(len(out_dps), len(expected_dps)) + self.assertEqual(len(out_dps), len(expected_dps)) for in_dp, out_dp in zip(expected_dps, out_dps): self._validate_dp(in_dp, out_dp) diff --git a/cyborg/tests/unit/api/controllers/v2/test_devices.py b/cyborg/tests/unit/api/controllers/v2/test_devices.py index 9f339130..80aae85c 100644 --- a/cyborg/tests/unit/api/controllers/v2/test_devices.py +++ b/cyborg/tests/unit/api/controllers/v2/test_devices.py @@ -64,7 +64,7 @@ class TestDevicesController(v2_test.APITestV2): self.assertIsInstance(out_devices, list) for out_dev in out_devices: self.assertIsInstance(out_dev, dict) - self.assertTrue(len(out_devices), len(self.fake_devices)) + self.assertEqual(len(out_devices), len(self.fake_devices)) for in_device, out_device in zip(self.fake_devices, out_devices): self._validate_device(in_device, out_device)