feat: Added Lidarr CLI support for fetching the host config and the security config
This commit is contained in:
@@ -7,7 +7,7 @@ use strum::{Display, EnumIter};
|
||||
|
||||
use super::{
|
||||
HorizontallyScrollableText, Serdeable,
|
||||
servarr_models::{DiskSpace, QualityProfile, RootFolder, Tag},
|
||||
servarr_models::{DiskSpace, HostConfig, QualityProfile, RootFolder, SecurityConfig, Tag},
|
||||
};
|
||||
use crate::serde_enum_from;
|
||||
|
||||
@@ -217,9 +217,11 @@ serde_enum_from!(
|
||||
Artists(Vec<Artist>),
|
||||
DiskSpaces(Vec<DiskSpace>),
|
||||
DownloadsResponse(DownloadsResponse),
|
||||
HostConfig(HostConfig),
|
||||
MetadataProfiles(Vec<MetadataProfile>),
|
||||
QualityProfiles(Vec<QualityProfile>),
|
||||
RootFolders(Vec<RootFolder>),
|
||||
SecurityConfig(SecurityConfig),
|
||||
SystemStatus(SystemStatus),
|
||||
Tags(Vec<Tag>),
|
||||
Value(Value),
|
||||
|
||||
@@ -8,7 +8,9 @@ mod tests {
|
||||
DownloadRecord, DownloadStatus, DownloadsResponse, Member, MetadataProfile, NewItemMonitorType,
|
||||
SystemStatus,
|
||||
};
|
||||
use crate::models::servarr_models::{DiskSpace, QualityProfile, RootFolder, Tag};
|
||||
use crate::models::servarr_models::{
|
||||
DiskSpace, HostConfig, QualityProfile, RootFolder, SecurityConfig, Tag,
|
||||
};
|
||||
use crate::models::{
|
||||
Serdeable,
|
||||
lidarr_models::{Artist, ArtistStatistics, ArtistStatus, LidarrSerdeable, Ratings},
|
||||
@@ -291,6 +293,18 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lidarr_serdeable_from_host_config() {
|
||||
let host_config = HostConfig {
|
||||
port: 8686,
|
||||
..HostConfig::default()
|
||||
};
|
||||
|
||||
let lidarr_serdeable: LidarrSerdeable = host_config.clone().into();
|
||||
|
||||
assert_eq!(lidarr_serdeable, LidarrSerdeable::HostConfig(host_config));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lidarr_serdeable_from_quality_profiles() {
|
||||
let quality_profiles = vec![QualityProfile {
|
||||
@@ -321,6 +335,21 @@ mod tests {
|
||||
assert_eq!(lidarr_serdeable, LidarrSerdeable::RootFolders(root_folders));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lidarr_serdeable_from_security_config() {
|
||||
let security_config = SecurityConfig {
|
||||
api_key: "test-key".to_owned(),
|
||||
..SecurityConfig::default()
|
||||
};
|
||||
|
||||
let lidarr_serdeable: LidarrSerdeable = security_config.clone().into();
|
||||
|
||||
assert_eq!(
|
||||
lidarr_serdeable,
|
||||
LidarrSerdeable::SecurityConfig(security_config)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lidarr_serdeable_from_system_status() {
|
||||
let system_status = SystemStatus {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::app::lidarr::lidarr_context_clues::ARTISTS_CONTEXT_CLUES;
|
||||
use crate::models::{
|
||||
Route, TabRoute, TabState,
|
||||
BlockSelectionState, Route, TabRoute, TabState,
|
||||
lidarr_models::{Artist, DownloadRecord},
|
||||
servarr_models::{DiskSpace, RootFolder},
|
||||
stateful_table::StatefulTable,
|
||||
@@ -28,7 +28,7 @@ pub struct LidarrData<'a> {
|
||||
pub prompt_confirm_action: Option<LidarrEvent>,
|
||||
pub quality_profile_map: BiMap<i64, String>,
|
||||
pub root_folders: StatefulTable<RootFolder>,
|
||||
pub selected_block: crate::models::BlockSelectionState<'a, ActiveLidarrBlock>,
|
||||
pub selected_block: BlockSelectionState<'a, ActiveLidarrBlock>,
|
||||
pub start_time: DateTime<Utc>,
|
||||
pub tags_map: BiMap<i64, String>,
|
||||
pub version: String,
|
||||
@@ -54,7 +54,7 @@ impl<'a> Default for LidarrData<'a> {
|
||||
prompt_confirm_action: None,
|
||||
quality_profile_map: BiMap::new(),
|
||||
root_folders: StatefulTable::default(),
|
||||
selected_block: crate::models::BlockSelectionState::default(),
|
||||
selected_block: BlockSelectionState::default(),
|
||||
start_time: Utc::now(),
|
||||
tags_map: BiMap::new(),
|
||||
version: String::new(),
|
||||
|
||||
Reference in New Issue
Block a user