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
This commit is contained in:
Cao Xuan Hoang 2016-09-26 11:07:27 +07:00
parent 9efe03f982
commit 8da54e582e
2 changed files with 4 additions and 4 deletions

View File

@ -510,7 +510,7 @@ class TestApiVersions(BaseAPITest):
u'href': u'http://localhost/v1/endpoint3'}] u'href': u'http://localhost/v1/endpoint3'}]
}, },
]} ]}
self.assertDictEqual(expected, json_data) self.assertEqual(expected, json_data)
def test_version_endpoint_invalid(self): def test_version_endpoint_invalid(self):
endpoint = "/v-1" endpoint = "/v-1"

View File

@ -30,7 +30,7 @@ class TestPciDevicesHook(test_base.NodeTest):
valid_pci_entry = {("foo1", "bar1"): "baz1", ("foo2", "bar2"): "baz2"} valid_pci_entry = {("foo1", "bar1"): "baz1", ("foo2", "bar2"): "baz2"}
base.CONF.set_override('alias', pci_alias, 'pci_devices') base.CONF.set_override('alias', pci_alias, 'pci_devices')
parsed_pci_entry = pci_devices._parse_pci_alias_entry() 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): def test_parse_pci_alias_entry_no_entries(self):
pci_alias = [] pci_alias = []
@ -45,7 +45,7 @@ class TestPciDevicesHook(test_base.NodeTest):
base.CONF.set_override('alias', pci_alias, 'pci_devices') base.CONF.set_override('alias', pci_alias, 'pci_devices')
valid_pci_alias = {("foo1", "bar1"): "baz1"} valid_pci_alias = {("foo1", "bar1"): "baz1"}
parsed_pci_alias = pci_devices._parse_pci_alias_entry() 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_oslo_log.error.assert_called_once()
@mock.patch('ironic_inspector.plugins.pci_devices.LOG') @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') base.CONF.set_override('alias', pci_alias, 'pci_devices')
valid_pci_alias = {("foo1", "bar1"): "baz1"} valid_pci_alias = {("foo1", "bar1"): "baz1"}
parsed_pci_alias = pci_devices._parse_pci_alias_entry() 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_oslo_log.error.assert_called_once()
@mock.patch.object(hook, 'aliases', {("1234", "5678"): "pci_dev1", @mock.patch.object(hook, 'aliases', {("1234", "5678"): "pci_dev1",