From 8af85606a0a6cd9c656a6737fd7c4770e7532092 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Sun, 23 Aug 2026 22:22:14 +0100 Subject: [PATCH] test(api): match detail call by its appended resources --- crates/arr-api/src/metadata.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/arr-api/src/metadata.rs b/crates/arr-api/src/metadata.rs index 6ec30e9..1b8bb74 100644 --- a/crates/arr-api/src/metadata.rs +++ b/crates/arr-api/src/metadata.rs @@ -207,7 +207,7 @@ pub async fn series_metadata( mod tests { use super::*; use crate::{router, Upstreams}; - use wiremock::matchers::{method, path}; + use wiremock::matchers::{method, path, query_param}; use wiremock::{Mock, MockServer, ResponseTemplate}; /// App against a mocked TMDB, with a real migrated database so library @@ -275,8 +275,23 @@ mod tests { #[tokio::test] async fn a_movie_metadata_resolves_through_one_detail_call() { let tmdb = MockServer::start().await; + // The add path fetches artwork off `movie()` (#145), which is a + // different query against the same path. Match on the appended + // resources so the count below is the detail call alone. Mock::given(method("GET")) .and(path("/movie/693134")) + .and(query_param("append_to_response", "release_dates")) + .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({ + "id": 693_134, "title": "Dune Part Two", "vote_average": 8.417 + }))) + .mount(&tmdb) + .await; + Mock::given(method("GET")) + .and(path("/movie/693134")) + .and(query_param( + "append_to_response", + "credits,videos,external_ids", + )) .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({ "id": 693_134, "overview": "Paul Atreides unites with the Fremen.",