summaryrefslogtreecommitdiffstats
path: root/testsuite/common.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-12-03 10:51:55 -0600
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-12-03 10:52:13 -0600
commit2983b0c358ef25e7c34ccdeb3ab1f8d6a6f9ae90 (patch)
treea289f0ace4b8d68c0e6c683797ff45177dd6044f /testsuite/common.py
parent33234d5dae565e6520bbdb65d67fbaed03df4d43 (diff)
downloadbcfg2-2983b0c358ef25e7c34ccdeb3ab1f8d6a6f9ae90.tar.gz
bcfg2-2983b0c358ef25e7c34ccdeb3ab1f8d6a6f9ae90.tar.bz2
bcfg2-2983b0c358ef25e7c34ccdeb3ab1f8d6a6f9ae90.zip
testsuite: fixed assertXMLEqual comparison of XML attribute values
Diffstat (limited to 'testsuite/common.py')
-rw-r--r--testsuite/common.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/testsuite/common.py b/testsuite/common.py
index 0cb457461..e26d0be61 100644
--- a/testsuite/common.py
+++ b/testsuite/common.py
@@ -267,7 +267,7 @@ class Bcfg2TestCase(unittest.TestCase):
attributes. """
self.assertEqual(el1.tag, el2.tag, msg=msg)
self.assertEqual(el1.text, el2.text, msg=msg)
- self.assertItemsEqual(el1.attrib, el2.attrib, msg=msg)
+ self.assertItemsEqual(el1.attrib.items(), el2.attrib.items(), msg=msg)
self.assertEqual(len(el1.getchildren()),
len(el2.getchildren()))
for child1 in el1.getchildren():
@@ -275,10 +275,11 @@ class Bcfg2TestCase(unittest.TestCase):
self.assertIsNotNone(cname,
msg="Element %s has no 'name' attribute" %
child1.tag)
- children2 = el2.xpath("*[@name='%s']" % cname)
+ children2 = el2.xpath("%s[@name='%s']" % (child1.tag, cname))
self.assertEqual(len(children2), 1,
- msg="More than one element named %s" % cname)
- self.assertXMLEqual(child1, children2[0], msg=msg)
+ msg="More than one %s element named %s" % \
+ (child1.tag, cname))
+ self.assertXMLEqual(child1, children2[0], msg=msg)
class DBModelTestCase(Bcfg2TestCase):