Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pydoof/management_api/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def bulk_update(hashid, name, items, temp=False, **opts):

def bulk_delete(hashid, name, items, temp=False, **opts):
api_client = ManagementAPIClient(**opts)
return api_client.delete(
_get_bulk_url(hashid, name, temp),
items
return api_client.request(
method="DELETE",
url=_get_bulk_url(hashid, name, temp),
json=items,
)
18 changes: 10 additions & 8 deletions tests/management_api/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,24 +270,26 @@ def test_bulk_update_temp(self, APIClientMock):
def test_bulk_delete(self, APIClientMock):
hashid = 'aab32d8'
index_name = 'product'
items_data = ['item']
items_data = [{"id": 1}]

items.bulk_delete(hashid, index_name, items_data)

APIClientMock.return_value.delete.assert_called_with(
'/api/v2/search_engines/aab32d8/indices/product/items/_bulk',
items_data
APIClientMock.return_value.request.assert_called_with(
method="DELETE",
url='/api/v2/search_engines/aab32d8/indices/product/items/_bulk',
json=items_data
)

@mock.patch('pydoof.management_api.items.ManagementAPIClient')
def test_bulk_delete_temp(self, APIClientMock):
hashid = 'aab32d8'
index_name = 'product'
items_data = ['item']
items_data = [{"id": 1}]

items.bulk_delete(hashid, index_name, items_data, temp=True)

APIClientMock.return_value.delete.assert_called_with(
'/api/v2/search_engines/aab32d8/indices/product/temp/items/_bulk',
items_data
APIClientMock.return_value.request.assert_called_with(
method="DELETE",
url='/api/v2/search_engines/aab32d8/indices/product/temp/items/_bulk',
json=items_data
)