Fix test fixtures: two movies can't share FAKE_MOVIE's embedded video
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
FAKE_MOVIE carries a fixed provider_video_id ("abc123"); two different
fake movies both spreading it unmodified and getting ingested in the
same test collide on the real uq_video_provider_source unique
constraint (a video id belongs to exactly one entity). Found by
actually running the tests against Postgres on the devbox -- these
paths were only ever collect-only'd locally before now (no local DB).
Affected: test_movie_recommendations_only_include_already_ingested_movies
and test_ingest_collection_only_links_already_ingested_movies, both of
which ingest two FAKE_MOVIE-derived movies in one test. Fixed by
overriding videos to empty on the second movie in each.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
f1ac072794
commit
29fffc8919
@@ -57,10 +57,18 @@ async def test_ingest_collection_only_links_already_ingested_movies(db_session:
|
||||
already knows about, in release-date order, never fabricate a stub for
|
||||
the other two (section 15)."""
|
||||
|
||||
# 604's videos overridden to empty: FAKE_MOVIE's embedded video has a
|
||||
# fixed provider_video_id, and two different movies both ingesting it
|
||||
# would collide on the real uq_video_provider_source unique constraint.
|
||||
provider = FakeTMDbCollectionProvider(
|
||||
movie_payloads={
|
||||
"603": {**FAKE_MOVIE, "id": 603, "title": "The Matrix"},
|
||||
"604": {**FAKE_MOVIE, "id": 604, "title": "The Matrix Reloaded"},
|
||||
"604": {
|
||||
**FAKE_MOVIE,
|
||||
"id": 604,
|
||||
"title": "The Matrix Reloaded",
|
||||
"videos": {"results": []},
|
||||
},
|
||||
},
|
||||
collection_payload=FAKE_COLLECTION,
|
||||
)
|
||||
|
||||
@@ -188,7 +188,17 @@ async def test_movie_recommendations_only_include_already_ingested_movies(
|
||||
external id (section 15: never fabricate a stub for an unseen entity),
|
||||
and GET .../recommendations must return them in TMDb's ranked order."""
|
||||
|
||||
sequel_payload = {**FAKE_MOVIE, "id": 604, "title": "The Matrix Reloaded"}
|
||||
# videos overridden to empty: FAKE_MOVIE's embedded video has a fixed
|
||||
# provider_video_id, and two different movies both ingesting it would
|
||||
# collide on the real uq_video_provider_source unique constraint --
|
||||
# a video id is only ever attached to one entity, unlike genres/companies
|
||||
# which are legitimately shared.
|
||||
sequel_payload = {
|
||||
**FAKE_MOVIE,
|
||||
"id": 604,
|
||||
"title": "The Matrix Reloaded",
|
||||
"videos": {"results": []},
|
||||
}
|
||||
await ingest_movie(db_session, FakeTMDbProvider(sequel_payload), "604")
|
||||
await db_session.flush()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user