diff --git a/designate/tests/unit/test_pool.py b/designate/tests/unit/test_pool.py index 10af7ce85..03a13ad0a 100644 --- a/designate/tests/unit/test_pool.py +++ b/designate/tests/unit/test_pool.py @@ -74,10 +74,10 @@ def deep_sort_lists(obj): """Sort lists nested in dictionaries """ if isinstance(obj, dict): - return {k: deep_sort_lists(obj[k]) for k in obj} + return sorted((k, deep_sort_lists(obj[k])) for k in obj) if isinstance(obj, list): - return [deep_sort_lists(v) for v in sorted(obj)] + return sorted(deep_sort_lists(v) for v in obj) return obj @@ -87,25 +87,26 @@ class poolTest(oslotest.base.BaseTestCase): def test_init_from_config(self): pool = objects.Pool.from_config(mock_conf, '769ca3fc-5924-4a44-8c1f-7efbe52fbd59') - expected = {'also_notifies': [{'host': '1.0.0.0', 'port': 1}, - {'host': '2.0.0.0', 'port': 2}], - 'description': 'Pool built from configuration on foohost', - 'id': '769ca3fc-5924-4a44-8c1f-7efbe52fbd59', - 'nameservers': [{'host': 'pool_host_1', - 'id': '169ca3fc-5924-4a44-8c1f-7efbe52fbd59', # noqa - 'port': 123}, - {'host': 'pool_host_2', - 'id': '269ca3fc-5924-4a44-8c1f-7efbe52fbd59', # noqa - 'port': 456}], - 'targets': [{'id': '1588652b-50e7-46b9-b688-a9bad40a873e', - 'masters': [], - 'options': [{'key': 'a', 'value': '1'}, - {'key': 'b', 'value': '2'}], - 'type': 't1'}, - {'id': '2588652b-50e7-46b9-b688-a9bad40a873e', - 'masters': [{'host': '1.1.1.1', 'port': 11}], - 'options': [], - 'type': 't2'}]} + expected = [('also_notifies', [[('host', '1.0.0.0'), ('port', 1)], + [('host', '2.0.0.0'), ('port', 2)]]), + ('description', 'Pool built from configuration on foohost'), # noqa + ('id', '769ca3fc-5924-4a44-8c1f-7efbe52fbd59'), + ('nameservers', [[('host', 'pool_host_1'), + ('id', '169ca3fc-5924-4a44-8c1f-7efbe52fbd59'), # noqa + ('port', 123)], + [('host', 'pool_host_2'), + ('id', '269ca3fc-5924-4a44-8c1f-7efbe52fbd59'), # noqa + ('port', 456)]]), + ('targets', [[('id', '1588652b-50e7-46b9-b688-a9bad40a873e'), # noqa + ('masters', []), + ('options', [[('key', 'a'), ('value', '1')], + [('key', 'b'), ('value', '2')]]), + ('type', 't1')], + [('id', '2588652b-50e7-46b9-b688-a9bad40a873e'), # noqa + ('masters', [[('host', '1.1.1.1'), + ('port', 11)]]), + ('options', []), + ('type', 't2')]])] actual = deep_sort_lists(pool.to_dict()) self.assertEqual(actual, expected) diff --git a/tests-py3.txt b/tests-py3.txt index ae902b737..c85991903 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -1,3 +1,2 @@ # Blacklist of tests failing on Python 3 -designate.tests.unit.test_pool designate.tests.unit.test_producer.test_tasks