Allow new XML API sample file generation
When GENERATE_SAMPLES is used, it's supposed to generate the docs for you. However, if there's no pre-existing XML doc sample, it fails due to bad handling of this case. Fixes bug 1094141 Change-Id: I186d6ce78886e37a3fdd3268154872c99072fdca
This commit is contained in:
parent
bde5420564
commit
cb5c61f66b
@ -81,6 +81,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)
|
||||
@ -235,7 +238,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,
|
||||
|
Loading…
Reference in New Issue
Block a user