def test_delete_indexes(self, api_key, endpoint, index_name, **kwargs): client = SearchIndexClient(endpoint, AzureKeyCredential(api_key)) client.delete_index(index_name) import time if self.is_live: time.sleep(TIME_TO_SLEEP) result = client.list_indexes() with pytest.raises(StopIteration): next(result)
def test_list_indexes(self, api_key, endpoint, index_name, **kwargs): client = SearchIndexClient(endpoint, AzureKeyCredential(api_key)) result = client.list_indexes() first = next(result) assert first.name == index_name with pytest.raises(StopIteration): next(result)
def _clean_up_indexes(endpoint, api_key): from azure.search.documents.indexes import SearchIndexClient client = SearchIndexClient(endpoint, AzureKeyCredential(api_key)) # wipe the synonym maps which seem to survive the index for map in client.get_synonym_maps(): client.delete_synonym_map(map.name) # wipe any existing indexes for index in client.list_indexes(): client.delete_index(index)
def test_list_indexes_empty(self, api_key, endpoint, **kwargs): client = SearchIndexClient(endpoint, AzureKeyCredential(api_key)) result = client.list_indexes() with pytest.raises(StopIteration): next(result)