From cff0ae1cd92eb8f85d410fa6f5844d0cc1b24a09 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Sat, 23 Mar 2013 08:28:14 -0400 Subject: 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 --- nova/tests/api/openstack/test_xmlutil.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'nova') 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 = (""" - - - hey - there - - """).strip() + normal_body = ('' + 'heythere') 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, -- cgit