From 8da54e582eb11f63b56b9e6b4c86ef302cd87808 Mon Sep 17 00:00:00 2001 From: Cao Xuan Hoang Date: Mon, 26 Sep 2016 11:07:27 +0700 Subject: [PATCH] Use assertEqual() instead of assertDictEqual() In unittesttools, assertDictEqual() and assertEqual() are implemented by using '!=' operator. But assertEqual() can handle dict, list, set and so on. So we just call assertEqual() to make the tests simpler. Change-Id: I2fdae6892abd3c66bb0702d518101f501e05c4e9 --- ironic_inspector/test/unit/test_main.py | 2 +- ironic_inspector/test/unit/test_plugins_pci_devices.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ironic_inspector/test/unit/test_main.py b/ironic_inspector/test/unit/test_main.py index 6fd4c3c53..111de374b 100644 --- a/ironic_inspector/test/unit/test_main.py +++ b/ironic_inspector/test/unit/test_main.py @@ -510,7 +510,7 @@ class TestApiVersions(BaseAPITest): u'href': u'http://localhost/v1/endpoint3'}] }, ]} - self.assertDictEqual(expected, json_data) + self.assertEqual(expected, json_data) def test_version_endpoint_invalid(self): endpoint = "/v-1" diff --git a/ironic_inspector/test/unit/test_plugins_pci_devices.py b/ironic_inspector/test/unit/test_plugins_pci_devices.py index f00f804dd..eb5736954 100644 --- a/ironic_inspector/test/unit/test_plugins_pci_devices.py +++ b/ironic_inspector/test/unit/test_plugins_pci_devices.py @@ -30,7 +30,7 @@ class TestPciDevicesHook(test_base.NodeTest): valid_pci_entry = {("foo1", "bar1"): "baz1", ("foo2", "bar2"): "baz2"} base.CONF.set_override('alias', pci_alias, 'pci_devices') parsed_pci_entry = pci_devices._parse_pci_alias_entry() - self.assertDictEqual(valid_pci_entry, parsed_pci_entry) + self.assertEqual(valid_pci_entry, parsed_pci_entry) def test_parse_pci_alias_entry_no_entries(self): pci_alias = [] @@ -45,7 +45,7 @@ class TestPciDevicesHook(test_base.NodeTest): base.CONF.set_override('alias', pci_alias, 'pci_devices') valid_pci_alias = {("foo1", "bar1"): "baz1"} parsed_pci_alias = pci_devices._parse_pci_alias_entry() - self.assertDictEqual(valid_pci_alias, parsed_pci_alias) + self.assertEqual(valid_pci_alias, parsed_pci_alias) mock_oslo_log.error.assert_called_once() @mock.patch('ironic_inspector.plugins.pci_devices.LOG') @@ -55,7 +55,7 @@ class TestPciDevicesHook(test_base.NodeTest): base.CONF.set_override('alias', pci_alias, 'pci_devices') valid_pci_alias = {("foo1", "bar1"): "baz1"} parsed_pci_alias = pci_devices._parse_pci_alias_entry() - self.assertDictEqual(valid_pci_alias, parsed_pci_alias) + self.assertEqual(valid_pci_alias, parsed_pci_alias) mock_oslo_log.error.assert_called_once() @mock.patch.object(hook, 'aliases', {("1234", "5678"): "pci_dev1",