def test_bulk_body(self, mock_helpers, mock_es): mock_helpers.bulk.return_value = (1, []) request = Mock() request.params.mixed.return_value = {'_refresh_index': True} es._bulk_body('foo', request) mock_helpers.bulk.assert_called_once_with( client=mock_es.api, refresh=True, actions='foo')
def test_bulk_body_transaction_failed(self, mock_helpers, mock_es): mock_helpers.bulk.return_value = (1, []) request = Mock() request.params.mixed.return_value = {'_refresh_index': True} es._bulk_body('foo', request) import transaction transaction.abort() mock_helpers.bulk.assert_not_called()
def test_bulk_body(self, mock_helpers, mock_es): mock_helpers.bulk.return_value = (1, []) request = Mock() request.params.mixed.return_value = {'_refresh_index': True} es._bulk_body('foo', request) mock_helpers.bulk.assert_called_once_with(client=mock_es.api, refresh=True, actions='foo')
def test_bulk_body(self, mock_es): es._bulk_body('foo') mock_es.api.bulk.assert_called_once_with(body='foo')