diff --git a/tests/integration/test_collection_ingestion.py b/tests/integration/test_collection_ingestion.py index cb577d7..39d3191 100644 --- a/tests/integration/test_collection_ingestion.py +++ b/tests/integration/test_collection_ingestion.py @@ -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, ) diff --git a/tests/integration/test_movie_ingestion.py b/tests/integration/test_movie_ingestion.py index 47f604d..4a37aa1 100644 --- a/tests/integration/test_movie_ingestion.py +++ b/tests/integration/test_movie_ingestion.py @@ -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()