def test_delete_documents_missing(self, api_key, endpoint, index_name, **kwargs): client = SearchIndexClient( endpoint, index_name, SearchApiKeyCredential(api_key) ) results = client.delete_documents([{"hotelId": "1000"}, {"hotelId": "4"}]) assert len(results) == 2 assert set(x.status_code for x in results) == {200} # There can be some lag before a document is searchable time.sleep(3) assert client.get_document_count() == 9 with pytest.raises(HttpResponseError): client.get_document(key="1000") with pytest.raises(HttpResponseError): client.get_document(key="4")
def test_delete_documents_existing(self, api_key, endpoint, index_name, **kwargs): client = SearchIndexClient( endpoint, index_name, AzureKeyCredential(api_key) ) results = client.delete_documents([{"hotelId": "3"}, {"hotelId": "4"}]) assert len(results) == 2 assert set(x.status_code for x in results) == {200} # There can be some lag before a document is searchable if self.is_live: time.sleep(TIME_TO_SLEEP) assert client.get_document_count() == 8 with pytest.raises(HttpResponseError): client.get_document(key="3") with pytest.raises(HttpResponseError): client.get_document(key="4")