From c8accffff11161981e565ed8a23a4d1d454f03a2 Mon Sep 17 00:00:00 2001 From: jorgecardleitao <149073281+jorgecardleitao@users.noreply.github.com> Date: Mon, 29 Jan 2024 06:17:30 +0100 Subject: [PATCH] Removed unsed code and added test (#25) --- src/fs_azure.rs | 26 +------------------------- tests/it/main.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/fs_azure.rs b/src/fs_azure.rs index 593ac26..03fedcd 100644 --- a/src/fs_azure.rs +++ b/src/fs_azure.rs @@ -1,7 +1,6 @@ use azure_storage::prelude::*; +use azure_storage_blobs::prelude::ClientBuilder; pub use azure_storage_blobs::prelude::ContainerClient as _ContainerClient; -use azure_storage_blobs::{container::operations::BlobItem, prelude::ClientBuilder}; -use futures::stream::TryStreamExt; use crate::fs::BlobStorageProvider; @@ -10,29 +9,6 @@ pub struct ContainerClient { can_put: bool, } -/// Lists all blobs in container -pub async fn list(client: ContainerClient) -> Result, azure_storage::Error> { - Ok(client - .client - .list_blobs() - .into_stream() - .try_collect::>() - .await? - .into_iter() - .map(|response| { - response - .blobs - .items - .into_iter() - .filter_map(|blob| match blob { - BlobItem::Blob(blob) => Some(blob.name), - BlobItem::BlobPrefix(_) => None, - }) - }) - .flatten() - .collect()) -} - /// Returns whether the blob exists in container async fn exists(client: &ContainerClient, blob_name: &str) -> Result { client.client.blob_client(blob_name).exists().await diff --git a/tests/it/main.rs b/tests/it/main.rs index 2209b31..6675c86 100644 --- a/tests/it/main.rs +++ b/tests/it/main.rs @@ -85,3 +85,12 @@ async fn multi_day_legs() -> Result<(), Box> { assert_eq!(legs.len(), 6); Ok(()) } + +#[tokio::test] +async fn fs_azure() -> Result<(), Box> { + let client = flights::fs_azure::initialize_anonymous("privatejets", "data"); + + let _ = flights::positions("459cd3", date!(2020 - 01 - 01), Some(&client)).await?; + + Ok(()) +}