tests_logging_and_monitoring.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Brightside 作者: BrighterCommand 项目源码 文件源码
def test_logging_a_handler(self):
        """s
        Given that I have a handler decorated for logging
        When I call that handler
        Then I should receive logs indicating the call and return of the handler
        * N.b. This is an example of using decorators to extend the Brightside pipeline
        """
        handler = MyCommandHandler()
        request = MyCommand()
        self._subscriber_registry.register(MyCommand, lambda: handler)
        logger = logging.getLogger("tests.handlers_testdoubles")
        with patch.object(logger, 'log') as mock_log:
            self._commandProcessor.send(request)

        mock_log.assert_has_calls([call(logging.DEBUG, "Entering handle " + str(request)),
                                   call(logging.DEBUG, "Exiting handle " + str(request))])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号