Skip to content

Commit

Permalink
Removed unsed code and added test (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecardleitao authored Jan 29, 2024
1 parent 937e7ac commit c8accff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
26 changes: 1 addition & 25 deletions src/fs_azure.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -10,29 +9,6 @@ pub struct ContainerClient {
can_put: bool,
}

/// Lists all blobs in container
pub async fn list(client: ContainerClient) -> Result<Vec<String>, azure_storage::Error> {
Ok(client
.client
.list_blobs()
.into_stream()
.try_collect::<Vec<_>>()
.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<bool, azure_storage::Error> {
client.client.blob_client(blob_name).exists().await
Expand Down
9 changes: 9 additions & 0 deletions tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,12 @@ async fn multi_day_legs() -> Result<(), Box<dyn Error>> {
assert_eq!(legs.len(), 6);
Ok(())
}

#[tokio::test]
async fn fs_azure() -> Result<(), Box<dyn Error>> {
let client = flights::fs_azure::initialize_anonymous("privatejets", "data");

let _ = flights::positions("459cd3", date!(2020 - 01 - 01), Some(&client)).await?;

Ok(())
}

0 comments on commit c8accff

Please sign in to comment.