147
147
'link': 'requirement.1.LINK',
150
def _make_cert_empty_resources(self):
151
# Create empty resources, as experienced when the tested system
152
# freezes and corrupts the content of the session. (lp:1479719)
153
state = self.manager.default_device_context.state
154
ns = CERTIFICATION_NS
155
state.set_resource_list(ns + 'cpuinfo', [])
156
state.set_resource_list(ns + 'dpkg', [])
157
state.set_resource_list(ns + 'lsb', [])
158
state.set_resource_list(ns + 'uname', [])
159
state.set_resource_list(ns + 'package', [])
160
state.set_resource_list(ns + 'requirements', [])
150
162
def _make_cert_attachments(self):
151
163
state = self.manager.default_device_context.state
152
164
partial_id_list = ['dmi_attachment', 'sysfs_attachment',
227
239
evil_actual = stream.getvalue().decode("utf-8")
228
240
self.assertMultiLineEqual(_evil_expected, evil_actual)
242
def test_empty_resources(self):
243
"""Empty resources don't break the correctness of the XML document."""
244
self._make_representative_jobs()
245
self._make_cert_empty_resources()
246
self._make_cert_attachments()
248
self.exporter.dump_from_session_manager(self.manager, stream)
249
empty_resources_actual = stream.getvalue().decode("utf-8")
250
self.assertMultiLineEqual(_empty_resources_expected, empty_resources_actual)
230
252
def test_xml_parsability(self):
231
253
"""Each produced output can be parsed with an XML parser."""
232
254
stream1 = BytesIO(_smoke_expected.encode("utf-8"))
529
551
<system_id value="{evil}"/>
531
553
</system>""".format(evil=_escaped_evil_text)
555
_empty_resources_expected = """\
556
<?xml version="1.0"?>
557
<system version="1.0">
559
<info command="2013.com.canonical.plainbox::representative/plugin/attachment">IO-LOG-STDOUT
563
<dmi>STDOUT-dmi_attachment
565
<sysfs-attributes>STDOUT-sysfs_attachment
567
<udev>STDOUT-udev_attachment
569
<!-- cpuinfo resource is not available, not producing the <processors> section -->
572
<question name="2013.com.canonical.plainbox::representative/plugin/manual">
573
<answer type="multiple_choice">pass</answer>
575
<value type="str">none</value>
576
<value type="str">pass</value>
577
<value type="str">fail</value>
578
<value type="str">skip</value>
580
<comment>IO-LOG-STDOUT
584
<question name="2013.com.canonical.plainbox::representative/plugin/qml">
585
<answer type="multiple_choice">pass</answer>
587
<value type="str">none</value>
588
<value type="str">pass</value>
589
<value type="str">fail</value>
590
<value type="str">skip</value>
592
<comment>IO-LOG-STDOUT
596
<question name="2013.com.canonical.plainbox::representative/plugin/shell">
597
<answer type="multiple_choice">pass</answer>
599
<value type="str">none</value>
600
<value type="str">pass</value>
601
<value type="str">fail</value>
602
<value type="str">skip</value>
604
<comment>IO-LOG-STDOUT
608
<question name="2013.com.canonical.plainbox::representative/plugin/user-interact">
609
<answer type="multiple_choice">pass</answer>
611
<value type="str">none</value>
612
<value type="str">pass</value>
613
<value type="str">fail</value>
614
<value type="str">skip</value>
616
<comment>IO-LOG-STDOUT
620
<question name="2013.com.canonical.plainbox::representative/plugin/user-interact-verify">
621
<answer type="multiple_choice">pass</answer>
623
<value type="str">none</value>
624
<value type="str">pass</value>
625
<value type="str">fail</value>
626
<value type="str">skip</value>
628
<comment>IO-LOG-STDOUT
632
<question name="2013.com.canonical.plainbox::representative/plugin/user-verify">
633
<answer type="multiple_choice">pass</answer>
635
<value type="str">none</value>
636
<value type="str">pass</value>
637
<value type="str">fail</value>
638
<value type="str">skip</value>
640
<comment>COMMENTS</comment>
644
<!-- lsb resource is not available, not producing the <lsbrelease> tag -->
651
<client name="CLIENT_NAME" version="CLIENT_VERSION"/>
652
<date_created value="TIMESTAMP"/>
653
<!-- dpkg resource is not available, not producing the <architecture> tag -->
654
<!-- lsb resource is not available, not producing <distribution> and <distroseries> tags -->
655
<!-- uname resource is not available, not producing the <kernel-release> tag -->
656
<private value="False"/>
657
<contactable value="False"/>
658
<live_cd value="False"/>
659
<system_id value="SYSTEM_ID"/>