summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2013-03-23 08:28:14 -0400
committerDan Prince <dprince@redhat.com>2013-03-25 10:50:59 -0400
commitcff0ae1cd92eb8f85d410fa6f5844d0cc1b24a09 (patch)
tree52810535bc0c2e5ff91ba6c66757292d4f5e4303 /nova
parent2d02ce3ba00c3e4300bb841483d00d18210f79ff (diff)
Avoid using whitespace in test_safe_parse_xml.
Updates our MiscellaneousXMLUtilTests.test_safe_parse_xml test so that it avoids using and ignores whitespace. This works around some minidom parsing differences that can happen with some versions of python 2.6. Fixes LP Bug #1158826. Change-Id: Iada0b095ab3b5ac6dc026b3ff6cdfb175f1e20a7
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/api/openstack/test_xmlutil.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/nova/tests/api/openstack/test_xmlutil.py b/nova/tests/api/openstack/test_xmlutil.py
index 3ed6a86fc..c1a799757 100644
--- a/nova/tests/api/openstack/test_xmlutil.py
+++ b/nova/tests/api/openstack/test_xmlutil.py
@@ -726,16 +726,13 @@ class MiscellaneousXMLUtilTests(test.TestCase):
def test_safe_parse_xml(self):
- normal_body = ("""
- <?xml version="1.0" ?><foo>
- <bar>
- <v1>hey</v1>
- <v2>there</v2>
- </bar>
- </foo>""").strip()
+ normal_body = ('<?xml version="1.0" ?>'
+ '<foo><bar><v1>hey</v1><v2>there</v2></bar></foo>')
dom = xmlutil.safe_minidom_parse_string(normal_body)
- self.assertEqual(normal_body, str(dom.toxml()))
+ # Some versions of minidom inject extra newlines so we ignore them
+ result = str(dom.toxml()).replace('\n', '')
+ self.assertEqual(normal_body, result)
self.assertRaises(exception.MalformedRequestBody,
xmlutil.safe_minidom_parse_string,