test(api): match detail call by its appended resources
This commit is contained in:
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user