]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fixing the syntax error in the XML Serializer
authorArvind Somya <asomya@cisco.com>
Thu, 21 Mar 2013 19:18:20 +0000 (12:18 -0700)
committerArvind Somya <asomya@cisco.com>
Fri, 22 Mar 2013 18:04:21 +0000 (11:04 -0700)
This commit fixes the syntax error in the XML Serializer.
Modified wsgi test to exercise this bit of code as well

Fixes: Bug #1158468
Change-Id: I1bff589a46ff4884e131d7cf60551e2f400acb67

quantum/tests/unit/test_wsgi.py
quantum/wsgi.py

index 29369f8569b763d696fb38936d7cb7a993d00f88..883314b334b92f51e73ae9b4cd470fd76bad8009 100644 (file)
@@ -186,16 +186,18 @@ class SerializerTest(base.BaseTestCase):
         """
         content_type = 'application/xml'
         data_string = (
-            '<servers xmlns="fake">'
+            '<servers>'
+            '<server name="s1">'
             '<test test="a">passed</test>'
+            '</server>'
             '</servers>'
         )
 
-        metadata = {'plurals': ['servers', 'test'], 'xmlns': 'fake'}
+        metadata = {'plurals': {'servers': 'server'}, 'xmlns': 'fake'}
         serializer = wsgi.Serializer(
             default_xmlns="fake", metadata=metadata)
         result = serializer.deserialize(data_string, content_type)
-        expected = {'body': {'servers': ['passed']}}
+        expected = {'body': {'servers': [{'name': 's1', 'test': 'passed'}]}}
 
         self.assertEqual(expected, result)
 
index 707751c0d65babeda183565d7b708457d8e323dc..e1c1013725f0378cc54c0af44c15dfca3078c39e 100644 (file)
@@ -583,7 +583,7 @@ class XMLDeserializer(TextDeserializer):
                     attr == constants.XSI_ATTR or
                     attr == constants.TYPE_ATTR):
                     continue
-                result[self._get_key(attr)] = node.get[attr]
+                result[self._get_key(attr)] = node.get(attr)
             children = list(node)
             for child in children:
                 result[self._get_key(child.tag)] = self._from_xml_node(