Correct test_get_v3_catalog test for result ordering
The order of the endpoints and interfaces lists will vary depending on how a query returns results, so the endpoints and interfaces may not be in the same order as the expected dict. This can be seen by setting the PYTHONHASHSEED value to something other than 0. With this fix, searches are done rather than using the built-in dict equal method. Change-Id: I4623401e93c4dd2e9347eb485dc701891af79a44 Partial-Bug: #1348818
This commit is contained in:
parent
658b175bef
commit
649b4e1682
|
@ -80,6 +80,13 @@ class TestTemplatedCatalog(tests.TestCase, test_backend.CatalogTests):
|
|||
def test_get_v3_catalog_endpoint_disabled(self):
|
||||
self.skipTest("Templated backend doesn't have disabled endpoints")
|
||||
|
||||
def assert_catalogs_equal(self, expected, observed):
|
||||
for e, o in zip(sorted(expected), sorted(observed)):
|
||||
expected_endpoints = e.pop('endpoints')
|
||||
observed_endpoints = o.pop('endpoints')
|
||||
self.assertDictEqual(e, o)
|
||||
self.assertItemsEqual(expected_endpoints, observed_endpoints)
|
||||
|
||||
def test_get_v3_catalog(self):
|
||||
user_id = uuid.uuid4().hex
|
||||
project_id = uuid.uuid4().hex
|
||||
|
@ -111,7 +118,7 @@ class TestTemplatedCatalog(tests.TestCase, test_backend.CatalogTests):
|
|||
'type': 'identity',
|
||||
'name': "'Identity Service'",
|
||||
'id': '1'}]
|
||||
self.assertEqual(exp_catalog, catalog_ref)
|
||||
self.assert_catalogs_equal(exp_catalog, catalog_ref)
|
||||
|
||||
def test_list_regions_filtered_by_parent_region_id(self):
|
||||
self.skipTest('Templated backend does not support hints')
|
||||
|
|
Loading…
Reference in New Issue