test: Added in unit tests for TUI support for multiple custom named Servarrs

This commit is contained in:
2025-02-27 19:30:17 -07:00
parent 9b63b10118
commit f87e02cd7c
76 changed files with 1635 additions and 1403 deletions
+99 -99
View File
@@ -1,16 +1,13 @@
#[cfg(test)]
mod tests {
use crate::models::Route;
use anyhow::anyhow;
use pretty_assertions::{assert_eq, assert_str_eq};
use rstest::rstest;
use serde::de::value::StringDeserializer;
use serde::de::IntoDeserializer;
use serial_test::serial;
use tokio::sync::mpsc;
use crate::app::context_clues::{build_context_clue_string, SERVARR_CONTEXT_CLUES};
use crate::app::{
deserialize_env_var, interpolate_env_vars, App, AppConfig, Data, ServarrConfig,
interpolate_env_vars, App, AppConfig, Data, ServarrConfig,
};
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, RadarrData};
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SonarrData};
@@ -19,37 +16,68 @@ mod tests {
use crate::network::NetworkEvent;
use tokio_util::sync::CancellationToken;
#[rstest]
fn test_app_new(
#[values(ActiveRadarrBlock::default(), ActiveSonarrBlock::default())] servarr: impl Into<Route>
+ Copy,
) {
let (title, config) = match servarr.into() {
Route::Radarr(_, _) => (
"Radarr",
AppConfig {
radarr: Some(ServarrConfig::default()),
..AppConfig::default()
},
),
Route::Sonarr(_, _) => (
"Sonarr",
AppConfig {
sonarr: Some(ServarrConfig::default()),
..AppConfig::default()
},
),
_ => unreachable!(),
#[test]
fn test_app_new() {
let radarr_config_1 = ServarrConfig {
name: Some("Radarr Test".to_owned()),
..ServarrConfig::default()
};
let tab_route = |title: &'static str| TabRoute {
title,
route: servarr.into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
let radarr_config_2 = ServarrConfig {
weight: Some(3),
..ServarrConfig::default()
};
let sonarr_config_1 = ServarrConfig {
name: Some("Sonarr Test".to_owned()),
weight: Some(1),
..ServarrConfig::default()
};
let sonarr_config_2 = ServarrConfig::default();
let config = AppConfig {
radarr: Some(vec![radarr_config_1.clone(), radarr_config_2.clone()]),
sonarr: Some(vec![sonarr_config_1.clone(), sonarr_config_2.clone()]),
};
let expected_tab_routes = vec![
TabRoute {
title: "Sonarr Test".to_owned(),
route: ActiveSonarrBlock::default().into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
config: Some(sonarr_config_1),
},
TabRoute {
title: "Radarr 1".to_owned(),
route: ActiveRadarrBlock::default().into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
config: Some(radarr_config_2),
},
TabRoute {
title: "Radarr Test".to_owned(),
route: ActiveRadarrBlock::default().into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
config: Some(radarr_config_1),
},
TabRoute {
title: "Sonarr 1".to_owned(),
route: ActiveSonarrBlock::default().into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
config: Some(sonarr_config_2),
},
];
let app = App::new(
mpsc::channel::<NetworkEvent>(500).0,
@@ -58,13 +86,13 @@ mod tests {
);
assert!(app.navigation_stack.is_empty());
assert_eq!(app.get_current_route(), servarr.into());
assert_eq!(app.get_current_route(), ActiveSonarrBlock::default().into());
assert!(app.network_tx.is_some());
assert!(!app.cancellation_token.is_cancelled());
assert!(app.is_first_render);
assert_eq!(app.error, HorizontallyScrollableText::default());
assert_eq!(app.server_tabs.index, 0);
assert_eq!(app.server_tabs.tabs, vec![tab_route(title)]);
assert_eq!(app.server_tabs.tabs, expected_tab_routes);
assert_eq!(app.tick_until_poll, 400);
assert_eq!(app.ticks_until_scroll, 4);
assert_eq!(app.tick_count, 0);
@@ -85,29 +113,6 @@ mod tests {
assert!(app.is_first_render);
assert_eq!(app.error, HorizontallyScrollableText::default());
assert_eq!(app.server_tabs.index, 0);
assert_eq!(
app.server_tabs.tabs,
vec![
TabRoute {
title: "Radarr",
route: ActiveRadarrBlock::Movies.into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
},
TabRoute {
title: "Sonarr",
route: ActiveSonarrBlock::Series.into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
contextual_help: None,
},
]
);
assert_eq!(app.tick_until_poll, 400);
assert_eq!(app.ticks_until_scroll, 4);
assert_eq!(app.tick_count, 0);
@@ -120,7 +125,7 @@ mod tests {
#[test]
fn test_navigation_stack_methods() {
let mut app = App::default();
let mut app = App::test_default();
let default_route = app.server_tabs.tabs.first().unwrap().route;
assert_eq!(app.get_current_route(), default_route);
@@ -157,7 +162,7 @@ mod tests {
let mut app = App {
is_loading: true,
should_refresh: false,
..App::default()
..App::test_default()
};
app.cancellation_token.cancel();
@@ -175,7 +180,7 @@ mod tests {
fn test_reset_tick_count() {
let mut app = App {
tick_count: 2,
..App::default()
..App::test_default()
};
app.reset_tick_count();
@@ -202,7 +207,7 @@ mod tests {
error: "Test error".to_owned().into(),
is_first_render: false,
data,
..App::default()
..App::test_default()
};
app.reset();
@@ -216,7 +221,7 @@ mod tests {
#[test]
fn test_handle_error() {
let mut app = App::default();
let mut app = App::test_default();
let test_string = "Testing";
app.handle_error(anyhow!(test_string));
@@ -235,7 +240,7 @@ mod tests {
let mut app = App {
tick_until_poll: 2,
network_tx: Some(sync_network_tx),
..App::default()
..App::test_default()
};
assert_eq!(app.tick_count, 0);
@@ -259,7 +264,7 @@ mod tests {
tick_until_poll: 2,
network_tx: Some(sync_network_tx),
is_first_render: true,
..App::default()
..App::test_default()
};
assert_eq!(app.tick_count, 0);
@@ -313,7 +318,7 @@ mod tests {
tick_until_poll: 2,
tick_count: 2,
is_routing: true,
..App::default()
..App::test_default()
};
app.on_tick().await;
@@ -326,7 +331,7 @@ mod tests {
tick_until_poll: 2,
tick_count: 2,
should_refresh: true,
..App::default()
..App::test_default()
};
app.on_tick().await;
@@ -345,7 +350,7 @@ mod tests {
fn test_servarr_config_default() {
let servarr_config = ServarrConfig::default();
assert!(servarr_config.name.is_empty());
assert_eq!(servarr_config.name, None);
assert_eq!(servarr_config.host, Some("localhost".to_string()));
assert_eq!(servarr_config.port, None);
assert_eq!(servarr_config.uri, None);
@@ -356,21 +361,9 @@ mod tests {
}
#[test]
fn test_deserialize_env_var() {
std::env::set_var("TEST_VAR_DESERIALIZE", "testing");
let deserializer: StringDeserializer<serde_yaml::Error> =
"${TEST_VAR_DESERIALIZE}".to_owned().into_deserializer();
let env_var: Result<String, serde_yaml::Error> = deserialize_env_var(deserializer);
assert!(env_var.is_ok());
assert_str_eq!(env_var.unwrap(), "testing");
std::env::remove_var("TEST_VAR_DESERIALIZE");
}
#[test]
#[serial]
fn test_deserialize_optional_env_var_is_present() {
std::env::set_var("TEST_VAR_DESERIALIZE_OPTION", "localhost");
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_OPTION", "localhost") };
let yaml_data = r#"
host: ${TEST_VAR_DESERIALIZE_OPTION}
api_token: "test123"
@@ -379,12 +372,13 @@ mod tests {
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
assert_eq!(config.host, Some("localhost".to_string()));
std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION");
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION") };
}
#[test]
#[serial]
fn test_deserialize_optional_env_var_does_not_overwrite_non_env_value() {
std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_NO_OVERWRITE", "localhost");
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_NO_OVERWRITE", "localhost") };
let yaml_data = r#"
host: www.example.com
api_token: "test123"
@@ -393,7 +387,7 @@ mod tests {
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
assert_eq!(config.host, Some("www.example.com".to_string()));
std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_NO_OVERWRITE");
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_NO_OVERWRITE") };
}
#[test]
@@ -408,8 +402,9 @@ mod tests {
}
#[test]
#[serial]
fn test_deserialize_optional_u16_env_var_is_present() {
std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_U16", "1");
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_U16", "1") };
let yaml_data = r#"
port: ${TEST_VAR_DESERIALIZE_OPTION_U16}
api_token: "test123"
@@ -418,12 +413,13 @@ mod tests {
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
assert_eq!(config.port, Some(1));
std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_U16");
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_U16") };
}
#[test]
#[serial]
fn test_deserialize_optional_u16_env_var_does_not_overwrite_non_env_value() {
std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_U16_UNUSED", "1");
unsafe { std::env::set_var("TEST_VAR_DESERIALIZE_OPTION_U16_UNUSED", "1") };
let yaml_data = r#"
port: 1234
api_token: "test123"
@@ -432,7 +428,7 @@ mod tests {
let config: ServarrConfig = serde_yaml::from_str(yaml_data).unwrap();
assert_eq!(config.port, Some(1234));
std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_U16_UNUSED");
unsafe { std::env::remove_var("TEST_VAR_DESERIALIZE_OPTION_U16_UNUSED") };
}
#[test]
@@ -460,13 +456,14 @@ mod tests {
}
#[test]
#[serial]
fn test_interpolate_env_vars() {
std::env::set_var("TEST_VAR_INTERPOLATION", "testing");
unsafe { std::env::set_var("TEST_VAR_INTERPOLATION", "testing") };
let var = interpolate_env_vars("${TEST_VAR_INTERPOLATION}");
assert_str_eq!(var, "testing");
std::env::remove_var("TEST_VAR_INTERPOLATION");
unsafe { std::env::remove_var("TEST_VAR_INTERPOLATION") };
}
#[test]
@@ -477,13 +474,16 @@ mod tests {
}
#[test]
#[serial]
fn test_interpolate_env_vars_scrubs_all_unnecessary_characters() {
std::env::set_var(
"TEST_VAR_INTERPOLATION_UNNECESSARY_CHARACTERS",
r#"""
unsafe {
std::env::set_var(
"TEST_VAR_INTERPOLATION_UNNECESSARY_CHARACTERS",
r#"""
`"'https://dontdo:this@testing.com/query?test=%20query#results'"` {([\|$!])}
"""#,
);
)
};
let var = interpolate_env_vars("${TEST_VAR_INTERPOLATION_UNNECESSARY_CHARACTERS}");
@@ -491,7 +491,7 @@ mod tests {
var,
"https://dontdo:this@testing.com/query?test=%20query#results"
);
std::env::remove_var("TEST_VAR_INTERPOLATION_UNNECESSARY_CHARACTERS");
unsafe { std::env::remove_var("TEST_VAR_INTERPOLATION_UNNECESSARY_CHARACTERS") };
}
#[test]
@@ -514,10 +514,10 @@ mod tests {
let api_token = "thisisatest".to_owned();
let api_token_file = "/root/.config/api_token".to_owned();
let ssl_cert_path = "/some/path".to_owned();
let expected_str = format!("ServarrConfig {{ name: \"{}\", host: Some(\"{}\"), port: Some({}), uri: Some(\"{}\"), weight: Some(\"{}\"), api_token: Some(\"***********\"), api_token_file: Some(\"{}\"), ssl_cert_path: Some(\"{}\") }}",
let expected_str = format!("ServarrConfig {{ name: Some(\"{}\"), host: Some(\"{}\"), port: Some({}), uri: Some(\"{}\"), weight: Some({}), api_token: Some(\"***********\"), api_token_file: Some(\"{}\"), ssl_cert_path: Some(\"{}\") }}",
name, host, port, uri, weight, api_token_file, ssl_cert_path);
let servarr_config = ServarrConfig {
name,
name: Some(name),
host: Some(host),
port: Some(port),
uri: Some(uri),
+49 -38
View File
@@ -51,16 +51,25 @@ impl App<'_> {
cancellation_token: CancellationToken,
) -> Self {
let mut server_tabs = Vec::new();
let help = format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
);
if let Some(radarr_configs) = config.radarr {
let mut idx = 0;
for radarr_config in radarr_configs {
let name = if let Some(name) = radarr_config.name.clone() {
name
} else {
idx+=1;
format!("Radarr {}", idx)
};
server_tabs.push(TabRoute {
title: radarr_config.name.clone(),
title: name,
route: ActiveRadarrBlock::Movies.into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
help: help.clone(),
contextual_help: None,
config: Some(radarr_config),
});
@@ -68,14 +77,20 @@ impl App<'_> {
}
if let Some(sonarr_configs) = config.sonarr {
let mut idx = 0;
for sonarr_config in sonarr_configs {
let name = if let Some(name) = sonarr_config.name.clone() {
name
} else {
idx+=1;
format!("Sonarr {}", idx)
};
server_tabs.push(TabRoute {
title: sonarr_config.name.clone(),
title: name,
route: ActiveSonarrBlock::Series.into(),
help: format!(
"<↑↓> scroll | ←→ change tab | {} ",
build_context_clue_string(&SERVARR_CONTEXT_CLUES)
),
help: help.clone(),
contextual_help: None,
config: Some(sonarr_config),
});
@@ -86,8 +101,8 @@ impl App<'_> {
.into_iter()
.sorted_by(|tab1, tab2| {
Ord::cmp(
tab1.config.as_ref().unwrap().weight.as_ref().unwrap_or(&0),
tab2.config.as_ref().unwrap().weight.as_ref().unwrap_or(&0),
tab1.config.as_ref().unwrap().weight.as_ref().unwrap_or(&1000),
tab2.config.as_ref().unwrap().weight.as_ref().unwrap_or(&1000),
)
})
.collect();
@@ -190,6 +205,24 @@ impl Default for App<'_> {
cancellation_token: CancellationToken::new(),
error: HorizontallyScrollableText::default(),
is_first_render: true,
server_tabs: TabState::new(Vec::new()),
tick_until_poll: 400,
ticks_until_scroll: 4,
tick_count: 0,
is_loading: false,
is_routing: false,
should_refresh: false,
should_ignore_quit_key: false,
cli_mode: false,
data: Data::default(),
}
}
}
#[cfg(test)]
impl App<'_> {
pub fn test_default() -> Self {
App {
server_tabs: TabState::new(vec![
TabRoute {
title: "Radarr".to_owned(),
@@ -212,15 +245,7 @@ impl Default for App<'_> {
config: Some(ServarrConfig::default()),
},
]),
tick_until_poll: 400,
ticks_until_scroll: 4,
tick_count: 0,
is_loading: false,
is_routing: false,
should_refresh: false,
should_ignore_quit_key: false,
cli_mode: false,
data: Data::default(),
..App::default()
}
}
}
@@ -292,8 +317,8 @@ impl AppConfig {
#[derive(Redact, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct ServarrConfig {
#[serde(default, deserialize_with = "deserialize_env_var")]
pub name: String,
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
pub name: Option<String>,
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
pub host: Option<String>,
#[serde(default, deserialize_with = "deserialize_u16_env_var")]
@@ -313,11 +338,6 @@ pub struct ServarrConfig {
impl ServarrConfig {
fn validate(&self) {
if self.name.is_empty() {
log_and_print_error("'name' is required for configuration".to_owned());
process::exit(1);
}
if self.host.is_none() && self.uri.is_none() {
log_and_print_error("'host' or 'uri' is required for configuration".to_owned());
process::exit(1);
@@ -352,7 +372,7 @@ impl ServarrConfig {
impl Default for ServarrConfig {
fn default() -> Self {
ServarrConfig {
name: String::new(),
name: None,
host: Some("localhost".to_string()),
port: None,
uri: None,
@@ -369,15 +389,6 @@ pub fn log_and_print_error(error: String) {
eprintln!("error: {}", error.red());
}
fn deserialize_env_var<'de, D>(deserializer: D) -> Result<String, D::Error>
where
D: serde::Deserializer<'de>,
{
let s: String = String::deserialize(deserializer)?;
let interpolated = interpolate_env_vars(&s);
Ok(interpolated)
}
fn deserialize_optional_env_var<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
where
D: serde::Deserializer<'de>,
+9 -9
View File
@@ -467,7 +467,7 @@ mod tests {
#[tokio::test]
async fn test_dispatch_by_cast_crew_blocks_cast_and_crew_non_empty() {
let mut app = App::default();
let mut app = App::test_default();
for active_radarr_block in &[ActiveRadarrBlock::Cast, ActiveRadarrBlock::Crew] {
let mut movie_details_modal = MovieDetailsModal::default();
@@ -511,7 +511,7 @@ mod tests {
#[tokio::test]
async fn test_dispatch_by_manual_search_block_movie_releases_non_empty() {
let mut app = App::default();
let mut app = App::test_default();
let mut movie_details_modal = MovieDetailsModal::default();
movie_details_modal
.movie_releases
@@ -531,7 +531,7 @@ mod tests {
async fn test_dispatch_by_manual_search_block_is_loading() {
let mut app = App {
is_loading: true,
..App::default()
..App::test_default()
};
app
@@ -545,7 +545,7 @@ mod tests {
#[tokio::test]
async fn test_check_for_radarr_prompt_action_no_prompt_confirm() {
let mut app = App::default();
let mut app = App::test_default();
app.data.radarr_data.prompt_confirm = false;
app.check_for_radarr_prompt_action().await;
@@ -729,7 +729,7 @@ mod tests {
#[tokio::test]
async fn test_populate_movie_collection_table_unfiltered() {
let mut app = App::default();
let mut app = App::test_default();
app.data.radarr_data.collections.set_items(vec![Collection {
movies: Some(vec![CollectionMovie::default()]),
..Collection::default()
@@ -742,7 +742,7 @@ mod tests {
#[tokio::test]
async fn test_populate_movie_collection_table_filtered() {
let mut app = App::default();
let mut app = App::test_default();
app
.data
.radarr_data
@@ -759,7 +759,7 @@ mod tests {
#[tokio::test]
async fn test_extract_movie_id() {
let mut app = App::default();
let mut app = App::test_default();
app.data.radarr_data.movies.set_items(vec![Movie {
id: 1,
..Movie::default()
@@ -770,7 +770,7 @@ mod tests {
#[tokio::test]
async fn test_extract_radarr_indexer_id() {
let mut app = App::default();
let mut app = App::test_default();
app.data.radarr_data.indexers.set_items(vec![Indexer {
id: 1,
..Indexer::default()
@@ -785,7 +785,7 @@ mod tests {
network_tx: Some(sync_network_tx),
tick_count: 1,
is_first_render: false,
..App::default()
..App::test_default()
};
app.data.radarr_data.prompt_confirm = true;
+15 -15
View File
@@ -185,7 +185,7 @@ mod tests {
async fn test_dispatch_by_manual_season_search_block_is_loading() {
let mut app = App {
is_loading: true,
..App::default()
..App::test_default()
};
app
@@ -199,7 +199,7 @@ mod tests {
#[tokio::test]
async fn test_dispatch_by_manual_season_search_block_season_releases_non_empty() {
let mut app = App::default();
let mut app = App::test_default();
let mut season_details_modal = SeasonDetailsModal::default();
season_details_modal
.season_releases
@@ -304,7 +304,7 @@ mod tests {
async fn test_dispatch_by_manual_episode_search_block_is_loading() {
let mut app = App {
is_loading: true,
..App::default()
..App::test_default()
};
app
@@ -318,7 +318,7 @@ mod tests {
#[tokio::test]
async fn test_dispatch_by_manual_episode_search_block_episode_releases_non_empty() {
let mut app = App::default();
let mut app = App::test_default();
let mut episode_details_modal = EpisodeDetailsModal::default();
episode_details_modal
.episode_releases
@@ -554,7 +554,7 @@ mod tests {
#[tokio::test]
async fn test_check_for_sonarr_prompt_action_no_prompt_confirm() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.prompt_confirm = false;
app.check_for_sonarr_prompt_action().await;
@@ -750,7 +750,7 @@ mod tests {
#[tokio::test]
async fn test_populate_seasons_table_unfiltered() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.series.set_items(vec![Series {
seasons: Some(vec![Season::default()]),
..Series::default()
@@ -770,7 +770,7 @@ mod tests {
#[tokio::test]
async fn test_populate_seasons_table_filtered() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.series.set_filtered_items(vec![Series {
seasons: Some(vec![Season::default()]),
..Series::default()
@@ -790,7 +790,7 @@ mod tests {
#[tokio::test]
async fn test_extract_episode_id() {
let mut app = App::default();
let mut app = App::test_default();
let mut season_details_modal = SeasonDetailsModal::default();
season_details_modal.episodes.set_items(vec![Episode {
id: 1,
@@ -804,14 +804,14 @@ mod tests {
#[tokio::test]
#[should_panic(expected = "Season details have not been loaded")]
async fn test_extract_episode_id_requires_season_details_modal_to_be_some() {
let app = App::default();
let app = App::test_default();
assert_eq!(app.extract_episode_id().await, 0);
}
#[tokio::test]
async fn test_extract_series_id() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.series.set_items(vec![Series {
id: 1,
..Series::default()
@@ -822,7 +822,7 @@ mod tests {
#[tokio::test]
async fn test_extract_series_id_season_number_tuple() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.series.set_items(vec![Series {
id: 1,
..Series::default()
@@ -837,7 +837,7 @@ mod tests {
#[tokio::test]
async fn test_extract_add_new_series_search_query() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.add_series_search = Some("test search".into());
assert_str_eq!(
@@ -849,14 +849,14 @@ mod tests {
#[tokio::test]
#[should_panic(expected = "Add series search is empty")]
async fn test_extract_add_new_series_search_query_panics_when_the_query_is_not_set() {
let app = App::default();
let app = App::test_default();
app.extract_add_new_series_search_query().await;
}
#[tokio::test]
async fn test_extract_sonarr_indexer_id() {
let mut app = App::default();
let mut app = App::test_default();
app.data.sonarr_data.indexers.set_items(vec![Indexer {
id: 1,
..Indexer::default()
@@ -871,7 +871,7 @@ mod tests {
network_tx: Some(sync_network_tx),
tick_count: 1,
is_first_render: false,
..App::default()
..App::test_default()
};
app.data.sonarr_data.prompt_confirm = true;