Skip to content

Commit

Permalink
Fix XMLMatcher error reporting
Browse files Browse the repository at this point in the history
The nova.tests.matchers.XMLMismatch class implements the
get_details() method returning a dictionary with the expect
and actual XML output. It is returning a string values, but
the testtools code requires that the dictionary values are
instances of the testtools.content.Content object.

To quote the 'get_details' docs on testtools.matchers.Mismatch

     :return: a dict mapping names to Content objects. name is a string to
         name the detail, and the Content object is the detail to add
         to the result. For more information see the API to which items from
         this dict are passed testtools.TestCase.addDetail.

Related bug #1130146
Change-Id: I75ec07d8b34b04c7b8009229fda49b344ed13bec
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
  • Loading branch information
berrange committed Feb 19, 2013
1 parent a89daff commit a7f72a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nova/tests/matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import pprint

from testtools import content

from lxml import etree


Expand Down Expand Up @@ -226,8 +228,8 @@ def describe(self):

def get_details(self):
return {
'expected': self.expected,
'actual': self.actual,
'expected': content.text_content(self.expected),
'actual': content.text_content(self.actual),
}


Expand Down

0 comments on commit a7f72a5

Please sign in to comment.