summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-07-13 03:34:12 +0000
committerGerrit Code Review <review@openstack.org>2017-07-13 03:34:12 +0000
commit4aebef73c5dc0de5b1565b0f6f2f131da0749062 (patch)
tree3ba8508782b99f0281c99f572d73513375e53fec
parent8902c4e1299f3a16a9d2009ae8484715efd173d0 (diff)
parente0a670a03050e41d1c82f54e44f7aad5db28d682 (diff)
downloaddesignate-4aebef73c5dc0de5b1565b0f6f2f131da0749062.tar.gz
Merge "Fix pool tests in py3"
-rw-r--r--designate/tests/unit/test_pool.py43
-rw-r--r--tests-py3.txt1
2 files changed, 22 insertions, 22 deletions
diff --git a/designate/tests/unit/test_pool.py b/designate/tests/unit/test_pool.py
index 10af7ce8..03a13ad0 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 ae902b73..c8599190 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