"""conftest.""" import json from datetime import datetime from typing import Any, Generator from uuid import UUID import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from syrupy.assertion import SnapshotAssertion from delivery_metadata.api.main import app as _app # type: ignore[attr-defined] from delivery_metadata.clients.art_relations.distribution_features import ( DistributionFeatures, ) from delivery_metadata.clients.art_relations.product import ArtRelationsProduct from delivery_metadata.clients.art_relations.product_localized_metadata import ( ArtRelationsProductLocalizedMetadata, ) from delivery_metadata.clients.art_relations.product_provided_store_artists import ( ArtRelationsProductProvidedStoreArtists, ) from delivery_metadata.clients.art_relations.product_video import ( ArtRelationsProductVideo, ) from delivery_metadata.clients.art_relations.schemas import ArtRelationsArtist from delivery_metadata.clients.art_relations.store_customer import ( ArtRelationsStoreCustomer, ) from delivery_metadata.clients.art_relations.track import ArtRelationsTrack from delivery_metadata.clients.art_relations.track_localized_metadata import ( ArtRelationsTrackLocalizedMetadata, ) from delivery_metadata.clients.art_relations.track_publisher import ( ArtRelationsTrackPublisher, ) from delivery_metadata.clients.art_relations.track_writer import ArtRelationsTrackWriter from delivery_metadata.clients.direct_delivery.dms_encoding_profiles import ( AudioDmsEncodingProfile, ImageDmsEncodingProfile, MetadataDmsEncodingProfile, VideoDmsEncodingProfile, ) from delivery_metadata.clients.graphql.product import GraphQlProduct from delivery_metadata.clients.ows_territories.territory import ( Pagination, Territory, TerritoryResponse, ) from delivery_metadata.clients.ows_timed_release.timed_release import ( ProductTimedReleaseByStore, StaggeredTimedRelease, TimedRelease, TimedTimedRelease, UnsupportedTimedRelease, ) from delivery_metadata.clients.ows_track.instant_grats import InstantGrats from delivery_metadata.clients.ows_track.performer import ( Performer, TrackPerformer, TrackPerformerResponse, TrackPerformerRoleResponse, ) from delivery_metadata.constants import ( AssetType, DeliveryType, DistributionContext, DistributionFeatureId, DistributionFormatId, DistributionTypeId, DownloadStreamRights, EncodingProfileType, InstrumentRole, LyricsExplicitness, ParticipantRole, ProductTypeId, StoreIds, TrackOfferType, TrackTypes, store_setting_overrides, ) from delivery_metadata.constants.ddex import ( ORCHARD_PARTY_ID, ORCHARD_PARTY_NAME, ) from delivery_metadata.models.delivery_metadata import ( get_staggered_release_by_dms, get_timed_release_by_dms, ) from delivery_metadata.models.delivery_rights import ( DeliveryRights, TerritoryRights, ) from delivery_metadata.models.schemas import ( ArtworkAsset, AudioAsset, CopyrightLine, CustomPricing, Delivery, DeliveryMetadata, GenreMapping, LocalizedMetadata, Participant, ParticipantFullnameLocalization, Product, ProductAudio, ProductVideo, ReleasePricing, Store, TerritoryCodeA2, TerritoryDates, Track, TrackReleasePricing, ) from tests.unit.snapshot_extension import PydanticAmberSnapshotExtension @pytest.fixture def snapshot(snapshot: SnapshotAssertion) -> SnapshotAssertion: return snapshot.use_extension(PydanticAmberSnapshotExtension) @pytest.fixture def app() -> Generator[FastAPI, None, None]: yield _app @pytest.fixture def test_client(app: FastAPI) -> Generator[TestClient, None, None]: """Fastapi test client fixture.""" with TestClient(app) as client: yield client def _deep_update_dict(dict_object: dict[str, Any], keys: list[str], value: Any) -> None: if not isinstance(dict_object, dict): dict_object = dict_object.__dict__ if len(keys) == 1: dict_object[keys[0]] = value else: key = keys[0] if key not in dict_object: dict_object[key] = {} _deep_update_dict(dict_object[key], keys[1:], value) def update_mock_object( target_object: Any, object_type: type, updates: dict[str, Any] | None = None ) -> Any: """Update object_type mock with case-specific fields. Usage: updates = { "nested.path.to.key1": update_value, "nested.path.to.key2": update_value, ..., } updated_mock = update_store_mock(store_mock, updates) """ if not updates: return target_object object_dict = target_object.__dict__ # Deep update the nested DeliveryMetadata dict with updates for key, value in updates.items(): nested_keys = key.split(".") _deep_update_dict(object_dict, nested_keys, value) return object_type(**object_dict) @pytest.fixture def ows_carveouts_territory_rights_mock() -> list[TerritoryCodeA2]: return [TerritoryCodeA2(country_code=x) for x in ["FR", "CA", "US"]] @pytest.fixture def ows_territories_response_mock() -> TerritoryResponse: return TerritoryResponse( items=[ Territory( orch_id=1, standard="ISO_3166_1_2016", territory_name="United States of America", territory_code_a2="US", territory_code_a3="USA", territory_code_numeric=840, continent="North America", ), ], pagination=Pagination(type="standard", offset=0, limit=1000, total_records=1), ) @pytest.fixture def art_relations_territory_dates_mock() -> list[TerritoryDates]: return get_art_relations_territory_dates_mock() def get_art_relations_territory_dates_mock() -> list[TerritoryDates]: return [ TerritoryDates( country_code="SE", country_release_date="2024-08-12", country_sale_start_date="2024-08-12", country_preorder_date="2024-08-10", ), TerritoryDates( country_code="US", country_release_date="2024-08-10", country_sale_start_date="2024-08-10", country_preorder_date="2024-08-08", ), ] @pytest.fixture def art_relations_product_mock() -> ArtRelationsProduct: return get_art_relations_product_mock() def get_art_relations_product_mock() -> ArtRelationsProduct: return ArtRelationsProduct( product_id=4953147, upc=75679660923, display_upc="075679660923", product_type_id=ProductTypeId.MUSIC, original_release_date="2024-08-12", release_date="2024-08-12", sale_start_date="2024-08-12", preorder_date="2024-08-10", product_name="Test product", delivered_version="", release_grid=None, metadata_language_ietf_rfc_5646_code="en", distribution_format_id=DistributionFormatId.DIGITAL_AUDIO, product_code="Product code", release_sony_product_no=None, vendor_catalog_number=None, genre_id=3, genre_name="Metal", subgenre_id=36, subgenre_name="Alternative", p_line="2021 Unidentified Fruit Label", c_line="2021 BRAT Label", imprint="imprint label", distribution_context=DistributionContext.DIGITAL, ioda_release_id=3452323, project_id=34123, vendor_id=7123, vendor_owner="orchard", ) @pytest.fixture def art_relations_tracks_mock() -> list[ArtRelationsTrack]: return get_art_relations_tracks_mock([TrackTypes.MUSIC]) @pytest.fixture def art_relations_video_tracks_mock() -> list[ArtRelationsTrack]: return get_art_relations_tracks_mock([TrackTypes.VIDEO]) def get_art_relations_tracks_mock( track_types: list[TrackTypes], ) -> list[ArtRelationsTrack]: if not track_types: track_types = [TrackTypes.MUSIC] tracks = [ ArtRelationsTrack( track_id=12345, upc=75679660923, isrc="USAT22403171", volume_number=1, track_number=1, track_name="Volume 1 Track 1", track_version=None, duration_seconds=14, preview_start_time_seconds=0, lyrics_explicitness=LyricsExplicitness.CLEAN, p_line="2024 Some Label", track_type=TrackTypes.MUSIC, language_of_performance_ietf_rfc_5646_code=None, offer_type=TrackOfferType.ALL, spatial_isrc="USAT22403181", ), ArtRelationsTrack( track_id=12347, upc=75679660923, isrc="USAT22403172", volume_number=1, track_number=2, track_name="Volume 1 Track 2", track_version=None, duration_seconds=120, preview_start_time_seconds=0, lyrics_explicitness=LyricsExplicitness.EXPLICIT, p_line="2022 Cool Label", track_type=TrackTypes.MUSIC, language_of_performance_ietf_rfc_5646_code="zxx", offer_type=TrackOfferType.TRACK_DOWNLOAD_STREAM, spatial_isrc=None, ), ArtRelationsTrack( track_id=123410, upc=75679660923, isrc="USAT22403175", volume_number=1, track_number=3, track_name="Volume 1 Track 3", track_version=None, duration_seconds=128, preview_start_time_seconds=0, lyrics_explicitness=LyricsExplicitness.EXPLICIT, p_line="2022 Cool Label", track_type=TrackTypes.MUSIC, language_of_performance_ietf_rfc_5646_code="zxx", offer_type=TrackOfferType.TRACK_DOWNLOAD_STREAM, spatial_isrc=None, ), ArtRelationsTrack( track_id=12348, upc=75679660923, isrc="USAT22403173", volume_number=2, track_number=1, track_name="Volume 2 Track 1", track_version=None, duration_seconds=210, preview_start_time_seconds=35, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, p_line="ASDF Label", track_type=TrackTypes.MUSIC, language_of_performance_ietf_rfc_5646_code="zh", offer_type=TrackOfferType.STREAM_ONLY, spatial_isrc=None, ), ArtRelationsTrack( track_id=12349, upc=75679660923, isrc="USAT22403174", volume_number=2, track_number=2, track_name="Volume 2 Track 2", track_version="Cool Version", duration_seconds=180, preview_start_time_seconds=170, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, p_line="2021 Unidentified Fruit Label", track_type=TrackTypes.MUSIC, language_of_performance_ietf_rfc_5646_code="bgc", offer_type=TrackOfferType.ALL, spatial_isrc=None, ), ArtRelationsTrack( track_id=123412, upc=75679660923, isrc="USAT22403176", volume_number=2, track_number=3, track_name="Volume 2 Track 3", track_version=None, duration_seconds=180, preview_start_time_seconds=170, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, p_line="2021 Unidentified Fruit Label", track_type=TrackTypes.MUSIC, language_of_performance_ietf_rfc_5646_code="bgc", offer_type=TrackOfferType.ALL, spatial_isrc=None, ), ArtRelationsTrack( track_id=123413, upc=75679660923, isrc="USAT22403177", volume_number=1, track_number=4, track_name="Volume 1 Track 4", track_version=None, duration_seconds=180, preview_start_time_seconds=170, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, p_line="2021 Unidentified Fruit Label", track_type=TrackTypes.VIDEO, language_of_performance_ietf_rfc_5646_code="bgc", offer_type=TrackOfferType.ALL, spatial_isrc=None, ), ] return [track for track in tracks if track.track_type in track_types] @pytest.fixture def art_relations_track_artists_mock() -> dict[int, list[ArtRelationsArtist]]: return get_art_relations_track_artists_mock() def get_art_relations_track_artists_mock() -> dict[int, list[ArtRelationsArtist]]: return { 12345: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Smaller Star", role=ParticipantRole.FEATURING, is_feature_to_primary=True, ), ], 12347: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Very Big Star 2", role=ParticipantRole.PERFORMER, ), ], 123410: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Some European Remixer", role=ParticipantRole.REMIXER, ), ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PRODUCER, ), ], 12348: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Big Time Producer", role=ParticipantRole.PRODUCER, ), ], 12349: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ], 123412: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Smaller Star", role=ParticipantRole.FEATURING, ), ], 123413: [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Smaller Star", role=ParticipantRole.FEATURING, ), ], } @pytest.fixture def art_relations_release_artists_mock() -> list[ArtRelationsArtist]: return get_art_relations_release_artists_mock() def get_art_relations_release_artists_mock() -> list[ArtRelationsArtist]: return [ ArtRelationsArtist( fullname="Very Big Star", role=ParticipantRole.PERFORMER, ), ArtRelationsArtist( fullname="Smaller Star", role=ParticipantRole.FEATURING, is_feature_to_primary=True, ), ArtRelationsArtist( fullname="Big Time Producer", role=ParticipantRole.PRODUCER, ), ] @pytest.fixture def art_relations_product_provided_store_artists_mock() -> ( ArtRelationsProductProvidedStoreArtists ): return get_art_relations_product_provided_store_artists_mock() def get_art_relations_product_provided_store_artists_mock() -> ( ArtRelationsProductProvidedStoreArtists ): return ArtRelationsProductProvidedStoreArtists(spotify="Y") @pytest.fixture def art_relations_store_customer_mock() -> ArtRelationsStoreCustomer: return get_art_relations_store_customer_mock(StoreIds.NO_STORE) def get_art_relations_store_customer_mock( store_id: int | None, ) -> ArtRelationsStoreCustomer: match store_id: case StoreIds.AMAZON: return ArtRelationsStoreCustomer( customer_name="Amazon", ddex_party_id="PADPIDA20110217043", supports_localization="Y", instant_grat="Y", is_user_defined_contributors_supported="N", ) case StoreIds.SPOTIFY: return ArtRelationsStoreCustomer( customer_name="Spotify", ddex_party_id="PADPIDA2008111701W", supports_localization="N", instant_grat=None, is_user_defined_contributors_supported="Y", ) case StoreIds.LIBRARY_IDEAS_FREEGAL: return ArtRelationsStoreCustomer( customer_name="Library Ideas / Freegal", ddex_party_id="PADPIDA2008111701W", supports_localization="N", instant_grat=None, is_user_defined_contributors_supported="Y", ) case StoreIds.NO_STORE: return ArtRelationsStoreCustomer( customer_name="LooneyTunez", ddex_party_id="PADPIDAthisIsaParty", supports_localization="N", instant_grat=None, is_user_defined_contributors_supported="Y", ) case StoreIds.VEVO: return ArtRelationsStoreCustomer( customer_name="Vevo", ddex_party_id="PADPIDAVEVOparty", supports_localization="N", instant_grat=None, is_user_defined_contributors_supported="N", ) case _: raise NotImplementedError(f"Store ID: {store_id} not configured") @pytest.fixture def art_relations_track_publisher_mock() -> dict[int, list[ArtRelationsTrackPublisher]]: return get_art_relations_track_publisher_mock() def get_art_relations_track_publisher_mock() -> dict[ int, list[ArtRelationsTrackPublisher] ]: return { 12345: [ ArtRelationsTrackPublisher( fullname="Fire Pubs", ), ArtRelationsTrackPublisher( fullname="Very Big Star", ), ], 12347: [ ArtRelationsTrackPublisher( fullname="Fire Pubs", ), ArtRelationsTrackPublisher( fullname="Pubbz House", ), ], 123410: [ ArtRelationsTrackPublisher( fullname="Fire Pubs", ), ], 12348: [ ArtRelationsTrackPublisher( fullname="Fire Pubs", ), ], 12349: [ ArtRelationsTrackPublisher( fullname="Fire Pubs", ), ArtRelationsTrackPublisher( fullname="Publishing Co.", ), ], 123412: [ ArtRelationsTrackPublisher( fullname="Fire Pubs", ), ], } @pytest.fixture def art_relations_track_writers_mock() -> dict[int, list[ArtRelationsTrackWriter]]: return get_art_relations_track_writers_mock() def get_art_relations_track_writers_mock() -> dict[int, list[ArtRelationsTrackWriter]]: return { 12345: [ ArtRelationsTrackWriter( fullname="Connie Blair", ), ArtRelationsTrackWriter( fullname="Florence", ), ArtRelationsTrackWriter( fullname="Very Big Star", ), ], 12347: [ ArtRelationsTrackWriter( fullname="Jimmy Alpine", ), ], 123410: [ ArtRelationsTrackWriter( fullname="Jimmy Alpine", ) ], 12348: [ ArtRelationsTrackWriter( fullname="Gina George", ), ArtRelationsTrackWriter( fullname="JJ Lemon", ), ArtRelationsTrackWriter( fullname="Flamez", ), ], 12349: [ ArtRelationsTrackWriter( fullname="Flamez", ), ], 123412: [ ArtRelationsTrackWriter( fullname="JJ Lemon", ), ], } @pytest.fixture def distribution_features_mock() -> dict[int, list[DistributionFeatures]]: return { StoreIds.NO_STORE: [ DistributionFeatures( distribution_feature_ids={ DistributionFeatureId.A_LA_CARTE_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_STREAMING, DistributionFeatureId.SUBSCRIPTION_PORTABLE_TETHERED, DistributionFeatureId.OTA_INCLUDING_DUAL_DELIVERY, DistributionFeatureId.OTA_WITH_RINGTONE_USE, DistributionFeatureId.STREAMING_SUBSCRIPTION_TO_MOBILE, DistributionFeatureId.STREAMING_ON_DEMAND_TO_MOBILE, DistributionFeatureId.AD_SUPPORTED_STREAMING, }, distribution_type_id=DistributionTypeId.FULL_TRACK, ), DistributionFeatures( distribution_feature_ids={ DistributionFeatureId.RINGBACK_TONES, DistributionFeatureId.RINGTONES, }, distribution_type_id=DistributionTypeId.TONE, ), ], StoreIds.SPOTIFY: [ DistributionFeatures( distribution_feature_ids={ DistributionFeatureId.SUBSCRIPTION_STREAMING, }, distribution_type_id=DistributionTypeId.FULL_TRACK, ), ], StoreIds.AMAZON: [ DistributionFeatures( distribution_feature_ids={ DistributionFeatureId.SUBSCRIPTION_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_STREAMING, }, distribution_type_id=DistributionTypeId.FULL_TRACK, ), ], StoreIds.LIBRARY_IDEAS_FREEGAL: [ DistributionFeatures( distribution_feature_ids={ DistributionFeatureId.A_LA_CARTE_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_STREAMING, }, distribution_type_id=DistributionTypeId.FULL_TRACK, ), ], } def get_distribution_rights_mock(track_id: int) -> set[DownloadStreamRights]: match track_id: case 12345 | 12347 | 123410 | 12349 | 123412 | 123413: return { DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, } case 12348: return {DownloadStreamRights.STREAM} case _: return set() @pytest.fixture def store_mock() -> Store: return get_store_mock(StoreIds.NO_STORE, [TrackTypes.MUSIC]) def get_store_mock( store_id: int, track_types: list[TrackTypes], store_setting: dict[int, dict[str, Any]] | None = None, ) -> Store: art_relations_store_customer_mock = get_art_relations_store_customer_mock(store_id) art_relations_product_provided_store_artists_mock = ( get_art_relations_product_provided_store_artists_mock() ) store_settings = store_setting or store_setting_overrides store_data: dict[str, Any] = { "store_id": store_id, "sender_ddex_party_id": ORCHARD_PARTY_ID, "sender_ddex_party_name": ORCHARD_PARTY_NAME, "recipient_ddex_party_id": art_relations_store_customer_mock.ddex_party_id, "recipient_ddex_party_name": art_relations_store_customer_mock.customer_name, "image_encoding_profiles": [ ImageDmsEncodingProfile( delivery_location_template="{display_upc}/resources", filename_template="{display_upc}.tif", placeholder_hashcode_template="[MD5]{display_upc}.tif", hashcode_algorithm="MD5", format="tif", profile_subtype="tif", width=3000, height=3000, ), ], "audio_encoding_profiles": ( [ AudioDmsEncodingProfile( delivery_location_template="{display_upc}/resources", filename_template="{display_upc}_{cd}_{track_id}.flac", placeholder_hashcode_template="[MD5]{display_upc}_{cd}_{track_id}.flac", hashcode_algorithm="MD5", number_of_audio_channels=2, format="flac", profile_subtype="flac16", clip_length=None, bitrate=None, frequency=44100, bits_per_sample=16, ), AudioDmsEncodingProfile( delivery_location_template="{display_upc}/resources", filename_template="{display_upc}_{cd}_{track_id}.wav", placeholder_hashcode_template="[MD5]{display_upc}_{cd}_{track_id}.wav", hashcode_algorithm="MD5", number_of_audio_channels=2, format="wav", profile_subtype="atmos", clip_length=None, bitrate=None, frequency=88200, bits_per_sample=48, ), AudioDmsEncodingProfile( delivery_location_template="{display_upc}/resources", filename_template="{display_upc}_{cd}_{track_id}.mp3", placeholder_hashcode_template="[MD5]{display_upc}_{cd}_{track_id}.mp3", hashcode_algorithm="MD5", number_of_audio_channels=2, format="mp3", profile_subtype="mp3_standard", clip_length=None, bitrate=192000, frequency=44100, bits_per_sample=None, ), AudioDmsEncodingProfile( delivery_location_template="{display_upc}/resources", filename_template="{display_upc}_{cd}_{track_id}_clip.mp3", placeholder_hashcode_template=( "[MD5]{display_upc}_{cd}_{track_id}_clip.mp3" ), hashcode_algorithm="MD5", number_of_audio_channels=2, format="mp3", profile_subtype="mp3_standard", clip_length=30, bitrate=192000, frequency=44100, bits_per_sample=None, ), ] if TrackTypes.MUSIC in track_types else None ), "metadata_encoding_profiles": [ MetadataDmsEncodingProfile( delivery_location_template="{display_upc}", placeholder_hashcode_template=None, filename_template="{display_upc}.xml", hashcode_algorithm="MD5", format="xml", profile_subtype="Ddex XML", ), ], "video_encoding_profiles": ( [ VideoDmsEncodingProfile( delivery_location_template="{display_upc}/resources", placeholder_hashcode_template="[MD5]{display_upc}_{cd}_{track_id}.mov", filename_template="{display_upc}_{cd}_{track_id}.mov", hashcode_algorithm="MD5", format="mov", profile_subtype="video", ) ] if TrackTypes.VIDEO in track_types else None ), "video_image_encoding_profiles": ( [ ImageDmsEncodingProfile( delivery_location_template="{display_upc}/resources", filename_template="{display_upc}_{isrc}.jpg", placeholder_hashcode_template="[MD5]{display_upc}_{isrc}.jpg", hashcode_algorithm="MD5", format="jpg", profile_subtype="JPG video image", width=300, height=200, ) ] if TrackTypes.VIDEO in track_types else None ), "product_provided_store_artists": ( art_relations_product_provided_store_artists_mock.spotify ), "distribution_feature_ids": get_store_features_mock(store_id), "is_localization_supported": ( art_relations_store_customer_mock.supports_localization == "Y" ), "is_instant_gratification_supported": ( art_relations_store_customer_mock.instant_grat == "Y" ), "is_user_defined_contributors_supported": ( art_relations_store_customer_mock.is_user_defined_contributors_supported == "Y" ), } store_data.update(store_settings.get(store_id, {})) return Store(**store_data) def get_tracks_mock( track_types: list[TrackTypes], store: Store, ) -> list[Track]: track_assets = get_product_assets_mock()["track_assets"] return [ Track( track_id=track.track_id, volume_number=track.volume_number, track_number=track.track_number, preview_start_time_seconds=track.preview_start_time_seconds, duration_seconds=track.duration_seconds, track_type=track.track_type, lyrics_explicitness=track.lyrics_explicitness, upc=track.upc, isrc=track.isrc, p_line=_get_mock_copyright_line(track.p_line), track_name=track.track_name, track_version=track.track_version, language_of_performance_ietf_rfc_5646_code=( track.language_of_performance_ietf_rfc_5646_code ), participants=_get_track_participants_mock(track.track_id, store), offer_type=track.offer_type, distribution_rights=get_distribution_rights_mock(track.track_id), track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR" ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR" ), start_date=None, end_date=None, ), }, localized_metadata=( get_localized_metadata_mock(track.track_id) if store.is_localization_supported else [] ), instant_grats=get_track_instant_grats_mock(track.track_id, store), assets=track_assets.get(track.track_id, []), # type: ignore[arg-type, union-attr] spatial_isrc=track.spatial_isrc, ) for track in get_art_relations_tracks_mock(track_types) ] def get_tracks_mock_no_pricing( track_types: list[TrackTypes], store: Store, ) -> list[Track]: track_assets = get_product_assets_mock()["track_assets"] return [ Track( track_id=track.track_id, volume_number=track.volume_number, track_number=track.track_number, preview_start_time_seconds=track.preview_start_time_seconds, duration_seconds=track.duration_seconds, track_type=track.track_type, lyrics_explicitness=track.lyrics_explicitness, upc=track.upc, isrc=track.isrc, p_line=_get_mock_copyright_line(track.p_line), track_name=track.track_name, track_version=track.track_version, language_of_performance_ietf_rfc_5646_code=( track.language_of_performance_ietf_rfc_5646_code ), participants=_get_track_participants_mock(track.track_id, store), offer_type=track.offer_type, distribution_rights=get_distribution_rights_mock(track.track_id), track_territory_pricing=set(), localized_metadata=( get_localized_metadata_mock(track.track_id) if store.is_localization_supported else [] ), instant_grats=get_track_instant_grats_mock(track.track_id, store), assets=track_assets.get(track.track_id, []), # type: ignore[arg-type, union-attr] spatial_isrc=track.spatial_isrc, ) for track in get_art_relations_tracks_mock(track_types) ] def get_track_mock_no_pricing_by_track_id( track_types: list[TrackTypes], store: Store, track_id: int, ) -> Track: tracks = get_tracks_mock_no_pricing(track_types, store) for track in tracks: if track.track_id == track_id: return track raise ValueError(f"Track with ID {track_id} not found in mock.") def get_track_instant_grats_mock(track_id: int, store: Store) -> InstantGrats | None: if not store.is_instant_gratification_supported: return None match track_id: case 12345: return InstantGrats( tuid=12345, store_id=store.store_id, date="2024-08-10T00:00:00", active="Y", ) case 12349: return InstantGrats( tuid=12349, store_id=store.store_id, date="2024-08-11T00:00:00", active="Y", ) case _: return None def get_audio_track_mock_no_pricing_by_track_id(track_id: int, store: Store) -> Track: tracks = get_tracks_mock_no_pricing([TrackTypes.MUSIC], store) for track in tracks: if track.track_id == track_id: return track raise ValueError(f"Track with ID {track_id} not found in mock.") def get_sorted_tracks_mock( track_types: list[TrackTypes], store: Store, ) -> list[Track]: tracks = ( get_tracks_mock( track_types, store, ) if store.is_pricing_supported else get_tracks_mock_no_pricing( track_types, store, ) ) return sorted( tracks, key=lambda t: (t.volume_number, t.track_number), ) def _get_mock_copyright_line(copyright_line: str) -> CopyrightLine: match copyright_line: case "2024 Some Label": return CopyrightLine( year="2024", text="2024 Some Label", ) case "2022 Cool Label": return CopyrightLine( year="2022", text="2022 Cool Label", ) case "ASDF Label": return CopyrightLine( year=None, text="ASDF Label", ) case "2021 Unidentified Fruit Label": return CopyrightLine( year="2021", text="2021 Unidentified Fruit Label", ) case _: return CopyrightLine(year=None, text="") def _get_audio_product_participants_mock( store: Store, ) -> list[Participant]: participants = [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Smaller Star", roles=( {ParticipantRole.PERFORMER} if store.is_feature_to_primary_artist_supported else {ParticipantRole.FEATURING} ), instruments=set(), label_participant_id=UUID("48392034-4859-5948-0120-023948762100"), apple_music_id=None, spotify_id="5245ndfj34kejrfdsfv", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Big Time Producer", roles={ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=UUID("ef01a90b-d3a3-45cb-9958-55dcf728f76e"), apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ] return participants def _get_video_product_participants_mock( store: Store, ) -> list[Participant]: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Smaller Star", roles=( {ParticipantRole.PERFORMER} if store.is_feature_to_primary_artist_supported else {ParticipantRole.FEATURING} ), instruments=set(), label_participant_id=UUID("48392034-4859-5948-0120-023948762100"), apple_music_id=None, spotify_id="5245ndfj34kejrfdsfv", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="JJ Lemon", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10292034-5555-5948-0120-023948762100"), apple_music_id="eeeewwwww99999", spotify_id="wwwwweeeee99999", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ] def _get_track_participants_mock( track_id: int, store: Store, ) -> list[Participant]: match track_id: case 12345: return [ Participant( fullname="Very Big Star", roles={ ParticipantRole.LEAD_VOCALIST, ParticipantRole.PUBLISHER, ParticipantRole.PERFORMER, ParticipantRole.TRACK_WRITER, }, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Smaller Star", roles=( {ParticipantRole.PERFORMER} if store.is_feature_to_primary_artist_supported else {ParticipantRole.FEATURING} ), instruments={InstrumentRole.PERCUSSION_CONGAS}, label_participant_id=UUID("48392034-4859-5948-0120-023948762100"), apple_music_id=None, spotify_id="5245ndfj34kejrfdsfv", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Connie Blair", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("12392034-1111-5948-0120-023948762100"), apple_music_id=None, spotify_id="wwwwweeeee555555", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Florence", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("45692034-1111-5948-0120-023948762100"), apple_music_id=None, spotify_id="wwwwweeeee666666", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), ] case 12347: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER, ParticipantRole.VOCALS_RAPPER}, instruments={InstrumentRole.PERCUSSION_GUIRO}, label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Very Big Star 2", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("59596847-3748-1923-4002-388849057321"), apple_music_id="2257874534hfvsldjkf", spotify_id="79bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056790"), fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Pubbz House", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Jimmy Alpine", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("78992034-3333-5948-0120-023948762100"), apple_music_id="eeeewwwww7777777", spotify_id="wwwwweeeee777777", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), ] case 123410: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER, ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Some European Remixer", roles={ParticipantRole.REMIXER}, instruments=set(), label_participant_id=UUID("59595847-3748-1923-4002-388849057421"), apple_music_id="45t34rij34", spotify_id="34rjn34r34", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("82945678-4567-1923-4011-567891056790"), fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Jimmy Alpine", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("78992034-3333-5948-0120-023948762100"), apple_music_id="eeeewwwww7777777", spotify_id="wwwwweeeee777777", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), ] case 12348: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Big Time Producer", roles={ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=UUID("ef01a90b-d3a3-45cb-9958-55dcf728f76e"), apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Gina George", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10192034-4444-5948-0120-023948762100"), apple_music_id="eeeewwwww888888", spotify_id="wwwwweeeee888888", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="JJ Lemon", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10292034-5555-5948-0120-023948762100"), apple_music_id="eeeewwwww99999", spotify_id="wwwwweeeee99999", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Flamez", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10392034-6666-5948-0120-023948762100"), apple_music_id="eeeewwwww1111111", spotify_id="wwwwweeeee1111111", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), ] case 12349: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Publishing Co.", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Flamez", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10392034-6666-5948-0120-023948762100"), apple_music_id="eeeewwwww1111111", spotify_id="wwwwweeeee1111111", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Brass Player", roles=set(), instruments={InstrumentRole.BRASS_BUGLE}, label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ] case 123412: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Smaller Star", roles={ParticipantRole.FEATURING}, instruments=set(), label_participant_id=UUID("48392034-4859-5948-0120-023948762100"), apple_music_id=None, spotify_id="5245ndfj34kejrfdsfv", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="JJ Lemon", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10292034-5555-5948-0120-023948762100"), apple_music_id="eeeewwwww99999", spotify_id="wwwwweeeee99999", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), ] case 123413: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=UUID("48596847-3748-1923-4002-388849057321"), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", spotify_artist_key="spotify_artist_key", global_participant_id=UUID("32945678-4567-1923-4002-567891056789"), fullname_localizations=frozenset(), ), Participant( fullname="Smaller Star", roles={ParticipantRole.FEATURING}, instruments=set(), label_participant_id=UUID("48392034-4859-5948-0120-023948762100"), apple_music_id=None, spotify_id="5245ndfj34kejrfdsfv", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="JJ Lemon", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=UUID("10292034-5555-5948-0120-023948762100"), apple_music_id="eeeewwwww99999", spotify_id="wwwwweeeee99999", spotify_artist_key="spotify_artist_key", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ] case _: return [] @pytest.fixture def delivery_metadata_mock() -> DeliveryMetadata: """DeliveryMetadata mock.""" store = get_store_mock(StoreIds.NO_STORE, [TrackTypes.MUSIC]) return get_delivery_metadata_mock_by_store(store, [TrackTypes.MUSIC]) def get_delivery_metadata_mock_by_store( store: Store, track_types: list[TrackTypes] ) -> DeliveryMetadata: product: Product = get_product_audio_mock(store, track_types) if TrackTypes.VIDEO in track_types: product_dict = dict(product) product_dict["participants"] = _get_video_product_participants_mock(store) product = ProductVideo( **product_dict, channel_selection=None, description=None, type_of_video="short form", keywords=None, associated_track_isrc="US224SD03176", ) return DeliveryMetadata( product=product, delivery=Delivery( delivery_type=DeliveryType.COMPLETE_ALBUM, allowed_territories=[ TerritoryCodeA2(country_code=x) for x in ["FR", "US", "CA", "BE", "AT"] ], store=store, ), ) @pytest.fixture def graphql_product_mock() -> GraphQlProduct: return get_graphql_product_mock() @pytest.fixture def graphql_json_data() -> str: return get_graphql_json_data() def get_graphql_json_data() -> str: return """ { "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "producer", "participant": { "uuid": "ef01a90b-d3a3-45cb-9958-55dcf728f76e", "name": "Big Time Producer", "appleMusicId": null, "spotifyId": null, "spotifyArtistKey": null, "globalParticipant": null } }, { "participated_as": "performer", "participant": { "uuid": "48392034-4859-5948-0120-023948762100", "name": "Smaller Star", "appleMusicId": null, "spotifyId": "5245ndfj34kejrfdsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } } ], "tracks": [ { "isrc": "USAT22403171", "tuid": "12345", "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "performer", "participant": { "uuid": "39023674-4987-3674-4932-223478145738", "name": "Very Big Star 2", "appleMusicId": "erg97erfg", "spotifyId": "jerfver324", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "43545612-1344-3454-4932-345345234567" } } }, { "participated_as": "performer", "participant": { "uuid": "39462744-4482-3384-4667-488237466299", "name": "Very Big Star 3", "appleMusicId": "eirnf", "spotifyId": "q3rf9uhv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "43545612-4987-3454-4932-345345232345" } } }, { "participated_as": "performer", "participant": { "uuid": "48392034-4859-5948-0120-023948762100", "name": "Smaller Star", "appleMusicId": null, "spotifyId": "5245ndfj34kejrfdsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } }, { "participated_as": "track_writer", "participant": { "uuid": "12392034-1111-5948-0120-023948762100", "name": "Connie Blair", "appleMusicId": null, "spotifyId": "wwwwweeeee555555", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } }, { "participated_as": "track_writer", "participant": { "uuid": "45692034-1111-5948-0120-023948762100", "name": "Florence", "appleMusicId": null, "spotifyId": "wwwwweeeee666666", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } }, { "participated_as": "track_writer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } } ], "labelSoundRecording": { "participations": [] } }, { "isrc": "USAT22403172", "tuid": "12347", "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "performer", "participant": { "uuid": "59596847-3748-1923-4002-388849057321", "name": "Very Big Star 2", "appleMusicId": "2257874534hfvsldjkf", "spotifyId": "79bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056790" } } }, { "participated_as": "track_writer", "participant": { "uuid": "78992034-3333-5948-0120-023948762100", "name": "Jimmy Alpine", "appleMusicId": "eeeewwwww7777777", "spotifyId": "wwwwweeeee777777", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } } ], "labelSoundRecording": { "participations": [] } }, { "isrc": "USAT22403173", "tuid": "12348", "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "producer", "participant": { "uuid": "ef01a90b-d3a3-45cb-9958-55dcf728f76e", "name": "Big Time Producer", "appleMusicId": null, "spotifyId": null, "spotifyArtistKey": null, "globalParticipant": null } }, { "participated_as": "track_wwriter", "participant": { "uuid": "10192034-4444-5948-0120-023948762100", "name": "Gina George", "appleMusicId": "eeeewwwww888888", "spotifyId": "wwwwweeeee888888", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } }, { "participated_as": "track_writer", "participant": { "uuid": "10292034-5555-5948-0120-023948762100", "name": "JJ Lemon", "appleMusicId": "eeeewwwww99999", "spotifyId": "wwwwweeeee99999", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } }, { "participated_as": "track_writer", "participant": { "uuid": "10392034-6666-5948-0120-023948762100", "name": "Flamez", "appleMusicId": "eeeewwwww1111111", "spotifyId": "wwwwweeeee1111111", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } } ], "labelSoundRecording": { "participations": [] } }, { "isrc": "USAT22403175", "tuid": "123410", "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "remixer", "participant": { "uuid": "59595847-3748-1923-4002-388849057421", "name": "Some European Remixer", "appleMusicId": "45t34rij34", "spotifyId": "34rjn34r34", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "82945678-4567-1923-4011-567891056790" } } }, { "participated_as": "track_writer", "participant": { "uuid": "78992034-3333-5948-0120-023948762100", "name": "Jimmy Alpine", "appleMusicId": "eeeewwwww7777777", "spotifyId": "wwwwweeeee777777", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } } ], "labelSoundRecording": { "participations": [] } }, { "isrc": "USAT22403174", "tuid": "12349", "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "track_writer", "participant": { "uuid": "10392034-6666-5948-0120-023948762100", "name": "Flamez", "appleMusicId": "eeeewwwww1111111", "spotifyId": "wwwwweeeee1111111", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } } ], "labelSoundRecording": { "participations": [] } }, { "isrc": "USAT22403176", "tuid": "123412", "participations": [ { "participated_as": "performer", "participant": { "uuid": "48596847-3748-1923-4002-388849057321", "name": "Very Big Star", "appleMusicId": "8457874534hfvsldjkf", "spotifyId": "58bndfjvf93rndsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": { "id": "32945678-4567-1923-4002-567891056789" } } }, { "participated_as": "performer", "participant": { "uuid": "48392034-4859-5948-0120-023948762100", "name": "Smaller Star", "appleMusicId": null, "spotifyId": "5245ndfj34kejrfdsfv", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } }, { "participated_as": "track_writer", "participant": { "uuid": "10292034-5555-5948-0120-023948762100", "name": "JJ Lemon", "appleMusicId": "eeeewwwww99999", "spotifyId": "wwwwweeeee99999", "spotifyArtistKey": "spotify_artist_key", "globalParticipant": null } } ], "labelSoundRecording": { "participations": [] } } ] } """ def get_graphql_product_mock() -> GraphQlProduct: return GraphQlProduct(**json.loads(get_graphql_json_data())) @pytest.fixture def spotify_genre_mapping_mock() -> list[GenreMapping]: return [ GenreMapping( genre="Alternative", genre_code=None, subgenre="New Wave", subgenre_code=None, subgenre_id=1163, ) ] @pytest.fixture def participants_mock_with_more_roles() -> list[Participant]: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Very Big Star 2", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Some European Remixer", roles={ParticipantRole.REMIXER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Very Big Star 3", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Big Time Producer", roles={ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Composer", roles={ParticipantRole.COMPOSER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Smaller Star", roles={ParticipantRole.FEATURING}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, spotify_artist_key=None, global_participant_id=None, fullname_localizations=frozenset(), ), ] @pytest.fixture def ows_timed_release_response_mock() -> dict[ str, list[dict[str, str | dict[str, int]]] ]: return { "staggered": [ { "sale_date": "2024-01-01", "delivery_store": {"id": 1942}, }, { "sale_date": "2022-04-29", "delivery_store": {"id": 1186}, }, ], "timed": [ { "sale_date_time": "2024-01-01T00:00:00Z", "delivery_store": {"id": 1375}, }, { "sale_date_time": "2024-08-14T09:30:00Z", "delivery_store": {"id": 286}, }, ], "unsupported_timed": [ { "sale_date_time": "2024-01-01", "time_offset": "00:30", "delivery_store": {"id": 332}, }, { "sale_date_time": "2022-04-22", "time_offset": "00:45", "delivery_store": {"id": 132}, }, ], } @pytest.fixture def timed_release_client_response_mock() -> TimedRelease: return get_timed_release_client_response_mock() def get_timed_release_client_response_mock() -> TimedRelease: return TimedRelease( staggered=[ StaggeredTimedRelease( sale_date="2024-01-01", store_id=1942, ), StaggeredTimedRelease( sale_date="2022-04-29", store_id=1186, ), ], timed=[ TimedTimedRelease( sale_date_time="2024-01-01T00:00:00Z", store_id=1375, ), TimedTimedRelease( sale_date_time="2024-08-14T09:30:00Z", store_id=286, ), ], unsupported_timed=[ UnsupportedTimedRelease( sale_date_time="2024-01-01", time_offset="00:30", store_id=332, ), UnsupportedTimedRelease( sale_date_time="2022-04-22", time_offset="00:45", store_id=132, ), ], ) @pytest.fixture def product_timed_release_by_store_response_mock() -> dict[str, dict[str, str] | None]: """Dict response from HTTP - used by client tests.""" return { "timed": {"sales_date_time": "2024-08-14T00:00:00Z"}, "staggered": None, } @pytest.fixture def product_staggered_release_by_store_response_mock() -> dict[ str, dict[str, str] | None ]: return {"timed": None, "staggered": {"sales_date": "2021-08-03"}} @pytest.fixture def product_timed_release_by_store_client_response_mock() -> ProductTimedReleaseByStore: """Model - what get_product_timed_release_by_store_id returns.""" return ProductTimedReleaseByStore( timed={"sales_date_time": "2024-08-14T00:00:00Z"}, staggered=None, ) @pytest.fixture def product_pricing_response_mock() -> set[ReleasePricing]: return get_product_pricing_response_mock() def get_product_pricing_response_mock() -> set[ReleasePricing]: return { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=CustomPricing( custom_price="12.89", custom_currency_code="EUR" ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), } @pytest.fixture def track_pricing_response_mock() -> set[TrackReleasePricing]: return get_track_pricing_response_mock() def get_track_pricing_response_mock() -> set[TrackReleasePricing]: return { TrackReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), track_ids=[12345, 12347, 123410, 12348, 12349, 123412, 123413], custom_pricing=None, start_date=None, end_date=None, ), TrackReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), track_ids=[12345, 12347, 123410, 12348, 12349, 123412, 123413], custom_pricing=None, start_date=None, end_date=None, ), TrackReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), track_ids=[12345, 12347, 123410, 12348, 12349, 123412, 123413], custom_pricing=None, start_date=None, end_date=None, ), TrackReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), track_ids=[12345, 12347, 123410, 12348, 12349, 123412, 123413], custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), TrackReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), track_ids=[12345, 12347, 123410, 12348, 12349, 123412, 123413], custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), } @pytest.fixture def video_track_pricing_response_mock() -> set[TrackReleasePricing]: return get_video_track_pricing_response_mock() def get_video_track_pricing_response_mock() -> set[TrackReleasePricing]: return { TrackReleasePricing( price_code="IM-3", country_code=TerritoryCodeA2(country_code="MN"), track_ids=[12348], custom_pricing=None, start_date=None, end_date=None, ), TrackReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), track_ids=[12349], custom_pricing=None, start_date=None, end_date=None, ), TrackReleasePricing( price_code="IM-9", country_code=TerritoryCodeA2(country_code="CZ"), track_ids=[123410], custom_pricing=None, start_date=None, end_date=None, ), } @pytest.fixture def video_track_pricing_dict_mock() -> dict[int, set[ReleasePricing]]: return { 123410: { ReleasePricing( price_code="IM-9", country_code=TerritoryCodeA2(country_code="CZ"), custom_pricing=None, start_date=None, end_date=None, ), }, 12348: { ReleasePricing( price_code="IM-3", country_code=TerritoryCodeA2(country_code="MN"), custom_pricing=None, start_date=None, end_date=None, ), }, 12349: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), }, } @pytest.fixture def audio_track_pricing_dict_mock() -> dict[int, set[ReleasePricing]]: return { 12345: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, 12347: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, 123410: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, 12348: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, 12349: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, 123412: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, 123413: { ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, } @pytest.fixture def classical_tracks_mock() -> list[Track]: return [ Track( track_id=12345, volume_number=1, track_number=1, duration_seconds=14, preview_start_time_seconds=0, track_type=TrackTypes.MUSIC, lyrics_explicitness=LyricsExplicitness.CLEAN, upc=75679660923, isrc="USAT22403171", p_line=CopyrightLine(year="2024", text="2024 Some Label"), track_name="Volume 1 Track 1", track_version=None, language_of_performance_ietf_rfc_5646_code=None, participants=[ Participant( fullname="Very Big Star", roles={ ParticipantRole.TRACK_WRITER, ParticipantRole.PERFORMER, ParticipantRole.PUBLISHER, }, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Connie Blair", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Florence", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Elegant Ensemble", roles={ParticipantRole.ENSEMBLE}, instruments=set(), label_participant_id=UUID("99996847-6456-8888-4002-388849057321"), apple_music_id="45245h4riurfhhj", spotify_id="abcdefghi56789zyx", global_participant_id=UUID("49596347-5555-0987-1234-388849057321"), fullname_localizations=frozenset(), ), ], distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, offer_type=TrackOfferType.ALL, track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=CustomPricing( custom_price="12.89", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ), Track( track_id=12347, volume_number=1, track_number=2, duration_seconds=120, preview_start_time_seconds=0, track_type=TrackTypes.MUSIC, lyrics_explicitness=LyricsExplicitness.EXPLICIT, upc=75679660923, isrc="USAT22403172", p_line=CopyrightLine( year="2022", text="2022 Cool Label", ), track_name="Volume 1 Track 2", track_version=None, language_of_performance_ietf_rfc_5646_code="zxx", participants=[ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Very Big Star 2", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Pubbz House", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Jimmy Alpine", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Carl the Composer", roles={ParticipantRole.COMPOSER}, instruments=set(), label_participant_id=UUID("56796847-1111-8888-9999-388849057321"), apple_music_id="123455555hhhhttt", spotify_id="aaaaaa555555", global_participant_id=UUID("99996347-4444-3333-1234-382849057321"), fullname_localizations=frozenset(), ), ], distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, offer_type=TrackOfferType.TRACK_DOWNLOAD_STREAM, track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ), Track( track_id=123410, volume_number=1, track_number=3, duration_seconds=128, preview_start_time_seconds=0, track_type=TrackTypes.MUSIC, lyrics_explicitness=LyricsExplicitness.EXPLICIT, upc=75679660923, isrc="USAT22403175", p_line=CopyrightLine( year="2022", text="2022 Cool Label", ), track_name="Volume 1 Track 3", track_version=None, language_of_performance_ietf_rfc_5646_code="zxx", participants=[ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER, ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Some European Remixer", roles={ParticipantRole.REMIXER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Jimmy Alpine", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ], distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, offer_type=TrackOfferType.TRACK_DOWNLOAD_STREAM, track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ), Track( track_id=12348, volume_number=2, track_number=1, duration_seconds=210, preview_start_time_seconds=35, track_type=TrackTypes.MUSIC, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, upc=75679660923, isrc="USAT22403173", p_line=CopyrightLine( year=None, text="ASDF Label", ), track_name="Volume 2 Track 1", track_version=None, language_of_performance_ietf_rfc_5646_code="zh", participants=[ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER, ParticipantRole.COMPOSER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Big Time Producer", roles={ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Gina George", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="JJ Lemon", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Flamez", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ], distribution_rights={DownloadStreamRights.STREAM}, offer_type=TrackOfferType.STREAM_ONLY, track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ), Track( track_id=12349, volume_number=2, track_number=2, duration_seconds=180, preview_start_time_seconds=170, track_type=TrackTypes.MUSIC, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, upc=75679660923, isrc="USAT22403174", p_line=CopyrightLine( year="2021", text="2021 Unidentified Fruit Label", ), track_name="Volume 2 Track 2", track_version="Cool Version", language_of_performance_ietf_rfc_5646_code="bgc", participants=[ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Publishing Co.", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Flamez", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), ], distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, offer_type=TrackOfferType.ALL, track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ), Track( track_id=123412, volume_number=2, track_number=3, duration_seconds=180, preview_start_time_seconds=170, track_type=TrackTypes.MUSIC, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, upc=75679660923, isrc="USAT22403176", p_line=CopyrightLine( year="2021", text="2021 Unidentified Fruit Label", ), track_name="Volume 2 Track 3", track_version=None, language_of_performance_ietf_rfc_5646_code="bgc", participants=[ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="JJ Lemon", roles={ParticipantRole.TRACK_WRITER}, instruments=set(), label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Tom the Conductor", roles={ParticipantRole.CONDUCTOR}, instruments=set(), label_participant_id=UUID("11196847-6456-7777-0000-388849057321"), apple_music_id="qwerty876543", spotify_id="poiuyt987655", global_participant_id=UUID("49596347-3333-2222-3333-388849057321"), fullname_localizations=frozenset(), ), ], distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, offer_type=TrackOfferType.ALL, track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="BE"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="AT"), custom_pricing=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ), ] def get_store_features_mock(store_id: int) -> set[DistributionFeatureId]: store_features = { StoreIds.NO_STORE: { DistributionFeatureId.A_LA_CARTE_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_STREAMING, DistributionFeatureId.SUBSCRIPTION_PORTABLE_TETHERED, DistributionFeatureId.OTA_INCLUDING_DUAL_DELIVERY, DistributionFeatureId.OTA_WITH_RINGTONE_USE, DistributionFeatureId.STREAMING_SUBSCRIPTION_TO_MOBILE, DistributionFeatureId.STREAMING_ON_DEMAND_TO_MOBILE, DistributionFeatureId.AD_SUPPORTED_STREAMING, }, StoreIds.LIBRARY_IDEAS_FREEGAL: { DistributionFeatureId.A_LA_CARTE_DOWNLOAD, DistributionFeatureId.SUBSCRIPTION_STREAMING, }, StoreIds.SPOTIFY: { DistributionFeatureId.SUBSCRIPTION_STREAMING, }, StoreIds.AMAZON: { DistributionFeatureId.SUBSCRIPTION_STREAMING, DistributionFeatureId.SUBSCRIPTION_DOWNLOAD, }, } return store_features.get(store_id, set()) @pytest.fixture def art_relations_product_video_mock() -> ArtRelationsProductVideo: return get_art_relations_product_video_mock() def get_art_relations_product_video_mock() -> ArtRelationsProductVideo: return ArtRelationsProductVideo( channel_selection=None, description=None, type_of_video="short form", keywords=None, associated_track_isrc="US224SD03176", contributors=""" [ {"name": "Very Big Star", "role": "performer"}, {"name": "Smaller Star", "role": "featuring"}, {"name": "JJ Lemon", "role": "track_writer"}, {"name": "Fire Pubs", "role": "publisher"} ] """, primary_artist_name="Very Big Star", ) def get_dms_encoding_profile_mock(track_types: list[TrackTypes], store: Store) -> dict: # type: ignore[type-arg] required_profiles = { EncodingProfileType.IMAGE: store.image_encoding_profiles, EncodingProfileType.METADATA: store.metadata_encoding_profiles, } audio_profiles = { EncodingProfileType.AUDIO: store.audio_encoding_profiles, } video_profiles = { EncodingProfileType.VIDEO: store.video_encoding_profiles, EncodingProfileType.VIDEO_IMAGE: store.video_image_encoding_profiles, } match track_types: case [TrackTypes.MUSIC]: required_profiles.update(audio_profiles) # type: ignore[arg-type] case [TrackTypes.VIDEO]: required_profiles.update(video_profiles) # type: ignore[arg-type] case [TrackTypes.MUSIC, TrackTypes.VIDEO]: required_profiles.update(audio_profiles) # type: ignore[arg-type] required_profiles.update(video_profiles) # type: ignore[arg-type] case _: raise ValueError("Invalid track types") return required_profiles def get_x_number_of_tracks_mock(how_many: int, track_type: TrackTypes) -> list[Track]: return [ Track( track_id=i + 1, track_type=track_type, track_name=f"track name {i}", track_number=i + 1, volume_number=1, offer_type=TrackOfferType.ALL, track_version=None, participants=[], duration_seconds=1, lyrics_explicitness=LyricsExplicitness.NOT_EXPLICIT, isrc=f"ISRC{i + 1}", upc=123423412341, p_line=CopyrightLine(text="p line", year="2025"), distribution_rights=set(), preview_start_time_seconds=45, language_of_performance_ietf_rfc_5646_code="ENG", track_territory_pricing={ ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="FR"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="US"), custom_pricing=None, start_date=None, end_date=None, ), ReleasePricing( price_code="3", country_code=TerritoryCodeA2(country_code="CA"), custom_pricing=None, start_date=None, end_date=None, ), }, instant_grats=None, localized_metadata=[], assets=[], spatial_isrc=None, ) for i in range(how_many) ] def get_product_audio_mock( store: Store, track_types: list[TrackTypes], tracks_override: list[Track] | None = None, ) -> ProductAudio: art_relations_product_mock = get_art_relations_product_mock() art_relations_territory_dates_mock = get_art_relations_territory_dates_mock() ows_timed_release_response_mock = get_timed_release_client_response_mock() tracks_list = ( tracks_override if tracks_override else get_sorted_tracks_mock( track_types, store, ) ) pricing = ( get_product_pricing_response_mock() if store.is_pricing_supported else set() ) return ProductAudio( upc=art_relations_product_mock.upc, display_upc=art_relations_product_mock.display_upc, tracks=tracks_list, product_id=art_relations_product_mock.product_id, product_type_id=art_relations_product_mock.product_type_id, original_release_date=art_relations_product_mock.original_release_date, release_date=art_relations_product_mock.release_date, sale_start_date=art_relations_product_mock.sale_start_date, preorder_date=art_relations_product_mock.preorder_date, product_name=art_relations_product_mock.product_name, delivered_version=art_relations_product_mock.delivered_version, release_grid=art_relations_product_mock.release_grid, metadata_language_ietf_rfc_5646_code=( art_relations_product_mock.metadata_language_ietf_rfc_5646_code ), distribution_format_id=art_relations_product_mock.distribution_format_id, product_code=art_relations_product_mock.product_code, release_sony_product_no=art_relations_product_mock.release_sony_product_no, vendor_catalog_number=art_relations_product_mock.vendor_catalog_number, genre_id=art_relations_product_mock.genre_id, subgenre_id=art_relations_product_mock.subgenre_id, genre_name=art_relations_product_mock.genre_name, subgenre_name=art_relations_product_mock.subgenre_name, participants=_get_audio_product_participants_mock(store), genre_mappings=None, timed_release_datetime=get_timed_release_by_dms( store.store_id, ows_timed_release_response_mock ), staggered_release_date=get_staggered_release_by_dms( store.store_id, ows_timed_release_response_mock ), p_line=CopyrightLine( year="2021", text="2021 Unidentified Fruit Label", ), c_line=CopyrightLine( year="2021", text="2021 BRAT Label", ), imprint="imprint label", distribution_context=DistributionContext.DIGITAL, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, territory_dates=art_relations_territory_dates_mock, release_territory_pricing=pricing, content_id=art_relations_product_mock.content_id, project_id=34123, vendor_id=7123, vendor_owner="orchard", localized_metadata=( get_localized_metadata_mock(0) if store.is_localization_supported else [] ), assets=[ ArtworkAsset( filename="upc.tif", bucket="test_bucket", asset_type=AssetType.TIF, ) ], ) @pytest.fixture def ows_track_performers_client_response_mock() -> list[TrackPerformerResponse]: return [ TrackPerformerResponse( tuid=12345, performers=[ Performer( performer_id=111, type="primary", performer_role_id=89, birth_name="Very Big Star", ), Performer( performer_id=112, type="featured", performer_role_id=36, birth_name="Smaller Star", ), ], ), TrackPerformerResponse( tuid=12347, performers=[ Performer( performer_id=113, type="primary", performer_role_id=47, birth_name="Very Big Star", ), Performer( performer_id=113, type="primary", performer_role_id=85, birth_name="Very Big Star", ), ], ), TrackPerformerResponse( tuid=12349, performers=[ Performer( performer_id=114, type="primary", performer_role_id=2, birth_name="Brass Player", ), ], ), ] @pytest.fixture def get_track_performers_with_role_names_response_mock() -> dict[ int, list[TrackPerformer] ]: return { 12345: [ TrackPerformer( role="Vocals - Lead Vocals", birth_name="Very Big Star", ), TrackPerformer( role="Percussion - Congas", birth_name="Smaller Star", ), ], 12347: [ TrackPerformer( role="Percussion - Guiro", birth_name="Very Big Star", ), TrackPerformer( role="Vocals - Rapper", birth_name="Very Big Star", ), ], 12349: [ TrackPerformer( role="Brass - Bugle", birth_name="Brass Player", ), ], } @pytest.fixture def ows_track_performers_response_mock() -> dict[str, list[dict[str, Any]]]: return { "items": [ { "tuid": 12345, "performers": [ { "performer_id": 111, "type": "primary", "performer_role_id": 89, "birth_name": "Very Big Star", }, { "performer_id": 112, "type": "featured", "performer_role_id": 36, "birth_name": "Smaller Star", }, ], }, { "tuid": 12347, "performers": [ { "performer_id": 113, "type": "primary", "performer_role_id": 47, "birth_name": "Very Big Star", }, { "performer_id": 113, "type": "primary", "performer_role_id": 85, "birth_name": "Very Big Star", }, ], }, { "tuid": 12349, "performers": [ { "performer_id": 114, "type": "primary", "performer_role_id": 2, "birth_name": "Brass Player", }, ], }, ] } @pytest.fixture def ows_track_performer_roles_client_response_mock() -> list[ TrackPerformerRoleResponse ]: return [ TrackPerformerRoleResponse( performer_role_id=2, performer_role="Brass - Bugle", ), TrackPerformerRoleResponse( performer_role_id=11, performer_role="Electronics - Sampler", ), TrackPerformerRoleResponse( performer_role_id=20, performer_role="Guitar - Acoustic Guitar", ), TrackPerformerRoleResponse( performer_role_id=89, performer_role="Vocals - Lead Vocals", ), TrackPerformerRoleResponse( performer_role_id=85, performer_role="Vocals - Rapper", ), TrackPerformerRoleResponse( performer_role_id=36, performer_role="Percussion - Congas", ), TrackPerformerRoleResponse( performer_role_id=47, performer_role="Percussion - Guiro", ), ] @pytest.fixture def ows_track_performer_roles_response_mock() -> dict[str, list[dict[str, Any]]]: return { "items": [ {"performer_role_id": 2, "performer_role": "Brass - Bugle"}, {"performer_role_id": 11, "performer_role": "Electronics - Sampler"}, {"performer_role_id": 20, "performer_role": "Guitar - Acoustic Guitar"}, {"performer_role_id": 89, "performer_role": "Vocals - Lead Vocals"}, {"performer_role_id": 85, "performer_role": "Vocals - Rapper"}, {"performer_role_id": 36, "performer_role": "Percussion - Congas"}, {"performer_role_id": 47, "performer_role": "Percussion - Guiro"}, ] } def ows_track_instant_grats_response_mock() -> dict[str, list[dict[str, Any]]]: return { "items": [ { "tuid": 12345, "grats": [ { "store_id": 187, "date": "2024-08-10T00:00:00", "created_by": "oa:789", "created_at": "2024-08-03T00:00:00", "active": "Y", }, { "store_id": 1, "date": "2024-08-10T00:00:00", "created_by": "oa:789", "created_at": "2024-08-03T00:00:00", "active": "Y", }, ], }, { "tuid": 12349, "grats": [ { "store_id": 187, "date": "2024-08-11T00:00:00", "created_by": "oa:789", "created_at": "2024-08-03T00:00:00", "active": "Y", }, { "store_id": 1, "date": "2024-08-11T00:00:00", "created_by": "oa:789", "created_at": "2024-08-03T00:00:00", "active": "Y", }, ], }, ] } @pytest.fixture def instant_grats_client_response_mock() -> dict[int, set[InstantGrats]]: return get_instant_grats_client_response_mock() def get_instant_grats_client_response_mock() -> dict[int, set[InstantGrats]]: return { StoreIds.AMAZON: { InstantGrats( tuid=12345, store_id=187, date="2024-08-10T00:00:00", active="Y" ), InstantGrats( tuid=12349, store_id=187, date="2024-08-11T00:00:00", active="Y" ), }, StoreIds.APPLE: { InstantGrats( tuid=12345, store_id=1, date="2024-08-10T00:00:00", active="Y" ), InstantGrats( tuid=12349, store_id=1, date="2024-08-11T00:00:00", active="Y" ), }, } @pytest.fixture def get_product_localized_metadata_result_mock() -> list[ ArtRelationsProductLocalizedMetadata ]: return [ ArtRelationsProductLocalizedMetadata( language_code="zh-hans", localized_product_name="宇宙甜甜圈", localized_product_version="version_1", ) ] @pytest.fixture def get_track_localized_metadata_result_mock() -> list[ ArtRelationsTrackLocalizedMetadata ]: return [ ArtRelationsTrackLocalizedMetadata( track_id=12345, language_code="zh-hans", localized_track_name="宇宙甜甜圈", localized_track_version="version1", ), ArtRelationsTrackLocalizedMetadata( track_id=12347, language_code="zh-hans", localized_track_name="", localized_track_version="", ), ArtRelationsTrackLocalizedMetadata( track_id=456, language_code="zh-hans", localized_track_name="宇宙甜甜圈", localized_track_version="version2", ), ] def get_localized_metadata_mock(track_id: int) -> list[LocalizedMetadata]: match track_id: case 0: return [ LocalizedMetadata( language_code="zh-hans", localized_name="宇宙甜甜圈", localized_version="version_1", ) ] case 12345: return [ LocalizedMetadata( language_code="zh-hans", localized_name="宇宙甜甜圈", localized_version="version1", ) ] case 12347: return [ LocalizedMetadata( language_code="zh-hans", localized_name="", localized_version="", ) ] case _: return [] @pytest.fixture def product_delivery_rights_mock_no_pricing() -> list[TerritoryRights]: return get_product_delivery_rights_mock(with_pricing=False) @pytest.fixture def product_delivery_rights_mock_with_pricing() -> list[TerritoryRights]: return get_product_delivery_rights_mock(with_pricing=True) def get_product_delivery_rights_mock(with_pricing: bool) -> list[TerritoryRights]: if not with_pricing: return [ TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 10), end_date=datetime(2024, 8, 12, 0, 0), price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, is_preorder=True, ), TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ] return [ TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 10), end_date=datetime(2024, 8, 12, 0, 0), price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, is_preorder=True, ), TerritoryRights( territories=["CA"], start_date=datetime(2024, 8, 10), end_date=datetime(2024, 8, 12, 0, 0), price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, is_preorder=True, ), TerritoryRights( territories=["FR"], start_date=datetime(2024, 8, 10), end_date=datetime(2024, 8, 12, 0, 0), price_code="3", custom_price=CustomPricing( custom_price="12.89", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, is_preorder=True, ), TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="12.89", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ] @pytest.fixture def audio_delivery_rights_mock_no_pricing_no_preorder( product_delivery_rights_mock_no_pricing_no_preorder: list[TerritoryRights], audio_tracks_delivery_rights_mock_no_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_no_pricing_no_preorder, track_rights=audio_tracks_delivery_rights_mock_no_pricing, ) @pytest.fixture def audio_delivery_rights_mock_with_pricing_no_preorder( product_delivery_rights_mock_with_pricing_no_preorder: list[TerritoryRights], audio_tracks_delivery_rights_mock_with_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_with_pricing_no_preorder, track_rights=audio_tracks_delivery_rights_mock_with_pricing, ) @pytest.fixture def product_delivery_rights_mock_no_pricing_no_preorder() -> list[TerritoryRights]: return get_product_delivery_rights_mock_no_preorder(with_pricing=False) @pytest.fixture def product_delivery_rights_mock_with_pricing_no_preorder() -> list[TerritoryRights]: return get_product_delivery_rights_mock_no_preorder(with_pricing=True) def get_product_delivery_rights_mock_no_preorder( with_pricing: bool, ) -> list[TerritoryRights]: if not with_pricing: return [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ] return [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="12.89", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ] @pytest.fixture def audio_delivery_rights_mock_no_pricing( product_delivery_rights_mock_no_pricing: list[TerritoryRights], audio_tracks_delivery_rights_mock_no_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_no_pricing, track_rights=audio_tracks_delivery_rights_mock_no_pricing, ) @pytest.fixture def audio_delivery_rights_mock_with_pricing( product_delivery_rights_mock_with_pricing: list[TerritoryRights], audio_tracks_delivery_rights_mock_with_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_with_pricing, track_rights=audio_tracks_delivery_rights_mock_with_pricing, ) @pytest.fixture def audio_tracks_delivery_rights_mock_with_pricing() -> dict[ int, list[TerritoryRights] ]: return get_audio_tracks_delivery_rights_mock(with_pricing=True) @pytest.fixture def audio_tracks_delivery_rights_mock_no_pricing() -> dict[int, list[TerritoryRights]]: return get_audio_tracks_delivery_rights_mock(with_pricing=False) def get_audio_tracks_delivery_rights_mock( with_pricing: bool, ) -> dict[int, list[TerritoryRights]]: if not with_pricing: return { 12345: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 12347: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 123410: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 12348: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 12349: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 123412: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], } return { 12345: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 12347: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 123410: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 12348: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 12349: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 123412: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], } @pytest.fixture def spotify_audio_delivery_rights_mock_no_pricing( spotify_product_delivery_rights_mock_no_pricing: list[TerritoryRights], spotify_audio_tracks_delivery_rights_mock_no_pricing: dict[ int, list[TerritoryRights] ], ) -> DeliveryRights: return DeliveryRights( product_rights=spotify_product_delivery_rights_mock_no_pricing, track_rights=spotify_audio_tracks_delivery_rights_mock_no_pricing, ) @pytest.fixture def spotify_product_delivery_rights_mock_no_pricing() -> list[TerritoryRights]: return [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ] @pytest.fixture def spotify_audio_tracks_delivery_rights_mock_no_pricing() -> dict[ int, list[TerritoryRights] ]: return { 12345: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 12347: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 123410: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 12348: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 12349: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 123412: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], } @pytest.fixture def video_track_delivery_rights_mock_with_pricing() -> dict[int, list[TerritoryRights]]: return get_video_track_delivery_rights_mock(with_pricing=True) @pytest.fixture def video_track_delivery_rights_mock_no_pricing() -> dict[int, list[TerritoryRights]]: return get_video_track_delivery_rights_mock(with_pricing=False) def get_video_track_delivery_rights_mock( with_pricing: bool, ) -> dict[int, list[TerritoryRights]]: if with_pricing: return { 123413: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=CustomPricing( custom_price="2.99", custom_currency_code="EUR", ), distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code="3", custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ] } return { 123413: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], } @pytest.fixture def video_delivery_rights_mock_no_pricing( product_delivery_rights_mock_no_pricing: list[TerritoryRights], video_track_delivery_rights_mock_no_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_no_pricing, track_rights=video_track_delivery_rights_mock_no_pricing, ) @pytest.fixture def video_delivery_rights_mock_with_pricing( product_delivery_rights_mock_with_pricing: list[TerritoryRights], video_track_delivery_rights_mock_with_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_with_pricing, track_rights=video_track_delivery_rights_mock_with_pricing, ) @pytest.fixture def spotify_video_track_delivery_rights_no_pricing() -> dict[ int, list[TerritoryRights] ]: return { 123413: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 14, 9, 30), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], } @pytest.fixture def spotify_video_delivery_rights_mock_no_pricing( spotify_product_delivery_rights_mock_no_pricing: list[TerritoryRights], spotify_video_track_delivery_rights_no_pricing: dict[int, list[TerritoryRights]], ) -> DeliveryRights: return DeliveryRights( product_rights=spotify_product_delivery_rights_mock_no_pricing, track_rights=spotify_video_track_delivery_rights_no_pricing, ) @pytest.fixture def audio_delivery_rights_mock_with_instant_grats_no_pricing( product_delivery_rights_mock_with_instant_grats_no_pricing: list[TerritoryRights], audio_tracks_delivery_rights_mock_with_instant_grats_no_pricing: dict[ int, list[TerritoryRights] ], ) -> DeliveryRights: return DeliveryRights( product_rights=product_delivery_rights_mock_with_instant_grats_no_pricing, track_rights=audio_tracks_delivery_rights_mock_with_instant_grats_no_pricing, ) @pytest.fixture def product_delivery_rights_mock_with_instant_grats_no_pricing() -> list[ TerritoryRights ]: return [ TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 10), end_date=datetime(2024, 8, 11, 0, 0), price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, is_preorder=True, instant_gratification_tracks={12345}, ), TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 11), end_date=datetime(2024, 8, 12, 0, 0), price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, is_preorder=True, instant_gratification_tracks={12345, 12349}, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ] @pytest.fixture def audio_tracks_delivery_rights_mock_with_instant_grats_no_pricing() -> dict[ int, list[TerritoryRights] ]: return { 12345: [ TerritoryRights( territories=["AT", "BE", "CA", "FR", "US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 12347: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 123410: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 12348: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.STREAM, }, ), ], 12349: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 11), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], 123412: [ TerritoryRights( territories=["US"], start_date=datetime(2024, 8, 10), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), TerritoryRights( territories=["AT", "BE", "CA", "FR"], start_date=datetime(2024, 8, 12), end_date=None, price_code=None, custom_price=None, distribution_rights={ DownloadStreamRights.DOWNLOAD, DownloadStreamRights.STREAM, }, ), ], } @pytest.fixture def get_product_artist_localized_metadata_result_mock() -> list[ ParticipantFullnameLocalization ]: return [ ParticipantFullnameLocalization( fullname="Test name1", language_code="zh-hans", localized_fullname="烟圈 SMOKERING", ) ] @pytest.fixture def get_track_artist_localized_metadata_result_mock() -> list[ ParticipantFullnameLocalization ]: return [ ParticipantFullnameLocalization( fullname="Test name1", language_code="zh-hans", localized_fullname="烟圈 SMOKERING", ), ParticipantFullnameLocalization( fullname="Test name2", language_code="de", localized_fullname="BigBob", ), ] # TBD on product question - # should we splice track-level deal based on pricing if IGs exist for the track? # @pytest.fixture # def audio_delivery_rights_mock_with_instant_grats_and_pricing( # product_delivery_rights_mock_with_instant_grats_with_pricing: list[TerritoryRights], # audio_tracks_delivery_rights_mock_with_instant_grats_with_pricing: dict[ # int, list[TerritoryRights] # ], # ) -> DeliveryRights: # return DeliveryRights( # product_rights=product_delivery_rights_mock_with_instant_grats_and_pricing, # track_rights=audio_tracks_delivery_rights_mock_with_instant_grats_and_pricing, # ) # # # @pytest.fixture # def product_delivery_rights_mock_with_instant_grats_and_pricing() -> list[TerritoryRights]: # return [ # TerritoryRights( # territories=["AT", "BE"], # start_date=datetime(2024, 8, 10), # end_date=datetime(2024, 8, 10, 23, 59, 59), # price_code="3", # custom_price=CustomPricing( # custom_price="2.99", # custom_currency_code="EUR", # ), # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # is_preorder=True, # instant_gratification_tracks={12345}, # ), # TerritoryRights( # territories=["CA"], # start_date=datetime(2024, 8, 10), # end_date=datetime(2024, 8, 10, 23, 59, 59), # price_code="3", # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # is_preorder=True, # instant_gratification_tracks={12345}, # ), # TerritoryRights( # territories=["FR"], # start_date=datetime(2024, 8, 10), # end_date=datetime(2024, 8, 10, 23, 59, 59), # price_code="3", # custom_price=CustomPricing( # custom_price="12.89", # custom_currency_code="EUR", # ), # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # is_preorder=True, # instant_gratification_tracks={12345}, # ), # TerritoryRights( # territories=["US"], # start_date=datetime(2024, 8, 10), # end_date=None, # price_code="3", # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["AT", "BE"], # start_date=datetime(2024, 8, 11), # end_date=datetime(2024, 8, 11, 23, 59, 59), # price_code="3", # custom_price=CustomPricing( # custom_price="2.99", # custom_currency_code="EUR", # ), # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # is_preorder=True, # instant_gratification_tracks={12345, 12349}, # ), # TerritoryRights( # territories=["CA"], # start_date=datetime(2024, 8, 11), # end_date=datetime(2024, 8, 11, 23, 59, 59), # price_code="3", # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # is_preorder=True, # instant_gratification_tracks={12345, 12349}, # ), # TerritoryRights( # territories=["FR"], # start_date=datetime(2024, 8, 11), # end_date=datetime(2024, 8, 11, 23, 59, 59), # price_code="3", # custom_price=CustomPricing( # custom_price="12.89", # custom_currency_code="EUR", # ), # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # is_preorder=True, # instant_gratification_tracks={12345, 12349}, # ), # TerritoryRights( # territories=["AT", "BE"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code="3", # custom_price=CustomPricing( # custom_price="2.99", # custom_currency_code="EUR", # ), # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["CA"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code="3", # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["FR"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code="3", # custom_price=CustomPricing( # custom_price="12.89", # custom_currency_code="EUR", # ), # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # ] # # TODO # @pytest.fixture # def audio_tracks_delivery_rights_mock_with_instant_grats_and_pricing() -> dict[ # int, list[TerritoryRights] # ]: # return { # 12345: [ # TerritoryRights( # territories=["AT", "BE", "CA", "FR", "US"], # start_date=datetime(2024, 8, 10), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # ], # 12347: [ # TerritoryRights( # territories=["US"], # start_date=datetime(2024, 8, 10), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["AT", "BE", "CA", "FR"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # ], # 123410: [ # TerritoryRights( # territories=["US"], # start_date=datetime(2024, 8, 10), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["AT", "BE", "CA", "FR"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # ], # 12348: [ # TerritoryRights( # territories=["US"], # start_date=datetime(2024, 8, 10), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["AT", "BE", "CA", "FR"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.STREAM, # }, # ), # ], # 12349: [ # TerritoryRights( # territories=["AT", "BE", "CA", "FR", "US"], # start_date=datetime(2024, 8, 11), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # ], # 123412: [ # TerritoryRights( # territories=["US"], # start_date=datetime(2024, 8, 10), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # TerritoryRights( # territories=["AT", "BE", "CA", "FR"], # start_date=datetime(2024, 8, 12), # end_date=None, # price_code=None, # custom_price=None, # distribution_rights={ # DownloadStreamRights.DOWNLOAD, # DownloadStreamRights.STREAM, # }, # ), # ], # } @pytest.fixture def contributors_with_user_defined_roles() -> list[Participant]: return [ Participant( fullname="Very Big Star", roles={ParticipantRole.PERFORMER, ParticipantRole.PRODUCER}, instruments=set(), label_participant_id=(UUID("48596847-3748-1923-4002-388849057321")), apple_music_id="8457874534hfvsldjkf", spotify_id="58bndfjvf93rndsfv", global_participant_id=(UUID("32945678-4567-1923-4002-567891056789")), fullname_localizations=frozenset(), ), Participant( fullname="Some European Remixer", roles={ParticipantRole.REMIXER}, instruments=set(), label_participant_id=(UUID("59595847-3748-1923-4002-388849057421")), apple_music_id="45t34rij34", spotify_id="34rjn34r34", global_participant_id=(UUID("82945678-4567-1923-4011-567891056790")), fullname_localizations=frozenset(), ), Participant( fullname="Fire Pubs", roles={ParticipantRole.PUBLISHER}, instruments={InstrumentRole.GUITAR_BASS_GUITAR}, label_participant_id=None, apple_music_id=None, spotify_id=None, global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="Jimmy Alpine", roles={ParticipantRole.PUBLISHER, ParticipantRole.VOCALS_RAPPER}, instruments=set(), label_participant_id=(UUID("78992034-3333-5948-0120-023948762100")), apple_music_id="eeeewwwww7777777", spotify_id="wwwwweeeee777777", global_participant_id=None, fullname_localizations=frozenset(), ), Participant( fullname="SASIS SILA", roles={ParticipantRole.VOCALS_WHISTLING}, instruments={InstrumentRole.GUITAR_BASS_GUITAR}, label_participant_id=(UUID("78992034-3333-5948-0120-023948762100")), apple_music_id="eeeewwwww7777777", spotify_id="wwwwweeeee777777", global_participant_id=None, fullname_localizations=frozenset(), ), ] @pytest.fixture def product_assets_mock() -> dict[ str, list[ArtworkAsset] | dict[int, list[AudioAsset]] ]: return get_product_assets_mock() def get_product_assets_mock() -> dict[ str, list[ArtworkAsset] | dict[int, list[AudioAsset]] ]: return { "product_assets": [ ArtworkAsset( filename="upc.tif", bucket="test_bucket", asset_type=AssetType.TIF, ), ], "track_assets": { 12345: [ AudioAsset( filename="test_asset.mp3", bucket="test_bucket", duration=120.45, asset_type=AssetType.MP3_192, ), AudioAsset( filename="test_asset_stereo.wav", bucket="test_bucket", duration=120.45, asset_type=AssetType.ATMOS, ), AudioAsset( filename="test_asset_spatial.wav", bucket="test_bucket", duration=120.45, asset_type=AssetType.WAV, ), ], }, }