def test__deferredDHCPRequestErrback_logs_known_exceptions(self): logger = self.useFixture(TwistedLoggerFixture()) monitor = DHCPRequestMonitor("lo") error = factory.make_string() monitor.deferredDHCPRequestErrback( make_Failure(DHCPProbeException, error)) self.assertThat(logger.output, DocTestMatches("DHCP probe failed. %s" % error))
def test__deferredDHCPRequestErrback_logs_unknown_exceptions(self): logger = self.useFixture(TwistedLoggerFixture()) monitor = DHCPRequestMonitor('lo') error = factory.make_string() monitor.deferredDHCPRequestErrback(make_Failure(IOError, error)) self.assertThat( logger.output, DocTestMatches("...unknown error...Traceback...%s" % error))
def test__deferredDHCPRequestErrback_ignores_cancelled(self): logger = self.useFixture(TwistedLoggerFixture()) monitor = DHCPRequestMonitor("lo") error = factory.make_string() monitor.deferredDHCPRequestErrback(make_Failure(CancelledError, error)) self.assertThat(logger.output, DocTestMatches(""))