Merge "Allow new XML API sample file generation"

This commit is contained in:
Jenkins 2013-01-02 15:04:39 +00:00 committed by Gerrit Code Review
commit 2ab0bf7431

View File

@ -82,6 +82,9 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
indent=4)
else:
if data is None:
# Likely from missing XML file.
return ""
xml = etree.XML(data)
data = etree.tostring(xml, encoding="UTF-8",
xml_declaration=True, pretty_print=True)
@ -236,7 +239,10 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
with file(self._get_sample(name)) as sample:
sample_data = sample.read()
except IOError:
sample_data = "{}"
if self.ctype == 'json':
sample_data = "{}"
else:
sample_data = None
try:
response_result = self._verify_something(subs, expected,