def test_run_apt_update_report_no_sources(self):
"""
L{PackageReporter.run_apt_update} reports a failure if apt succeeds but
there are no APT sources defined. APT doesn't fail if there are no
sources, but we fake a failure in order to re-use the
PackageReporterAlert on the server.
"""
self.facade.reset_channels()
message_store = self.broker_service.message_store
message_store.set_accepted_types(["package-reporter-result"])
self._make_fake_apt_update()
deferred = Deferred()
def do_test():
result = self.reporter.run_apt_update()
def callback(ignore):
error = "There are no APT sources configured in %s or %s." % (
self.reporter.sources_list_filename,
self.reporter.sources_list_directory)
self.assertMessages(
message_store.get_pending_messages(),
[{"type": "package-reporter-result",
"report-timestamp": 0.0, "code": 1, "err": error}])
result.addCallback(callback)
self.reactor.advance(0)
result.chainDeferred(deferred)
reactor.callWhenRunning(do_test)
return deferred
评论列表
文章目录