Merge "Use assertItemsEqual to compare dicts"
This commit is contained in:
commit
91308a7594
@ -78,17 +78,9 @@ class TestIpamBackendMixin(base.BaseTestCase):
|
|||||||
new_ips,
|
new_ips,
|
||||||
owner)
|
owner)
|
||||||
|
|
||||||
def assertUnorderedListOfDictEqual(a, b):
|
self.assertItemsEqual(expected.add, change.add)
|
||||||
# Dicts are unorderable in py34. Return something orderable.
|
self.assertItemsEqual(expected.original, change.original)
|
||||||
def key(d):
|
self.assertItemsEqual(expected.remove, change.remove)
|
||||||
return sorted(d.items())
|
|
||||||
|
|
||||||
# Compare the sorted lists since the order isn't deterministic
|
|
||||||
self.assertEqual(sorted(a, key=key), sorted(b, key=key))
|
|
||||||
|
|
||||||
assertUnorderedListOfDictEqual(expected.add, change.add)
|
|
||||||
assertUnorderedListOfDictEqual(expected.original, change.original)
|
|
||||||
assertUnorderedListOfDictEqual(expected.remove, change.remove)
|
|
||||||
|
|
||||||
def test__get_changed_ips_for_port(self):
|
def test__get_changed_ips_for_port(self):
|
||||||
new_ips = self._prepare_ips(self.default_new_ips)
|
new_ips = self._prepare_ips(self.default_new_ips)
|
||||||
|
Loading…
Reference in New Issue
Block a user