Fixed bug requiring an indexer to be provided when querying for active downloads from Radarr

This commit is contained in:
2024-07-03 14:17:13 -06:00
parent 39e43350af
commit 9104b7c356
2 changed files with 31 additions and 2 deletions
+1
View File
@@ -162,6 +162,7 @@ pub struct DownloadRecord {
#[serde(deserialize_with = "super::from_i64")]
pub sizeleft: i64,
pub output_path: Option<HorizontallyScrollableText>,
#[serde(default)]
pub indexer: String,
pub download_client: String,
}
+30 -2
View File
@@ -1,8 +1,8 @@
#[cfg(test)]
mod tests {
use pretty_assertions::assert_str_eq;
use pretty_assertions::{assert_eq, assert_str_eq};
use crate::models::radarr_models::{MinimumAvailability, Monitor};
use crate::models::radarr_models::{DownloadRecord, MinimumAvailability, Monitor};
#[test]
fn test_minimum_availability_display() {
@@ -42,4 +42,32 @@ mod tests {
);
assert_str_eq!(Monitor::None.to_display_str(), "None");
}
#[test]
fn test_download_record_default_indexer_value() {
let json = r#"{
"title": "test",
"status": "test",
"id": 0,
"movieId": 0,
"size": 0,
"sizeleft": 0,
"downloadClient": "test"
}"#;
let expected_record = DownloadRecord {
title: "test".to_owned(),
status: "test".to_owned(),
id: 0,
movie_id: 0,
size: 0,
sizeleft: 0,
output_path: None,
indexer: "".to_owned(),
download_client: "test".to_owned(),
};
let result: DownloadRecord = serde_json::from_str(json).unwrap();
assert_eq!(result, expected_record);
}
}