feat(readarr): fetch releases for an author and expose them on the CLI

This commit is contained in:
Dark-Alex-17 committed 2026-08-28 14:15:28 -06:00
1 parent 666084a30f
commit 999a22a37f
6 files changed
+203 -4

No files matched your search

@@ -252,6 +252,40 @@ mod tests {
);
}
#[test]
fn test_list_author_releases_requires_author_id() {
let result =
Cli::command().try_get_matches_from(["managarr", "readarr", "list", "author-releases"]);
assert_err!(&result);
assert_eq!(
result.unwrap_err().kind(),
ErrorKind::MissingRequiredArgument
);
}
#[test]
fn test_list_author_releases_success() {
let expected_args = ReadarrListCommand::AuthorReleases { author_id: 3 };
let result = Cli::try_parse_from([
"managarr",
"readarr",
"list",
"author-releases",
"--author-id",
"3",
]);
assert_ok!(&result);
let Some(Command::Readarr(ReadarrCommand::List(author_releases_command))) =
result.unwrap().command
else {
panic!("Unexpected command type");
};
assert_eq!(author_releases_command, expected_args);
}
#[test]
fn test_list_releases_success() {
let expected_args = ReadarrListCommand::Releases { book_id: 7 };
@@ -757,6 +791,32 @@ mod tests {
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_author_releases_command() {
let expected_author_id = 3;
let mut mock_network = MockNetworkTrait::new();
mock_network
.expect_handle_network_event()
.with(eq::<NetworkEvent>(
ReadarrEvent::GetAuthorReleases(expected_author_id).into(),
))
.times(1)
.returning(|_| {
Ok(Serdeable::Readarr(ReadarrSerdeable::Value(
json!({"testResponse": "response"}),
)))
});
let app_arc = Arc::new(Mutex::new(App::test_default()));
let list_author_releases_command = ReadarrListCommand::AuthorReleases { author_id: 3 };
let result =
ReadarrListCommandHandler::with(&app_arc, list_author_releases_command, &mut mock_network)
.handle()
.await;
assert_ok!(&result);
}
#[tokio::test]
async fn test_handle_list_root_folders_command() {
let mut mock_network = MockNetworkTrait::new();