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()
评论列表
文章目录