def remove_existing_transaction_type(transaction_type: str) -> None: """ Deletes a registered transaction type """ _log.info(f"Deleting existing transaction type {transaction_type}") redisearch.delete_index(transaction_type) storage.delete(f"{FOLDER}/{transaction_type}")
def test_delete_index_exists(self): mock_drop_index = MagicMock() redisearch._get_redisearch_index_client = MagicMock( return_value=MagicMock(drop_index=mock_drop_index)) redisearch.delete_index("banana") redisearch._get_redisearch_index_client.assert_called_once_with( "banana") mock_drop_index.assert_called_once()
def test_delete_index_doesnt_exist(self): mock_drop_index = MagicMock( side_effect=redis.exceptions.ResponseError("Unknown Index name")) redisearch._get_redisearch_index_client = MagicMock( return_value=MagicMock(drop_index=mock_drop_index)) redisearch.delete_index("banana") redisearch._get_redisearch_index_client.assert_called_once_with( "banana") mock_drop_index.assert_called_once()