test_commands.py 文件源码

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

项目:elasticsearch-django 作者: yunojuno 项目源码 文件源码
def test_handle(self, mock_do, mock_log):
        """Test the main handle method calls do_index_command."""
        obj = BaseSearchCommand()
        obj.handle(indexes=['foo', 'bar'])
        # this should have called the do_index_command twice
        mock_do.assert_has_calls([mock.call('foo'), mock.call('bar')])
        mock_do.reset_mock()
        mock_do.side_effect = TransportError(123, "oops", {'error': {'reason': 'no idea'}})
        obj.handle(indexes=['baz'])
        mock_do.assert_called_once_with('baz')
        mock_log.warning.assert_called_once()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号