diff options
| author | Dan Smith <danms@us.ibm.com> | 2012-09-27 13:59:29 -0700 |
|---|---|---|
| committer | Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> | 2012-09-28 10:00:51 -0400 |
| commit | 2ba27f66cf14e1cb111ebc93d094c6e77c55245f (patch) | |
| tree | 1f1564de2bcad83ae74ffe3437b64370ffa0e959 /nova/tests | |
| parent | 0d565de78b5cc8ecdd18e10444ec731db46b48eb (diff) | |
Fix CloudPipe extension XML serialization
It is completely broken right now and this fixes it to properly
traverse a list of cloudpipe instance dictionaries, resulting
in XML output that matches the API spec.
Fixes bug: 1056242
Change-Id: Ic768afeaa76d776fd55a4f618d14fa41ed4c8a63
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_cloudpipe.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_cloudpipe.py b/nova/tests/api/openstack/compute/contrib/test_cloudpipe.py index bb0eafe66..97b78f81e 100644 --- a/nova/tests/api/openstack/compute/contrib/test_cloudpipe.py +++ b/nova/tests/api/openstack/compute/contrib/test_cloudpipe.py @@ -152,25 +152,24 @@ class CloudpipesXMLSerializerTest(test.TestCase): def test_index_serializer(self): serializer = cloudpipe.CloudpipesTemplate() exemplar = dict(cloudpipes=[ - dict(cloudpipe=dict( + dict( project_id='1234', public_ip='1.2.3.4', public_port='321', instance_id='1234-1234-1234-1234', created_at=timeutils.isotime(), - state='running')), - dict(cloudpipe=dict( + state='running'), + dict( project_id='4321', public_ip='4.3.2.1', public_port='123', - state='pending'))]) + state='pending')]) text = serializer.serialize(exemplar) tree = etree.fromstring(text) self.assertEqual('cloudpipes', tree.tag) self.assertEqual(len(exemplar['cloudpipes']), len(tree)) for idx, cl_pipe in enumerate(tree): - self.assertEqual('cloudpipe', cl_pipe.tag) - kp_data = exemplar['cloudpipes'][idx]['cloudpipe'] + kp_data = exemplar['cloudpipes'][idx] for child in cl_pipe: self.assertTrue(child.tag in kp_data) self.assertEqual(child.text, kp_data[child.tag]) |
