feat(meta): resolve IMDb ids against series too
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"movie_results": [],
|
||||
"tv_results": [
|
||||
{
|
||||
"id": 82728,
|
||||
"name": "Bluey",
|
||||
"original_name": "Bluey",
|
||||
"original_language": "en",
|
||||
"first_air_date": "2018-10-01",
|
||||
"overview": "The slice-of-life adventures of an Australian cattle dog.",
|
||||
"poster_path": "/58PmSsz6PEdlVscLE1tRJ7tknU.jpg"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -19,6 +19,7 @@ const MOVIE_UNRELEASED: &str = include_str!("fixtures/movie_unreleased.json");
|
||||
const MOVIE_THEATRICAL_ONLY: &str = include_str!("fixtures/movie_theatrical_only.json");
|
||||
const MOVIE_FUTURE_DIGITAL: &str = include_str!("fixtures/movie_future_digital.json");
|
||||
const SERIES_EXTERNAL_IDS: &str = include_str!("fixtures/series_external_ids.json");
|
||||
const FIND_IMDB_SERIES: &str = include_str!("fixtures/find_imdb_series.json");
|
||||
|
||||
fn client(server: &MockServer) -> TmdbClient {
|
||||
TmdbClient::builder("test-key")
|
||||
@@ -483,6 +484,33 @@ async fn series_external_ids_carries_the_tvdb_id() {
|
||||
assert_eq!(ids.tvdb_id, Some(361_391));
|
||||
}
|
||||
|
||||
/// §9.2: a pasted `tt` id must resolve a series the same way it resolves a
|
||||
/// movie. TMDB answers `/find` with both kinds in one response; the `tv_results`
|
||||
/// half is what this reads.
|
||||
#[tokio::test]
|
||||
async fn find_by_imdb_resolves_series() {
|
||||
let server = MockServer::start().await;
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/3/find/tt7614372"))
|
||||
.and(query_param("external_source", "imdb_id"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_string(FIND_IMDB_SERIES))
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
|
||||
let results = client(&server)
|
||||
.find_by_imdb("tt7614372")
|
||||
.await
|
||||
.expect("lookup succeeds");
|
||||
|
||||
assert!(results.movies.is_empty());
|
||||
assert_eq!(results.series.len(), 1);
|
||||
let series = &results.series[0];
|
||||
assert_eq!(series.tmdb_id, 82_728);
|
||||
assert_eq!(series.title, "Bluey");
|
||||
assert_eq!(series.year(), Some(2018));
|
||||
}
|
||||
|
||||
/// A series TMDB has no TVDB id for stays null rather than zero, so callers
|
||||
/// can tell "unknown" from a real id and fall back to the text query.
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user