コード例 #1
0
ファイル: test_listener.py プロジェクト: th3architect/maas
    def test_connectionLost_does_not_log_reason_when_lost_cleanly(self):
        listener = PostgresListenerService()

        with TwistedLoggerFixture() as logger:
            listener.connectionLost(Failure(error.ConnectionDone()))

        self.assertThat(logger.errors, HasLength(0))
コード例 #2
0
ファイル: test_listener.py プロジェクト: zhangrb/maas
    def test__connectionLost_logs_reason(self):
        listener = PostgresListenerService()
        failure = Failure(factory.make_exception("Treason!"))

        with TwistedLoggerFixture() as logger:
            listener.connectionLost(failure)

        self.assertThat(
            logger.output,
            DocTestMatches("""\
            Connection lost.
            Traceback (most recent call last):...
            Failure: maastesting.factory.TestException#...: Treason!
            """))