def test_run_apt_update_report_apt_failure(self):
"""
If L{PackageReporter.run_apt_update} fails, a message is sent to the
server reporting the error, to be able to fix the problem centrally.
"""
message_store = self.broker_service.message_store
message_store.set_accepted_types(["package-reporter-result"])
self._make_fake_apt_update(code=2)
deferred = Deferred()
def do_test():
result = self.reporter.run_apt_update()
def callback(ignore):
self.assertMessages(
message_store.get_pending_messages(),
[{"type": "package-reporter-result",
"report-timestamp": 0.0, "code": 2, "err": u"error"}])
result.addCallback(callback)
self.reactor.advance(0)
result.chainDeferred(deferred)
reactor.callWhenRunning(do_test)
return deferred
评论列表
文章目录