test: Added in unit tests for TUI support for multiple custom named Servarrs
This commit is contained in:
@@ -39,7 +39,7 @@ mod tests {
|
||||
fn test_log_details_scroll_no_op_when_not_ready(
|
||||
#[values(DEFAULT_KEYBINDINGS.up.key, DEFAULT_KEYBINDINGS.down.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app
|
||||
@@ -71,7 +71,7 @@ mod tests {
|
||||
fn test_tasks_scroll(
|
||||
#[values(DEFAULT_KEYBINDINGS.up.key, DEFAULT_KEYBINDINGS.down.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
app
|
||||
@@ -99,7 +99,7 @@ mod tests {
|
||||
fn test_tasks_scroll_no_op_when_not_ready(
|
||||
#[values(DEFAULT_KEYBINDINGS.up.key, DEFAULT_KEYBINDINGS.down.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
@@ -128,7 +128,7 @@ mod tests {
|
||||
fn test_queued_events_scroll(
|
||||
#[values(DEFAULT_KEYBINDINGS.up.key, DEFAULT_KEYBINDINGS.down.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
app
|
||||
@@ -158,7 +158,7 @@ mod tests {
|
||||
fn test_queued_events_scroll_no_op_when_not_ready(
|
||||
#[values(DEFAULT_KEYBINDINGS.up.key, DEFAULT_KEYBINDINGS.down.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
@@ -187,7 +187,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_updates_scroll() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
@@ -214,7 +214,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_updates_scroll_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
@@ -261,7 +261,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_log_details_home_end_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app
|
||||
@@ -303,7 +303,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_tasks_home_end() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates =
|
||||
ScrollableText::with_string("Test 1\nTest 2\nTest 3".to_owned());
|
||||
@@ -342,7 +342,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_tasks_home_end_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates =
|
||||
@@ -382,7 +382,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_queued_events_home_end() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates =
|
||||
ScrollableText::with_string("Test 1\nTest 2\nTest 3".to_owned());
|
||||
@@ -421,7 +421,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_queued_events_home_end_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates =
|
||||
@@ -461,7 +461,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_updates_home_end() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
@@ -488,7 +488,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_updates_home_end_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
@@ -524,7 +524,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_handle_log_details_left_right() {
|
||||
let active_sonarr_block = ActiveSonarrBlock::SystemLogs;
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app
|
||||
.data
|
||||
@@ -625,7 +625,7 @@ mod tests {
|
||||
fn test_left_right_prompt_toggle(
|
||||
#[values(DEFAULT_KEYBINDINGS.left.key, DEFAULT_KEYBINDINGS.right.key)] key: Key,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
|
||||
SystemDetailsHandler::new(
|
||||
@@ -661,7 +661,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_tasks_submit() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
@@ -676,7 +676,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_tasks_submit_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
@@ -692,7 +692,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_tasks_start_task_prompt_confirm_submit() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
app
|
||||
@@ -724,7 +724,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_tasks_start_task_prompt_decline_submit() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
@@ -757,7 +757,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_esc_system_logs(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app
|
||||
.data
|
||||
@@ -780,7 +780,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_esc_system_tasks(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
@@ -797,7 +797,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_esc_system_queued_events(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemQueuedEvents.into());
|
||||
@@ -820,7 +820,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_esc_system_updates(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_ready;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemUpdates.into());
|
||||
@@ -832,7 +832,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_tasks_start_task_prompt_esc() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
@@ -871,7 +871,7 @@ mod tests {
|
||||
)]
|
||||
active_sonarr_block: ActiveSonarrBlock,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
@@ -898,7 +898,7 @@ mod tests {
|
||||
)]
|
||||
active_sonarr_block: ActiveSonarrBlock,
|
||||
) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
@@ -918,7 +918,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_tasks_start_task_prompt_confirm() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app
|
||||
@@ -962,7 +962,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_extract_task_name() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.sonarr_data
|
||||
@@ -982,7 +982,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_details_handler_not_ready_when_loading() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
|
||||
@@ -998,7 +998,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_details_handler_not_ready_when_log_details_and_updates_and_tasks_are_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
|
||||
@@ -1014,7 +1014,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_details_handler_ready_when_not_loading_and_log_details_is_not_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app
|
||||
@@ -1035,7 +1035,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_details_handler_ready_when_not_loading_and_tasks_is_not_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app
|
||||
@@ -1056,7 +1056,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_details_handler_ready_when_not_loading_and_updates_is_not_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
@@ -22,7 +22,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_system_tab_left(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(6);
|
||||
@@ -44,7 +44,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_system_tab_right(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(6);
|
||||
@@ -74,7 +74,7 @@ mod tests {
|
||||
|
||||
#[rstest]
|
||||
fn test_default_esc(#[values(true, false)] is_loading: bool) {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = is_loading;
|
||||
app.error = "test error".to_owned().into();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
@@ -96,7 +96,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_system_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
HorizontallyScrollableText::from("test 1"),
|
||||
@@ -129,7 +129,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_update_system_key_no_op_if_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
@@ -160,7 +160,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_queued_events_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
HorizontallyScrollableText::from("test 1"),
|
||||
@@ -193,7 +193,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_queued_events_key_no_op_if_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
@@ -224,7 +224,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_refresh_system_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
HorizontallyScrollableText::from("test 1"),
|
||||
HorizontallyScrollableText::from("test 2"),
|
||||
@@ -255,7 +255,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_refresh_system_key_no_op_if_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
@@ -288,7 +288,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_logs_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
HorizontallyScrollableText::from("test 1"),
|
||||
@@ -329,7 +329,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_logs_key_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
@@ -361,7 +361,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_tasks_key() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
HorizontallyScrollableText::from("test 1"),
|
||||
@@ -394,7 +394,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_tasks_key_no_op_when_not_ready() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.logs.set_items(vec![
|
||||
@@ -458,7 +458,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_handler_is_not_ready_when_loading() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
|
||||
@@ -474,7 +474,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_handler_is_not_ready_when_logs_is_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app
|
||||
@@ -500,7 +500,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_handler_is_not_ready_when_tasks_is_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.logs.set_items(vec!["test".into()]);
|
||||
@@ -522,7 +522,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_handler_is_not_ready_when_queued_events_is_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.logs.set_items(vec!["test".into()]);
|
||||
@@ -544,7 +544,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_system_handler_is_ready_when_all_required_tables_are_not_empty() {
|
||||
let mut app = App::default();
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.logs.set_items(vec!["test".into()]);
|
||||
|
||||
Reference in New Issue
Block a user