test(radarr): pin table search, filter and selection behaviour
Radarr handler tests never asserted which block the search and filter keys push, so transposing searching_block and filtering_block in a TableHandlingConfig went undetected. Add a search key and a filter key test for each of the three handlers that configure them: library, collections and history. No test moved a table or list selection off index 0 either, which made current_selection() and items[0] indistinguishable. Select a non-zero index in the tests covering every handler that reads a selected row, enriching fixtures with a second, distinct entry where only one existed. Several fixtures also asserted against a default value, so the expected result was indistinguishable from an unset field. The system details tasks now use two distinct non-default task names, and the add movie body expects a non-default monitor and minimum availability.
This commit is contained in:
16 files changed
+481
-133
No files matched your search
@@ -154,7 +154,7 @@ mod tests {
|
||||
#[case(
|
||||
ActiveRadarrBlock::Blocklist,
|
||||
ActiveRadarrBlock::DeleteBlocklistItemPrompt,
|
||||
RadarrEvent::DeleteBlocklistItem(3)
|
||||
RadarrEvent::DeleteBlocklistItem(2)
|
||||
)]
|
||||
#[case(
|
||||
ActiveRadarrBlock::Blocklist,
|
||||
@@ -168,6 +168,7 @@ mod tests {
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.data.radarr_data.blocklist.select_index(Some(1));
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
@@ -353,7 +354,7 @@ mod tests {
|
||||
#[case(
|
||||
ActiveRadarrBlock::Blocklist,
|
||||
ActiveRadarrBlock::DeleteBlocklistItemPrompt,
|
||||
RadarrEvent::DeleteBlocklistItem(3)
|
||||
RadarrEvent::DeleteBlocklistItem(2)
|
||||
)]
|
||||
#[case(
|
||||
ActiveRadarrBlock::Blocklist,
|
||||
@@ -367,6 +368,7 @@ mod tests {
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.data.radarr_data.blocklist.select_index(Some(1));
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
@@ -556,6 +558,7 @@ mod tests {
|
||||
fn test_extract_blocklist_item_id() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.data.radarr_data.blocklist.select_index(Some(1));
|
||||
|
||||
let blocklist_item_id = BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
@@ -565,7 +568,7 @@ mod tests {
|
||||
)
|
||||
.extract_blocklist_item_id();
|
||||
|
||||
assert_eq!(blocklist_item_id, 3);
|
||||
assert_eq!(blocklist_item_id, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -142,11 +142,15 @@ mod tests {
|
||||
#[test]
|
||||
fn test_collection_details_submit_movie_already_in_library() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collection_movies
|
||||
.set_items(vec![collection_movie()]);
|
||||
app.data.radarr_data.collection_movies.set_items(vec![
|
||||
CollectionMovie {
|
||||
tmdb_id: 5678,
|
||||
overview: "Some other overview".to_owned(),
|
||||
..CollectionMovie::default()
|
||||
},
|
||||
collection_movie(),
|
||||
]);
|
||||
app.data.radarr_data.collection_movies.select_index(Some(1));
|
||||
app.data.radarr_data.movies.set_items(vec![Movie {
|
||||
tmdb_id: collection_movie().tmdb_id,
|
||||
..Movie::default()
|
||||
|
||||
@@ -381,6 +381,48 @@ mod tests {
|
||||
assert!(!app.should_refresh);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_search_collections_key() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_items(vec![Collection::default()]);
|
||||
|
||||
CollectionsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.search.key,
|
||||
&mut app,
|
||||
ActiveRadarrBlock::Collections,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SearchCollection.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_filter_collections_key() {
|
||||
let mut app = App::test_default();
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_items(vec![Collection::default()]);
|
||||
|
||||
CollectionsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.filter.key,
|
||||
&mut app,
|
||||
ActiveRadarrBlock::Collections,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterCollections.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_update_all_collections_prompt_confirm_confirm() {
|
||||
let mut app = App::test_default();
|
||||
|
||||
@@ -532,19 +532,34 @@ mod tests {
|
||||
edit_collection_modal
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
edit_collection_modal
|
||||
.quality_profile_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
edit_collection_modal
|
||||
.minimum_availability_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
app.data.radarr_data.edit_collection_modal = Some(edit_collection_modal);
|
||||
app.data.radarr_data.collections.set_items(vec![Collection {
|
||||
monitored: false,
|
||||
search_on_add: false,
|
||||
..collection()
|
||||
}]);
|
||||
app.data.radarr_data.collections.set_items(vec![
|
||||
Collection {
|
||||
id: 999,
|
||||
..collection()
|
||||
},
|
||||
Collection {
|
||||
monitored: false,
|
||||
search_on_add: false,
|
||||
..collection()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.collections.select_index(Some(1));
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let expected_edit_collection_params = EditCollectionParams {
|
||||
collection_id: 123,
|
||||
monitored: Some(false),
|
||||
minimum_availability: Some(MinimumAvailability::Announced),
|
||||
quality_profile_id: Some(1111),
|
||||
minimum_availability: Some(MinimumAvailability::InCinemas),
|
||||
quality_profile_id: Some(2222),
|
||||
root_folder_path: Some("/nfs/Test Path".to_owned()),
|
||||
search_on_add: Some(false),
|
||||
};
|
||||
@@ -945,19 +960,34 @@ mod tests {
|
||||
edit_collection_modal
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
edit_collection_modal
|
||||
.quality_profile_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
edit_collection_modal
|
||||
.minimum_availability_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
app.data.radarr_data.edit_collection_modal = Some(edit_collection_modal);
|
||||
app.data.radarr_data.collections.set_items(vec![Collection {
|
||||
monitored: false,
|
||||
search_on_add: false,
|
||||
..collection()
|
||||
}]);
|
||||
app.data.radarr_data.collections.set_items(vec![
|
||||
Collection {
|
||||
id: 999,
|
||||
..collection()
|
||||
},
|
||||
Collection {
|
||||
monitored: false,
|
||||
search_on_add: false,
|
||||
..collection()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.collections.select_index(Some(1));
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let expected_edit_collection_params = EditCollectionParams {
|
||||
collection_id: 123,
|
||||
monitored: Some(false),
|
||||
minimum_availability: Some(MinimumAvailability::Announced),
|
||||
quality_profile_id: Some(1111),
|
||||
minimum_availability: Some(MinimumAvailability::InCinemas),
|
||||
quality_profile_id: Some(2222),
|
||||
root_folder_path: Some("/nfs/Test Path".to_owned()),
|
||||
search_on_add: Some(false),
|
||||
};
|
||||
@@ -1034,19 +1064,34 @@ mod tests {
|
||||
edit_collection_modal
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
edit_collection_modal
|
||||
.quality_profile_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
edit_collection_modal
|
||||
.minimum_availability_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
app.data.radarr_data.edit_collection_modal = Some(edit_collection_modal);
|
||||
app.data.radarr_data.collections.set_items(vec![Collection {
|
||||
monitored: false,
|
||||
search_on_add: false,
|
||||
..collection()
|
||||
}]);
|
||||
app.data.radarr_data.collections.set_items(vec![
|
||||
Collection {
|
||||
id: 999,
|
||||
..collection()
|
||||
},
|
||||
Collection {
|
||||
monitored: false,
|
||||
search_on_add: false,
|
||||
..collection()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.collections.select_index(Some(1));
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let expected_edit_collection_params = EditCollectionParams {
|
||||
collection_id: 123,
|
||||
monitored: Some(false),
|
||||
minimum_availability: Some(MinimumAvailability::Announced),
|
||||
quality_profile_id: Some(1111),
|
||||
minimum_availability: Some(MinimumAvailability::InCinemas),
|
||||
quality_profile_id: Some(2222),
|
||||
root_folder_path: Some("/nfs/Test Path".to_owned()),
|
||||
search_on_add: Some(false),
|
||||
};
|
||||
|
||||
@@ -136,7 +136,7 @@ mod tests {
|
||||
#[case(
|
||||
ActiveRadarrBlock::Downloads,
|
||||
ActiveRadarrBlock::DeleteDownloadPrompt,
|
||||
RadarrEvent::DeleteDownload(1)
|
||||
RadarrEvent::DeleteDownload(2)
|
||||
)]
|
||||
#[case(
|
||||
ActiveRadarrBlock::Downloads,
|
||||
@@ -149,11 +149,15 @@ mod tests {
|
||||
#[case] expected_action: RadarrEvent,
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.downloads
|
||||
.set_items(vec![download_record()]);
|
||||
app.data.radarr_data.downloads.set_items(vec![
|
||||
download_record(),
|
||||
DownloadRecord {
|
||||
id: 2,
|
||||
title: "Test Download Title 2".to_owned(),
|
||||
..download_record()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.downloads.select_index(Some(1));
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
@@ -332,7 +336,7 @@ mod tests {
|
||||
#[case(
|
||||
ActiveRadarrBlock::Downloads,
|
||||
ActiveRadarrBlock::DeleteDownloadPrompt,
|
||||
RadarrEvent::DeleteDownload(1)
|
||||
RadarrEvent::DeleteDownload(2)
|
||||
)]
|
||||
#[case(
|
||||
ActiveRadarrBlock::Downloads,
|
||||
@@ -345,11 +349,15 @@ mod tests {
|
||||
#[case] expected_action: RadarrEvent,
|
||||
) {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.downloads
|
||||
.set_items(vec![download_record()]);
|
||||
app.data.radarr_data.downloads.set_items(vec![
|
||||
download_record(),
|
||||
DownloadRecord {
|
||||
id: 2,
|
||||
title: "Test Download Title 2".to_owned(),
|
||||
..download_record()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.downloads.select_index(Some(1));
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
@@ -403,11 +411,15 @@ mod tests {
|
||||
#[test]
|
||||
fn test_extract_download_id() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.downloads
|
||||
.set_items(vec![download_record()]);
|
||||
app.data.radarr_data.downloads.set_items(vec![
|
||||
download_record(),
|
||||
DownloadRecord {
|
||||
id: 2,
|
||||
title: "Test Download Title 2".to_owned(),
|
||||
..download_record()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.downloads.select_index(Some(1));
|
||||
|
||||
let download_id = DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
@@ -417,7 +429,7 @@ mod tests {
|
||||
)
|
||||
.extract_download_id();
|
||||
|
||||
assert_eq!(download_id, 1);
|
||||
assert_eq!(download_id, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -199,6 +199,40 @@ mod tests {
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::History.into());
|
||||
assert!(!app.should_refresh);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_search_history_key() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.history.set_items(history_vec());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::History.into());
|
||||
|
||||
HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.search.key,
|
||||
&mut app,
|
||||
ActiveRadarrBlock::History,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SearchHistory.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_filter_history_key() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.history.set_items(history_vec());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::History.into());
|
||||
|
||||
HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.filter.key,
|
||||
&mut app,
|
||||
ActiveRadarrBlock::History,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterHistory.into());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::indexer;
|
||||
use crate::models::servarr_data::modals::EditIndexerModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, EDIT_INDEXER_BLOCKS};
|
||||
use crate::models::servarr_models::EditIndexerParams;
|
||||
use crate::models::servarr_models::{EditIndexerParams, Indexer};
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
use strum::IntoEnumIterator;
|
||||
@@ -916,9 +916,14 @@ mod tests {
|
||||
priority: 25,
|
||||
};
|
||||
app.data.radarr_data.edit_indexer_modal = Some(edit_indexer_modal);
|
||||
app.data.radarr_data.indexers.set_items(vec![indexer()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.indexers
|
||||
.set_items(vec![indexer(), Indexer { id: 2, ..indexer() }]);
|
||||
app.data.radarr_data.indexers.select_index(Some(1));
|
||||
let expected_edit_indexer_params = EditIndexerParams {
|
||||
indexer_id: 1,
|
||||
indexer_id: 2,
|
||||
name: Some("Test Update".to_owned()),
|
||||
enable_rss: Some(false),
|
||||
enable_automatic_search: Some(false),
|
||||
@@ -1759,9 +1764,14 @@ mod tests {
|
||||
priority: 25,
|
||||
};
|
||||
app.data.radarr_data.edit_indexer_modal = Some(edit_indexer_modal);
|
||||
app.data.radarr_data.indexers.set_items(vec![indexer()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.indexers
|
||||
.set_items(vec![indexer(), Indexer { id: 2, ..indexer() }]);
|
||||
app.data.radarr_data.indexers.select_index(Some(1));
|
||||
let expected_edit_indexer_params = EditIndexerParams {
|
||||
indexer_id: 1,
|
||||
indexer_id: 2,
|
||||
name: Some("Test Update".to_owned()),
|
||||
enable_rss: Some(false),
|
||||
enable_automatic_search: Some(false),
|
||||
@@ -1837,9 +1847,14 @@ mod tests {
|
||||
priority: 25,
|
||||
};
|
||||
app.data.radarr_data.edit_indexer_modal = Some(edit_indexer_modal);
|
||||
app.data.radarr_data.indexers.set_items(vec![indexer()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.indexers
|
||||
.set_items(vec![indexer(), Indexer { id: 2, ..indexer() }]);
|
||||
app.data.radarr_data.indexers.select_index(Some(1));
|
||||
let expected_edit_indexer_params = EditIndexerParams {
|
||||
indexer_id: 1,
|
||||
indexer_id: 2,
|
||||
name: Some("Test Update".to_owned()),
|
||||
enable_rss: Some(false),
|
||||
enable_automatic_search: Some(false),
|
||||
|
||||
@@ -143,6 +143,11 @@ mod tests {
|
||||
} else {
|
||||
"usenet".to_owned()
|
||||
};
|
||||
let other_protocol = if torrent_protocol {
|
||||
"usenet".to_owned()
|
||||
} else {
|
||||
"torrent".to_owned()
|
||||
};
|
||||
let mut expected_edit_indexer_modal = EditIndexerModal {
|
||||
name: "Test".into(),
|
||||
enable_rss: Some(true),
|
||||
@@ -186,7 +191,14 @@ mod tests {
|
||||
fields: Some(fields),
|
||||
..Indexer::default()
|
||||
};
|
||||
radarr_data.indexers.set_items(vec![indexer]);
|
||||
radarr_data.indexers.set_items(vec![
|
||||
Indexer {
|
||||
protocol: other_protocol,
|
||||
..Indexer::default()
|
||||
},
|
||||
indexer,
|
||||
]);
|
||||
radarr_data.indexers.select_index(Some(1));
|
||||
app.data.radarr_data = radarr_data;
|
||||
|
||||
IndexersHandler::new(SUBMIT_KEY, &mut app, ActiveRadarrBlock::Indexers, None).handle();
|
||||
@@ -233,7 +245,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_delete_indexer_prompt_confirm_submit() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.indexers.set_items(vec![indexer()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.indexers
|
||||
.set_items(vec![indexer(), Indexer { id: 2, ..indexer() }]);
|
||||
app.data.radarr_data.indexers.select_index(Some(1));
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::DeleteIndexerPrompt.into());
|
||||
@@ -249,7 +266,7 @@ mod tests {
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::DeleteIndexer(1)
|
||||
&RadarrEvent::DeleteIndexer(2)
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
@@ -523,7 +540,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_delete_indexer_prompt_confirm() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.indexers.set_items(vec![indexer()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.indexers
|
||||
.set_items(vec![indexer(), Indexer { id: 2, ..indexer() }]);
|
||||
app.data.radarr_data.indexers.select_index(Some(1));
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::DeleteIndexerPrompt.into());
|
||||
|
||||
@@ -538,7 +560,7 @@ mod tests {
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::DeleteIndexer(1)
|
||||
&RadarrEvent::DeleteIndexer(2)
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::Indexers.into());
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ mod tests {
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::add_movie_body;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::collection_movie;
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::radarr_models::{AddMovieSearchResult, MinimumAvailability, MovieMonitor};
|
||||
use crate::models::radarr_models::{
|
||||
AddMovieSearchResult, CollectionMovie, MinimumAvailability, MovieMonitor,
|
||||
};
|
||||
use crate::models::servarr_data::radarr::modals::AddMovieModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{ADD_MOVIE_BLOCKS, ActiveRadarrBlock};
|
||||
use crate::models::servarr_models::RootFolder;
|
||||
@@ -942,7 +944,14 @@ mod tests {
|
||||
fn test_add_movie_search_results_submit_movie_already_in_library() {
|
||||
let mut app = App::test_default();
|
||||
let mut add_searched_movies = StatefulTable::default();
|
||||
add_searched_movies.set_items(vec![AddMovieSearchResult::default()]);
|
||||
add_searched_movies.set_items(vec![
|
||||
AddMovieSearchResult {
|
||||
tmdb_id: 5678,
|
||||
..AddMovieSearchResult::default()
|
||||
},
|
||||
AddMovieSearchResult::default(),
|
||||
]);
|
||||
add_searched_movies.select_index(Some(1));
|
||||
app.data.radarr_data.add_searched_movies = Some(add_searched_movies);
|
||||
app
|
||||
.data
|
||||
@@ -1026,16 +1035,22 @@ mod tests {
|
||||
add_movie_modal.root_folder_list.state.select(Some(1));
|
||||
add_movie_modal
|
||||
.quality_profile_list
|
||||
.set_items(vec!["HD - 1080p".to_owned()]);
|
||||
.set_items(vec!["Any".to_owned(), "HD - 1080p".to_owned()]);
|
||||
add_movie_modal
|
||||
.monitor_list
|
||||
.set_items(Vec::from_iter(MovieMonitor::iter()));
|
||||
add_movie_modal
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
add_movie_modal.quality_profile_list.state.select(Some(1));
|
||||
add_movie_modal.monitor_list.state.select(Some(1));
|
||||
add_movie_modal
|
||||
.minimum_availability_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
app.data.radarr_data.add_movie_modal = Some(add_movie_modal);
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(2222, "HD - 1080p".to_owned())]);
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let context = if movie_details_context {
|
||||
app
|
||||
.data
|
||||
@@ -1461,16 +1476,22 @@ mod tests {
|
||||
add_movie_modal.root_folder_list.state.select(Some(1));
|
||||
add_movie_modal
|
||||
.quality_profile_list
|
||||
.set_items(vec!["HD - 1080p".to_owned()]);
|
||||
.set_items(vec!["Any".to_owned(), "HD - 1080p".to_owned()]);
|
||||
add_movie_modal
|
||||
.monitor_list
|
||||
.set_items(Vec::from_iter(MovieMonitor::iter()));
|
||||
add_movie_modal
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
add_movie_modal.quality_profile_list.state.select(Some(1));
|
||||
add_movie_modal.monitor_list.state.select(Some(1));
|
||||
add_movie_modal
|
||||
.minimum_availability_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
app.data.radarr_data.add_movie_modal = Some(add_movie_modal);
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(2222, "HD - 1080p".to_owned())]);
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let context = if movie_details_context {
|
||||
app
|
||||
.data
|
||||
@@ -1572,25 +1593,44 @@ mod tests {
|
||||
add_movie_modal.root_folder_list.state.select(Some(1));
|
||||
add_movie_modal
|
||||
.quality_profile_list
|
||||
.set_items(vec!["HD - 1080p".to_owned()]);
|
||||
.set_items(vec!["Any".to_owned(), "HD - 1080p".to_owned()]);
|
||||
add_movie_modal
|
||||
.monitor_list
|
||||
.set_items(Vec::from_iter(MovieMonitor::iter()));
|
||||
add_movie_modal
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
add_movie_modal.quality_profile_list.state.select(Some(1));
|
||||
add_movie_modal.monitor_list.state.select(Some(1));
|
||||
add_movie_modal
|
||||
.minimum_availability_list
|
||||
.state
|
||||
.select(Some(1));
|
||||
app.data.radarr_data.add_movie_modal = Some(add_movie_modal);
|
||||
app.data.radarr_data.quality_profile_map = BiMap::from_iter([(2222, "HD - 1080p".to_owned())]);
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let context = if movie_details_context {
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collection_movies
|
||||
.set_items(vec![collection_movie()]);
|
||||
app.data.radarr_data.collection_movies.set_items(vec![
|
||||
CollectionMovie {
|
||||
tmdb_id: 5678,
|
||||
title: HorizontallyScrollableText::from("Some Other Movie"),
|
||||
..CollectionMovie::default()
|
||||
},
|
||||
collection_movie(),
|
||||
]);
|
||||
app.data.radarr_data.collection_movies.select_index(Some(1));
|
||||
Some(ActiveRadarrBlock::CollectionDetails)
|
||||
} else {
|
||||
let mut add_searched_movies = StatefulTable::default();
|
||||
add_searched_movies.set_items(vec![add_movie_search_result()]);
|
||||
add_searched_movies.set_items(vec![
|
||||
AddMovieSearchResult {
|
||||
tmdb_id: 5678,
|
||||
title: HorizontallyScrollableText::from("Some Other Movie"),
|
||||
..AddMovieSearchResult::default()
|
||||
},
|
||||
add_movie_search_result(),
|
||||
]);
|
||||
add_searched_movies.select_index(Some(1));
|
||||
app.data.radarr_data.add_searched_movies = Some(add_searched_movies);
|
||||
None
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::radarr_handlers::library::delete_movie_handler::DeleteMovieHandler;
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::movie;
|
||||
use crate::models::radarr_models::DeleteMovieParams;
|
||||
use crate::models::radarr_models::{DeleteMovieParams, Movie};
|
||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, DELETE_MOVIE_BLOCKS};
|
||||
|
||||
mod test_handle_scroll_up_and_down {
|
||||
@@ -131,7 +131,12 @@ mod tests {
|
||||
};
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::DeleteMoviePrompt.into());
|
||||
app.data.radarr_data.movies.set_items(vec![movie()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie { id: 999, ..movie() }, movie()]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
app.data.radarr_data.delete_movie_files = true;
|
||||
app.data.radarr_data.add_list_exclusion = true;
|
||||
@@ -275,7 +280,12 @@ mod tests {
|
||||
};
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::DeleteMoviePrompt.into());
|
||||
app.data.radarr_data.movies.set_items(vec![movie()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie { id: 999, ..movie() }, movie()]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.data.radarr_data.delete_movie_files = true;
|
||||
app.data.radarr_data.add_list_exclusion = true;
|
||||
app.data.radarr_data.selected_block = BlockSelectionState::new(DELETE_MOVIE_SELECTION_BLOCKS);
|
||||
@@ -338,7 +348,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_build_delete_movie_params() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.movies.set_items(vec![movie()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie { id: 999, ..movie() }, movie()]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.data.radarr_data.delete_movie_files = true;
|
||||
app.data.radarr_data.add_list_exclusion = true;
|
||||
let expected_delete_movie_params = DeleteMovieParams {
|
||||
|
||||
@@ -656,18 +656,24 @@ mod tests {
|
||||
edit_movie
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
edit_movie.quality_profile_list.state.select(Some(1));
|
||||
edit_movie.minimum_availability_list.state.select(Some(1));
|
||||
app.data.radarr_data.edit_movie_modal = Some(edit_movie);
|
||||
app.data.radarr_data.movies.set_items(vec![Movie {
|
||||
monitored: false,
|
||||
..movie()
|
||||
}]);
|
||||
app.data.radarr_data.movies.set_items(vec![
|
||||
Movie { id: 999, ..movie() },
|
||||
Movie {
|
||||
monitored: false,
|
||||
..movie()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let expected_edit_movie_params = EditMovieParams {
|
||||
movie_id: 1,
|
||||
monitored: Some(false),
|
||||
minimum_availability: Some(MinimumAvailability::Announced),
|
||||
quality_profile_id: Some(1111),
|
||||
minimum_availability: Some(MinimumAvailability::InCinemas),
|
||||
quality_profile_id: Some(2222),
|
||||
root_folder_path: Some("/nfs/Test Path".to_owned()),
|
||||
tag_input_string: Some("usenet, testing".into()),
|
||||
..EditMovieParams::default()
|
||||
@@ -1089,18 +1095,24 @@ mod tests {
|
||||
edit_movie
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
edit_movie.quality_profile_list.state.select(Some(1));
|
||||
edit_movie.minimum_availability_list.state.select(Some(1));
|
||||
app.data.radarr_data.edit_movie_modal = Some(edit_movie);
|
||||
app.data.radarr_data.movies.set_items(vec![Movie {
|
||||
monitored: false,
|
||||
..movie()
|
||||
}]);
|
||||
app.data.radarr_data.movies.set_items(vec![
|
||||
Movie { id: 999, ..movie() },
|
||||
Movie {
|
||||
monitored: false,
|
||||
..movie()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let expected_edit_movie_params = EditMovieParams {
|
||||
movie_id: 1,
|
||||
monitored: Some(false),
|
||||
minimum_availability: Some(MinimumAvailability::Announced),
|
||||
quality_profile_id: Some(1111),
|
||||
minimum_availability: Some(MinimumAvailability::InCinemas),
|
||||
quality_profile_id: Some(2222),
|
||||
root_folder_path: Some("/nfs/Test Path".to_owned()),
|
||||
tag_input_string: Some("usenet, testing".into()),
|
||||
..EditMovieParams::default()
|
||||
@@ -1177,18 +1189,24 @@ mod tests {
|
||||
edit_movie
|
||||
.minimum_availability_list
|
||||
.set_items(Vec::from_iter(MinimumAvailability::iter()));
|
||||
edit_movie.quality_profile_list.state.select(Some(1));
|
||||
edit_movie.minimum_availability_list.state.select(Some(1));
|
||||
app.data.radarr_data.edit_movie_modal = Some(edit_movie);
|
||||
app.data.radarr_data.movies.set_items(vec![Movie {
|
||||
monitored: false,
|
||||
..movie()
|
||||
}]);
|
||||
app.data.radarr_data.movies.set_items(vec![
|
||||
Movie { id: 999, ..movie() },
|
||||
Movie {
|
||||
monitored: false,
|
||||
..movie()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.data.radarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1111, "Any".to_owned()), (2222, "HD - 1080p".to_owned())]);
|
||||
let expected_edit_movie_params = EditMovieParams {
|
||||
movie_id: 1,
|
||||
monitored: Some(false),
|
||||
minimum_availability: Some(MinimumAvailability::Announced),
|
||||
quality_profile_id: Some(1111),
|
||||
minimum_availability: Some(MinimumAvailability::InCinemas),
|
||||
quality_profile_id: Some(2222),
|
||||
root_folder_path: Some("/nfs/Test Path".to_owned()),
|
||||
tag_input_string: Some("usenet, testing".into()),
|
||||
..EditMovieParams::default()
|
||||
|
||||
@@ -391,6 +391,12 @@ mod tests {
|
||||
fn test_toggle_monitoring_key() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data = create_test_radarr_data();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![movie(), Movie { id: 2, ..movie() }]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
|
||||
app.is_routing = false;
|
||||
|
||||
@@ -407,7 +413,7 @@ mod tests {
|
||||
assert!(app.is_routing);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::ToggleMovieMonitoring(0)
|
||||
&RadarrEvent::ToggleMovieMonitoring(2)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -519,6 +525,48 @@ mod tests {
|
||||
assert!(!app.should_refresh);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_search_movies_key() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie::default()]);
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
|
||||
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.search.key,
|
||||
&mut app,
|
||||
ActiveRadarrBlock::Movies,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::SearchMovie.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_filter_movies_key() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie::default()]);
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Movies.into());
|
||||
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.filter.key,
|
||||
&mut app,
|
||||
ActiveRadarrBlock::Movies,
|
||||
None,
|
||||
)
|
||||
.handle();
|
||||
|
||||
assert_navigation_pushed!(app, ActiveRadarrBlock::FilterMovies.into());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_update_all_movies_prompt_confirm() {
|
||||
let mut app = App::test_default();
|
||||
@@ -621,7 +669,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_extract_movie_id() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.movies.set_items(vec![movie()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![movie(), Movie { id: 2, ..movie() }]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
|
||||
let movie_id = LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
@@ -631,7 +684,7 @@ mod tests {
|
||||
)
|
||||
.extract_movie_id();
|
||||
|
||||
assert_eq!(movie_id, 1);
|
||||
assert_eq!(movie_id, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -17,7 +17,7 @@ mod tests {
|
||||
MovieDetailsHandler, releases_sorting_options,
|
||||
};
|
||||
use crate::handlers::radarr_handlers::radarr_handler_test_utils::utils::{movie, release};
|
||||
use crate::models::radarr_models::{Credit, MovieHistoryItem};
|
||||
use crate::models::radarr_models::{Credit, Movie, MovieHistoryItem};
|
||||
use crate::models::radarr_models::{RadarrRelease, RadarrReleaseDownloadBody};
|
||||
use crate::models::servarr_data::radarr::modals::MovieDetailsModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, MOVIE_DETAILS_BLOCKS};
|
||||
@@ -819,11 +819,22 @@ mod tests {
|
||||
fn test_build_radarr_release_download_body() {
|
||||
let mut app = App::test_default();
|
||||
let mut movie_details_modal = MovieDetailsModal::default();
|
||||
movie_details_modal
|
||||
.movie_releases
|
||||
.set_items(vec![release()]);
|
||||
movie_details_modal.movie_releases.set_items(vec![
|
||||
RadarrRelease {
|
||||
guid: "9999".to_owned(),
|
||||
indexer_id: 99,
|
||||
..release()
|
||||
},
|
||||
release(),
|
||||
]);
|
||||
movie_details_modal.movie_releases.select_index(Some(1));
|
||||
app.data.radarr_data.movie_details_modal = Some(movie_details_modal);
|
||||
app.data.radarr_data.movies.set_items(vec![movie()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie { id: 999, ..movie() }, movie()]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
let expected_body = RadarrReleaseDownloadBody {
|
||||
guid: "1234".to_owned(),
|
||||
indexer_id: 2,
|
||||
@@ -844,7 +855,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_extract_movie_id() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.movies.set_items(vec![movie()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.movies
|
||||
.set_items(vec![Movie { id: 999, ..movie() }, movie()]);
|
||||
app.data.radarr_data.movies.select_index(Some(1));
|
||||
|
||||
let movie_id = MovieDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
|
||||
@@ -475,13 +475,13 @@ pub(in crate::handlers::radarr_handlers) mod utils {
|
||||
tmdb_id: 1234,
|
||||
title: "Test".to_owned(),
|
||||
root_folder_path: "/nfs2".to_owned(),
|
||||
minimum_availability: MinimumAvailability::Announced,
|
||||
minimum_availability: MinimumAvailability::InCinemas,
|
||||
monitored: true,
|
||||
quality_profile_id: 2222,
|
||||
tags: Vec::new(),
|
||||
tag_input_string: Some("usenet, testing".into()),
|
||||
add_options: AddMovieOptions {
|
||||
monitor: MovieMonitor::MovieOnly,
|
||||
monitor: MovieMonitor::MovieAndCollection,
|
||||
search_for_movie: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -314,11 +314,15 @@ mod tests {
|
||||
#[test]
|
||||
fn test_delete_root_folder_prompt_confirm_submit() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.root_folders
|
||||
.set_items(vec![root_folder()]);
|
||||
app.data.radarr_data.root_folders.set_items(vec![
|
||||
root_folder(),
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/nfs2".to_owned(),
|
||||
..root_folder()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.root_folders.select_index(Some(1));
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
app.push_navigation_stack(ActiveRadarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::DeleteRootFolderPrompt.into());
|
||||
@@ -334,7 +338,7 @@ mod tests {
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::DeleteRootFolder(1)
|
||||
&RadarrEvent::DeleteRootFolder(2)
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
@@ -583,11 +587,15 @@ mod tests {
|
||||
#[test]
|
||||
fn test_delete_root_folder_prompt_confirm() {
|
||||
let mut app = App::test_default();
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.root_folders
|
||||
.set_items(vec![root_folder()]);
|
||||
app.data.radarr_data.root_folders.set_items(vec![
|
||||
root_folder(),
|
||||
RootFolder {
|
||||
id: 2,
|
||||
path: "/nfs2".to_owned(),
|
||||
..root_folder()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.root_folders.select_index(Some(1));
|
||||
app.push_navigation_stack(ActiveRadarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::DeleteRootFolderPrompt.into());
|
||||
|
||||
@@ -602,7 +610,7 @@ mod tests {
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::DeleteRootFolder(1)
|
||||
&RadarrEvent::DeleteRootFolder(2)
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::RootFolders.into());
|
||||
}
|
||||
|
||||
@@ -677,10 +677,17 @@ mod tests {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.data.radarr_data.prompt_confirm = true;
|
||||
app.data.radarr_data.tasks.set_items(vec![RadarrTask {
|
||||
task_name: RadarrTaskName::default(),
|
||||
..RadarrTask::default()
|
||||
}]);
|
||||
app.data.radarr_data.tasks.set_items(vec![
|
||||
RadarrTask {
|
||||
task_name: RadarrTaskName::Backup,
|
||||
..RadarrTask::default()
|
||||
},
|
||||
RadarrTask {
|
||||
task_name: RadarrTaskName::RefreshMovie,
|
||||
..RadarrTask::default()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.tasks.select_index(Some(1));
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
@@ -695,7 +702,7 @@ mod tests {
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::StartTask(RadarrTaskName::default())
|
||||
&RadarrEvent::StartTask(RadarrTaskName::RefreshMovie)
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
@@ -891,10 +898,17 @@ mod tests {
|
||||
fn test_system_tasks_start_task_prompt_confirm() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.data.radarr_data.tasks.set_items(vec![RadarrTask {
|
||||
task_name: RadarrTaskName::default(),
|
||||
..RadarrTask::default()
|
||||
}]);
|
||||
app.data.radarr_data.tasks.set_items(vec![
|
||||
RadarrTask {
|
||||
task_name: RadarrTaskName::Backup,
|
||||
..RadarrTask::default()
|
||||
},
|
||||
RadarrTask {
|
||||
task_name: RadarrTaskName::RefreshMovie,
|
||||
..RadarrTask::default()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.tasks.select_index(Some(1));
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
@@ -909,7 +923,7 @@ mod tests {
|
||||
assert!(app.data.radarr_data.prompt_confirm);
|
||||
assert_some_eq_x!(
|
||||
&app.data.radarr_data.prompt_confirm_action,
|
||||
&RadarrEvent::StartTask(RadarrTaskName::default())
|
||||
&RadarrEvent::StartTask(RadarrTaskName::RefreshMovie)
|
||||
);
|
||||
assert_navigation_popped!(app, ActiveRadarrBlock::SystemTasks.into());
|
||||
}
|
||||
@@ -948,10 +962,17 @@ mod tests {
|
||||
#[test]
|
||||
fn test_extract_task_name() {
|
||||
let mut app = App::test_default();
|
||||
app.data.radarr_data.tasks.set_items(vec![RadarrTask {
|
||||
task_name: RadarrTaskName::default(),
|
||||
..RadarrTask::default()
|
||||
}]);
|
||||
app.data.radarr_data.tasks.set_items(vec![
|
||||
RadarrTask {
|
||||
task_name: RadarrTaskName::Backup,
|
||||
..RadarrTask::default()
|
||||
},
|
||||
RadarrTask {
|
||||
task_name: RadarrTaskName::RefreshMovie,
|
||||
..RadarrTask::default()
|
||||
},
|
||||
]);
|
||||
app.data.radarr_data.tasks.select_index(Some(1));
|
||||
|
||||
let task_name = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
@@ -961,7 +982,7 @@ mod tests {
|
||||
)
|
||||
.extract_task_name();
|
||||
|
||||
assert_eq!(task_name, RadarrTaskName::default());
|
||||
assert_eq!(task_name, RadarrTaskName::RefreshMovie);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user