Fix fetching files by id not working

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 89a736d87e
commit 72dfe76172
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,6 +1,6 @@
[package] [package]
name = "hydrus-api" name = "hydrus-api"
version = "0.3.4" version = "0.3.5"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"

@ -7,11 +7,13 @@ pub fn string_list_to_json_array(l: Vec<String>) -> String {
pub fn number_list_to_json_array<T: ToString>(l: Vec<T>) -> String { pub fn number_list_to_json_array<T: ToString>(l: Vec<T>) -> String {
format!( format!(
"[{}]", "[{}]",
l.into_iter().fold(String::from(""), |acc, val| format!( l.into_iter()
.fold(String::from(""), |acc, val| format!(
"{},{}", "{},{}",
acc, acc,
val.to_string() val.to_string()
)) ))
.trim_start_matches(",")
) )
} }

@ -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 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] #[tokio::test]
async fn it_fetches_single_files() { async fn it_fetches_single_files() {
let client = common::get_client(); let client = common::get_client();

Loading…
Cancel
Save