From 72dfe76172c4d0cbbbaaf7101194ac344ae7eddf Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 25 Jul 2021 16:15:30 +0200 Subject: [PATCH] Fix fetching files by id not working Signed-off-by: trivernis --- Cargo.toml | 2 +- src/utils.rs | 12 +++++++----- tests/client/test_searching_and_fetching_files.rs | 7 +++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3b02a5c..bfc3cb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydrus-api" -version = "0.3.4" +version = "0.3.5" authors = ["trivernis "] edition = "2018" license = "Apache-2.0" diff --git a/src/utils.rs b/src/utils.rs index 95f308a..8263999 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,11 +7,13 @@ pub fn string_list_to_json_array(l: Vec) -> String { pub fn number_list_to_json_array(l: Vec) -> String { format!( "[{}]", - l.into_iter().fold(String::from(""), |acc, val| format!( - "{},{}", - acc, - val.to_string() - )) + l.into_iter() + .fold(String::from(""), |acc, val| format!( + "{},{}", + acc, + val.to_string() + )) + .trim_start_matches(",") ) } diff --git a/tests/client/test_searching_and_fetching_files.rs b/tests/client/test_searching_and_fetching_files.rs index 5d4b146..98816d7 100644 --- a/tests/client/test_searching_and_fetching_files.rs +++ b/tests/client/test_searching_and_fetching_files.rs @@ -23,6 +23,13 @@ async fn it_fetches_file_metadata() { assert!(response.is_ok()); // Even if the file doesn't exist it still returns some information about it } +#[tokio::test] +async fn it_fetches_file_metadata_by_id() { + let client = common::get_client(); + let response = client.get_file_metadata(vec![1], vec![]).await; + assert!(response.is_ok()); // Even if the file doesn't exist it still returns some information about it +} + #[tokio::test] async fn it_fetches_single_files() { let client = common::get_client();