test: give the CLI indexer settings tests distinct field values
The Radarr, Sonarr and Lidarr tests for editing all indexer settings expected every numeric field to be 1 and returned every previous field as 2. Because the fields were mutually equal, transposing any two of availability_delay, maximum_size, minimum_age, retention and rss_sync_interval in the CLI parameter builder produced an identical request and no test could tell. Radarr additionally expected both boolean flags to hold the same value, hiding a transposition of those two. Readarr already used distinct values and was the model followed here. Verified by transposing minimum_age and retention in all four CLI parameter builders at once: before this change only the two Readarr tests failed, while Radarr, Sonarr and Lidarr stayed green. After it, the same mutation is caught by five tests across the three trees.
This commit is contained in:
3 files changed
+71
-71
No files matched your search
@@ -613,10 +613,10 @@ mod tests {
|
||||
async fn test_handle_edit_all_indexer_settings_command() {
|
||||
let expected_edit_all_indexer_settings = IndexerSettings {
|
||||
id: 1,
|
||||
maximum_size: 1,
|
||||
minimum_age: 1,
|
||||
retention: 1,
|
||||
rss_sync_interval: 1,
|
||||
maximum_size: 12345,
|
||||
minimum_age: 11,
|
||||
retention: 29,
|
||||
rss_sync_interval: 60,
|
||||
};
|
||||
let mut mock_network = MockNetworkTrait::new();
|
||||
mock_network
|
||||
@@ -628,11 +628,11 @@ mod tests {
|
||||
.returning(|_| {
|
||||
Ok(Serdeable::Lidarr(LidarrSerdeable::IndexerSettings(
|
||||
IndexerSettings {
|
||||
id: 1,
|
||||
maximum_size: 2,
|
||||
minimum_age: 2,
|
||||
retention: 2,
|
||||
rss_sync_interval: 2,
|
||||
id: 5,
|
||||
maximum_size: 22222,
|
||||
minimum_age: 34,
|
||||
retention: 48,
|
||||
rss_sync_interval: 90,
|
||||
},
|
||||
)))
|
||||
});
|
||||
@@ -649,10 +649,10 @@ mod tests {
|
||||
});
|
||||
let app_arc = Arc::new(Mutex::new(App::test_default()));
|
||||
let edit_all_indexer_settings_command = LidarrEditCommand::AllIndexerSettings {
|
||||
maximum_size: Some(1),
|
||||
minimum_age: Some(1),
|
||||
retention: Some(1),
|
||||
rss_sync_interval: Some(1),
|
||||
maximum_size: Some(12345),
|
||||
minimum_age: Some(11),
|
||||
retention: Some(29),
|
||||
rss_sync_interval: Some(60),
|
||||
};
|
||||
|
||||
let result = LidarrEditCommandHandler::with(
|
||||
|
||||
@@ -833,13 +833,13 @@ mod tests {
|
||||
async fn test_handle_edit_all_indexer_settings_command() {
|
||||
let expected_edit_all_indexer_settings = IndexerSettings {
|
||||
allow_hardcoded_subs: true,
|
||||
availability_delay: 1,
|
||||
availability_delay: 19,
|
||||
id: 1,
|
||||
maximum_size: 1,
|
||||
minimum_age: 1,
|
||||
maximum_size: 18400,
|
||||
minimum_age: 27,
|
||||
prefer_indexer_flags: true,
|
||||
retention: 1,
|
||||
rss_sync_interval: 1,
|
||||
retention: 44,
|
||||
rss_sync_interval: 60,
|
||||
whitelisted_hardcoded_subs: "test".into(),
|
||||
};
|
||||
let mut mock_network = MockNetworkTrait::new();
|
||||
@@ -853,13 +853,13 @@ mod tests {
|
||||
Ok(Serdeable::Radarr(RadarrSerdeable::IndexerSettings(
|
||||
IndexerSettings {
|
||||
allow_hardcoded_subs: false,
|
||||
availability_delay: 2,
|
||||
id: 1,
|
||||
maximum_size: 2,
|
||||
minimum_age: 2,
|
||||
availability_delay: 31,
|
||||
id: 8,
|
||||
maximum_size: 22750,
|
||||
minimum_age: 52,
|
||||
prefer_indexer_flags: false,
|
||||
retention: 2,
|
||||
rss_sync_interval: 2,
|
||||
retention: 66,
|
||||
rss_sync_interval: 90,
|
||||
whitelisted_hardcoded_subs: "testing".into(),
|
||||
},
|
||||
)))
|
||||
@@ -879,13 +879,13 @@ mod tests {
|
||||
let edit_all_indexer_settings_command = RadarrEditCommand::AllIndexerSettings {
|
||||
allow_hardcoded_subs: true,
|
||||
disable_allow_hardcoded_subs: false,
|
||||
availability_delay: Some(1),
|
||||
maximum_size: Some(1),
|
||||
minimum_age: Some(1),
|
||||
availability_delay: Some(19),
|
||||
maximum_size: Some(18400),
|
||||
minimum_age: Some(27),
|
||||
prefer_indexer_flags: true,
|
||||
disable_prefer_indexer_flags: false,
|
||||
retention: Some(1),
|
||||
rss_sync_interval: Some(1),
|
||||
retention: Some(44),
|
||||
rss_sync_interval: Some(60),
|
||||
whitelisted_subtitle_tags: Some("test".to_owned()),
|
||||
};
|
||||
|
||||
@@ -904,13 +904,13 @@ mod tests {
|
||||
async fn test_handle_edit_all_indexer_settings_command_disable_flags_function_properly() {
|
||||
let expected_edit_all_indexer_settings = IndexerSettings {
|
||||
allow_hardcoded_subs: false,
|
||||
availability_delay: 1,
|
||||
availability_delay: 19,
|
||||
id: 1,
|
||||
maximum_size: 1,
|
||||
minimum_age: 1,
|
||||
maximum_size: 18400,
|
||||
minimum_age: 27,
|
||||
prefer_indexer_flags: false,
|
||||
retention: 1,
|
||||
rss_sync_interval: 1,
|
||||
retention: 44,
|
||||
rss_sync_interval: 60,
|
||||
whitelisted_hardcoded_subs: "test".into(),
|
||||
};
|
||||
let mut mock_network = MockNetworkTrait::new();
|
||||
@@ -924,13 +924,13 @@ mod tests {
|
||||
Ok(Serdeable::Radarr(RadarrSerdeable::IndexerSettings(
|
||||
IndexerSettings {
|
||||
allow_hardcoded_subs: true,
|
||||
availability_delay: 2,
|
||||
id: 1,
|
||||
maximum_size: 2,
|
||||
minimum_age: 2,
|
||||
availability_delay: 31,
|
||||
id: 8,
|
||||
maximum_size: 22750,
|
||||
minimum_age: 52,
|
||||
prefer_indexer_flags: true,
|
||||
retention: 2,
|
||||
rss_sync_interval: 2,
|
||||
retention: 66,
|
||||
rss_sync_interval: 90,
|
||||
whitelisted_hardcoded_subs: "testing".into(),
|
||||
},
|
||||
)))
|
||||
@@ -950,13 +950,13 @@ mod tests {
|
||||
let edit_all_indexer_settings_command = RadarrEditCommand::AllIndexerSettings {
|
||||
allow_hardcoded_subs: false,
|
||||
disable_allow_hardcoded_subs: true,
|
||||
availability_delay: Some(1),
|
||||
maximum_size: Some(1),
|
||||
minimum_age: Some(1),
|
||||
availability_delay: Some(19),
|
||||
maximum_size: Some(18400),
|
||||
minimum_age: Some(27),
|
||||
prefer_indexer_flags: false,
|
||||
disable_prefer_indexer_flags: true,
|
||||
retention: Some(1),
|
||||
rss_sync_interval: Some(1),
|
||||
retention: Some(44),
|
||||
rss_sync_interval: Some(60),
|
||||
whitelisted_subtitle_tags: Some("test".to_owned()),
|
||||
};
|
||||
|
||||
@@ -976,13 +976,13 @@ mod tests {
|
||||
{
|
||||
let expected_edit_all_indexer_settings = IndexerSettings {
|
||||
allow_hardcoded_subs: true,
|
||||
availability_delay: 2,
|
||||
availability_delay: 31,
|
||||
id: 1,
|
||||
maximum_size: 2,
|
||||
minimum_age: 2,
|
||||
prefer_indexer_flags: true,
|
||||
retention: 2,
|
||||
rss_sync_interval: 2,
|
||||
maximum_size: 22750,
|
||||
minimum_age: 52,
|
||||
prefer_indexer_flags: false,
|
||||
retention: 66,
|
||||
rss_sync_interval: 90,
|
||||
whitelisted_hardcoded_subs: "testing".into(),
|
||||
};
|
||||
let mut mock_network = MockNetworkTrait::new();
|
||||
@@ -996,13 +996,13 @@ mod tests {
|
||||
Ok(Serdeable::Radarr(RadarrSerdeable::IndexerSettings(
|
||||
IndexerSettings {
|
||||
allow_hardcoded_subs: true,
|
||||
availability_delay: 2,
|
||||
id: 1,
|
||||
maximum_size: 2,
|
||||
minimum_age: 2,
|
||||
prefer_indexer_flags: true,
|
||||
retention: 2,
|
||||
rss_sync_interval: 2,
|
||||
availability_delay: 31,
|
||||
id: 8,
|
||||
maximum_size: 22750,
|
||||
minimum_age: 52,
|
||||
prefer_indexer_flags: false,
|
||||
retention: 66,
|
||||
rss_sync_interval: 90,
|
||||
whitelisted_hardcoded_subs: "testing".into(),
|
||||
},
|
||||
)))
|
||||
|
||||
@@ -632,10 +632,10 @@ mod tests {
|
||||
async fn test_handle_edit_all_indexer_settings_command() {
|
||||
let expected_edit_all_indexer_settings = IndexerSettings {
|
||||
id: 1,
|
||||
maximum_size: 1,
|
||||
minimum_age: 1,
|
||||
retention: 1,
|
||||
rss_sync_interval: 1,
|
||||
maximum_size: 12345,
|
||||
minimum_age: 13,
|
||||
retention: 21,
|
||||
rss_sync_interval: 60,
|
||||
};
|
||||
let mut mock_network = MockNetworkTrait::new();
|
||||
mock_network
|
||||
@@ -647,11 +647,11 @@ mod tests {
|
||||
.returning(|_| {
|
||||
Ok(Serdeable::Sonarr(SonarrSerdeable::IndexerSettings(
|
||||
IndexerSettings {
|
||||
id: 1,
|
||||
maximum_size: 2,
|
||||
minimum_age: 2,
|
||||
retention: 2,
|
||||
rss_sync_interval: 2,
|
||||
id: 9,
|
||||
maximum_size: 22222,
|
||||
minimum_age: 33,
|
||||
retention: 47,
|
||||
rss_sync_interval: 90,
|
||||
},
|
||||
)))
|
||||
});
|
||||
@@ -668,10 +668,10 @@ mod tests {
|
||||
});
|
||||
let app_arc = Arc::new(Mutex::new(App::test_default()));
|
||||
let edit_all_indexer_settings_command = SonarrEditCommand::AllIndexerSettings {
|
||||
maximum_size: Some(1),
|
||||
minimum_age: Some(1),
|
||||
retention: Some(1),
|
||||
rss_sync_interval: Some(1),
|
||||
maximum_size: Some(12345),
|
||||
minimum_age: Some(13),
|
||||
retention: Some(21),
|
||||
rss_sync_interval: Some(60),
|
||||
};
|
||||
|
||||
let result = SonarrEditCommandHandler::with(
|
||||
|
||||
Reference in new issue
Block a user