"""Conftest.""" import pytest @pytest.fixture def s3_release_corrections(): """S3 Release Correction JSON file.""" return { 'changes': [] } @pytest.fixture def graphql_response(): """Response from track query.""" return { 'data': { 'track': { 'trackNumber': 1, 'trackName': 'first', 'version': None, 'explicit': 'C', 'metaLanguageCode': 'ENG', 'lyrics': 'track lyrics', 'pInfo': '2018 Sony Music Associated Records', 'primaryArtists': [ {'artistName': 'Giveon', 'artistType': 'performer'}, {'artistName': 'Artist', 'artistType': 'featuring'}, {'artistName': 'Resource Contributor Producer', 'artistType': 'producer'} # noqa ], 'writers': [ {'name': 'Composer Name', 'type': 'writer'}, {'name': 'ComposerLyricist Name', 'type': 'writer'}, {'name': 'StudioMusician Name', 'type': 'writer'}, {'name': 'VocalEngineer Name', 'type': 'writer'}, ], 'performers': [ {'name': 'PrimaryMusician Name', 'roleId': 27, 'type': 'primary'}, # noqa {'name': 'PrimaryMusician Name', 'roleId': 129, 'type': 'primary'}, # noqa {'name': 'BackgroundVocalist Name', 'roleId': 74, 'type': 'primary'}, # noqa {'name': 'StudioMusician Name', 'roleId': 27, 'type': 'non-featured'}, # noqa {'name': 'StudioMusician Name', 'roleId': 10, 'type': 'non-featured'}, # noqa ], 'labelSoundRecording': { 'participations': [ { 'role': {'name': 'Vocal Engineer'}, # noqa 'participant': {'id': '82', 'name': 'VocalEngineer Name'} # noqa }, { 'role': {'name': 'A & R Administrator'}, 'participant': {'id': '72', 'name': 'StudioMusician Name'} # noqa }, { 'role': {'name': 'A & R Coordinator'}, 'participant': {'id': '72', 'name': 'StudioMusician Name'} # noqa }, { 'role': {'name': 'Recording Engineer'}, 'participant': {'id': '102', 'name': 'Resource Contributor Producer'} # noqa } ], }, }, 'createProductCorrectionDetail': {}, } } @pytest.fixture def mock_event(): """Mock event.""" return { 'context': { 'product': { 'status': None, 'not_for_distribution': 'N', 'display_artist_name': 'Cool Artist', 'vendor_id': 123, 'subaccount_id': 456, 'upc': '231232563123', 'product_id': 234324, 'is_main_release': True, 'release_type': 'release', 'release_reference': 'R0', 'original_release_date': '2020-03-25', 'artwork': None, 'grid': 'A0145345234523453452', 'catalog_number': 'G0134523452345245', 'product_name': 'Test Artist', 'genres': [ { 'genre': 'ELECTRONICA-00', 'subgenre': 'Alternative' } ], }, 'tracks': [ { 'release_reference': 'R1', 'asset': { 'filename': 'audio.flac', 'filepath': 'resources/', 'bucket': 'ddex-bucket', 'key': 'folder/subfolder/resources/audio.flac' }, 'volume': 1, 'tuid': 45677, 'sequence_number': 1, 'isrc': 'USSM12001698', 'release_type': 'TrackRelease', 'track_name': 'first', 'track_version': None, 'lyrics_language': 'ENG', 'explicit': 'C', 'p_line': '2018 Sony Music Associated Records', 'lyrics': 'track lyrics', 'recording_country_code': 'US', 'copyright_owner_country': 'US', 'ownership_rights': 'OWNED', 'us_publishing_obligation': 'composition', 'offer_type': 'STREAMING_ONLY', 'publishers': [ 'publisher1', 'publisher1', 'publisher2', 'publisher3', ], 'localized_titles': [ { 'language_code': 'ru', 'title': 'Russian Title', 'version': 'Remaster' } ], 'display_artists': [ { 'name': 'Giveon', 'sequence_number': 1, 'apple_id': '1A', 'spotify_uri': '1S', 'roles': ['MainArtist'], 'localized_names': [{ 'language_code': 'ru', 'name': 'Russian Giveon', }], }, { 'name': 'Artist', 'sequence_number': 2, 'apple_id': '2A', 'spotify_uri': '2S', 'roles': ['FeaturedArtist', 'TestRole'], 'localized_names': [{ 'language_code': 'ru', 'name': 'Russian Artist', }], }, { 'name': 'Composer Name', 'sequence_number': 3, 'apple_id': '3A', 'spotify_uri': '3S', 'roles': ['Composer'] }, { 'name': 'ComposerLyricist Name', 'sequence_number': 4, 'apple_id': '4A', 'spotify_uri': '4S', 'roles': ['ComposerLyricist', 'TestRole'] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 5, 'apple_id': '5A', 'spotify_uri': '5S', 'roles': ['PrimaryMusician', 'Soloist'] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 6, 'apple_id': '6A', 'spotify_uri': '6S', 'roles': ['AssociatedPerformer', 'Choir'] }, { 'name': 'BackgroundVocalist Name', 'sequence_number': 7, 'apple_id': '7A', 'spotify_uri': '7S', 'roles': ['BackgroundVocalist', 'TestRole'] }, ], 'resource_contributors': [ { 'name': 'StudioMusician Name', 'sequence_number': 8, 'apple_id': '8A', 'spotify_uri': '8S', 'roles': [ 'StudioMusician', 'DJ', 'AAndRAdministrator', 'ARAdministrator', 'ARCoordinator', 'Composer', ] }, { 'name': 'VocalEngineer Name', 'sequence_number': 7, 'apple_id': '9A', 'spotify_uri': '9S', 'roles': [ 'VocalEngineer', 'ComposerLyricist', ] }, { 'name': 'Resource Contributor Producer', 'sequence_number': 9, 'apple_id': '8AA', 'spotify_uri': '8SS', 'roles': [ 'Producer', 'RecordingEngineer' ] }, ], 'preview_start_time': 30, 'resource_reference': 'A1', }, { 'release_reference': 'R1', 'asset': { 'filename': 'audio.flac', 'filepath': 'resources/', 'bucket': 'ddex-bucket', 'key': 'folder/subfolder/resources/audio.flac' }, 'volume': 1, 'tuid': 45678, 'sequence_number': 1, 'isrc': 'USSM12001699', 'release_type': 'TrackRelease', 'track_name': 'second', 'track_version': None, 'lyrics_language': 'ENG', 'explicit': 'C', 'p_line': '2018 Sony Music Associated Records', 'resource_reference': 'A1', }, ], 'label_participants': [ { 'name': 'Giveon', 'artist_id': '11', 'label_participant_id': '12', 'label_participant_uuid': 'AAA', }, { 'name': 'Artist', 'artist_id': '21', 'label_participant_id': '22', 'label_participant_uuid': 'BBB', }, { 'name': 'Composer Name', 'artist_id': '31', 'label_participant_id': '32', 'label_participant_uuid': 'CCC', }, { 'name': 'ComposerLyricist Name', 'artist_id': '41', 'label_participant_id': '42', 'label_participant_uuid': 'DDD', }, { 'name': 'PrimaryMusician Name', 'artist_id': '51', 'label_participant_id': '52', 'label_participant_uuid': 'EEE', }, { 'name': 'BackgroundVocalist Name', 'artist_id': '61', 'label_participant_id': '62', 'label_participant_uuid': 'FFF', }, { 'name': 'StudioMusician Name', 'artist_id': '71', 'label_participant_id': '72', 'label_participant_uuid': 'GGG', }, { 'name': 'VocalEngineer Name', 'artist_id': '81', 'label_participant_id': '82', 'label_participant_uuid': 'HHH', }, { 'name': 'FeatArtist', 'artist_id': '91', 'label_participant_id': '92', 'label_participant_uuid': 'III', }, { 'name': 'Resource Contributor Producer', 'artist_id': '101', 'label_participant_id': '102', 'label_participant_uuid': 'JJJ' } ], 'error_correction': { 'release_correction_id': 123, 'release_id': 999, 'items': [] }, 'ddex_provider': 'SME', 'deals': None, 'bucket': 'ddex-bucket', 'key': 'key', 'message_id': '345243524', 'message_thread_id': 'G01452345234524_3452345', 'update_indicator': 'OriginalMessage', 'party_id': 'PADPIDA2012041004F', }, 'track': { 'release_reference': 'R1', 'resource_reference': 'A1', 'asset': { 'filename': 'audio.flac', 'filepath': 'resources/', 'bucket': 'ddex-bucket', 'key': 'folder/subfolder/resources/audio.flac' }, 'volume': 1, 'tuid': 45677, 'sequence_number': 1, 'isrc': 'USSM12001698', 'release_type': 'TrackRelease', 'track_name': 'first', 'track_version': None, 'lyrics_language': 'ENG', 'explicit': 'C', 'p_line': '2018 Sony Music Associated Records', 'recording_country_code': 'US', 'display_artists': [ { 'name': 'Giveon', 'sequence_number': 1, 'apple_id': '1A', 'spotify_uri': '1S', 'roles': [ 'MainArtist' ] }, { 'name': 'Artist', 'sequence_number': 2, 'apple_id': '2A', 'spotify_uri': '2S', 'roles': [ 'FeaturedArtist', 'TestRole' ] }, { 'name': 'Composer Name', 'sequence_number': 3, 'apple_id': '3A', 'spotify_uri': '3S', 'roles': [ 'Composer' ] }, { 'name': 'ComposerLyricist Name', 'sequence_number': 4, 'apple_id': '4A', 'spotify_uri': '4S', 'roles': [ 'ComposerLyricist', 'TestRole' ] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 5, 'apple_id': '5A', 'spotify_uri': '5S', 'roles': [ 'PrimaryMusician', 'Soloist', ] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 6, 'apple_id': '6A', 'spotify_uri': '6S', 'roles': [ 'AssociatedPerformer', 'Choir' ] }, { 'name': 'BackgroundVocalist Name', 'sequence_number': 7, 'apple_id': '7A', 'spotify_uri': '7S', 'roles': [ 'BackgroundVocalist', 'TestRole' ] }, ], 'resource_contributors': [ { 'name': 'StudioMusician Name', 'sequence_number': 8, 'apple_id': '8A', 'spotify_uri': '8S', 'roles': [ 'StudioMusician', 'DJ', 'AAndRAdministrator', 'ARAdministrator', 'ARCoordinator' ] }, { 'name': 'VocalEngineer Name', 'sequence_number': 7, 'apple_id': '9A', 'spotify_uri': '9S', 'roles': [ 'VocalEngineer' ] } ], } } @pytest.fixture def graphql_release_correction(): """Mock release correction GraphQL response.""" return { 'data': { 'productByUpc': { 'releaseCorrection': { 'releaseId': 3106144, 'releaseCorrectionId': 319460, 'status': 'active', 'items': [ { 'keyValue': '[{\'type\':\'performer\',\'name\':\'Digital Farm Animals\'},{\'type\':\'performer\',\'name\':\'Cash Cash\'}]', # noqa 'tableName': 'track', 'fieldName': 'track_artist', 'keyId': 33421938, 'releaseCorrectionDetailId': 4541830 }, { 'keyValue': '[405]', 'tableName': 'releases', 'fieldName': 'release_subgenre', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541831 }, { 'keyValue': '[]', 'tableName': 'releases', 'fieldName': 'release_artist', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541832 }, { 'keyValue': '8', 'tableName': 'releases', 'fieldName': 'genre_id', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541833 }, { 'keyValue': '[]', 'tableName': 'releases', 'fieldName': 'composer', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541834 }, { 'keyValue': '[]', 'tableName': 'releases', 'fieldName': 'ensemble', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541835 }, { 'keyValue': '[]', 'tableName': 'releases', 'fieldName': 'orchestra', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541836 }, { 'keyValue': '[]', 'tableName': 'releases', 'fieldName': 'conductor', 'keyId': 3106144, 'releaseCorrectionDetailId': 4541837 } ] } } } } @pytest.fixture def mock_update_track_metadata_event(): """Mock event.""" return { 'context': { 'product': { 'status': None, 'not_for_distribution': 'N', 'display_artist_name': 'Cool Artist', 'vendor_id': 123, 'subaccount_id': 456, 'upc': '231232563123', 'product_id': 234324, 'is_main_release': True, 'release_type': 'release', 'release_reference': 'R0', 'original_release_date': '2020-03-25', 'artwork': None, 'grid': 'A0145345234523453452', 'catalog_number': 'G0134523452345245', 'product_name': 'Test Artist', 'genres': [ { 'genre': 'ELECTRONICA-00', 'subgenre': 'Alternative' } ], }, 'tracks': [ { 'release_reference': 'R1', 'asset': { 'filename': 'audio.flac', 'filepath': 'resources/', 'bucket': 'ddex-bucket', 'key': 'folder/subfolder/resources/audio.flac' }, 'volume': 1, 'tuid': 45677, 'sequence_number': 1, 'isrc': 'USSM12001698', 'release_type': 'TrackRelease', 'track_name': 'first', 'track_version': None, 'lyrics_language': 'ENG', 'explicit': 'C', 'p_line': '2018 Sony Music Associated Records', 'lyrics': 'track lyrics', 'recording_country_code': 'US', 'copyright_owner_country': 'US', 'ownership_rights': 'OWNED', 'us_publishing_obligation': 'composition', 'offer_type': 'STREAMING_ONLY', 'publishers': [ 'publisher1', 'publisher1', 'publisher2', 'publisher3', ], 'localized_titles': [ { 'language_code': 'ru', 'title': 'Russian Title', 'version': 'Remaster' } ], 'display_artists': [ { 'name': 'Giveon', 'sequence_number': 1, 'apple_id': '1A', 'spotify_uri': '1S', 'roles': ['MainArtist'], 'localized_names': [{ 'language_code': 'ru', 'name': 'Russian Giveon', }], }, { 'name': 'Artist', 'sequence_number': 2, 'apple_id': '2A', 'spotify_uri': '2S', 'roles': ['FeaturedArtist', 'TestRole'], 'localized_names': [{ 'language_code': 'ru', 'name': 'Russian Artist', }], }, { 'name': 'Composer Name', 'sequence_number': 3, 'apple_id': '3A', 'spotify_uri': '3S', 'roles': ['Composer'] }, { 'name': 'ComposerLyricist Name', 'sequence_number': 4, 'apple_id': '4A', 'spotify_uri': '4S', 'roles': ['ComposerLyricist', 'TestRole'] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 5, 'apple_id': '5A', 'spotify_uri': '5S', 'roles': ['PrimaryMusician', 'Soloist'] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 6, 'apple_id': '6A', 'spotify_uri': '6S', 'roles': ['AssociatedPerformer', 'Choir'] }, { 'name': 'BackgroundVocalist Name', 'sequence_number': 7, 'apple_id': '7A', 'spotify_uri': '7S', 'roles': ['BackgroundVocalist', 'TestRole'] }, ], 'resource_contributors': [ { 'name': 'StudioMusician Name', 'sequence_number': 8, 'apple_id': '8A', 'spotify_uri': '8S', 'roles': [ 'StudioMusician', 'DJ', 'AAndRAdministrator', 'ARAdministrator', 'ARCoordinator', 'Composer', ] }, { 'name': 'VocalEngineer Name', 'sequence_number': 7, 'apple_id': '9A', 'spotify_uri': '9S', 'roles': [ 'VocalEngineer', 'ComposerLyricist', ] }, { 'name': 'Resource Contributor Producer', 'sequence_number': 9, 'apple_id': '8AA', 'spotify_uri': '8SS', 'roles': [ 'Producer', 'RecordingEngineer' ] }, ], 'preview_start_time': 30, 'resource_reference': 'A1', }, { 'release_reference': 'R1', 'asset': { 'filename': 'audio.flac', 'filepath': 'resources/', 'bucket': 'ddex-bucket', 'key': 'folder/subfolder/resources/audio.flac' }, 'volume': 1, 'tuid': 45678, 'sequence_number': 1, 'isrc': 'USSM12001699', 'release_type': 'TrackRelease', 'track_name': 'second', 'track_version': None, 'lyrics_language': 'ENG', 'explicit': 'C', 'p_line': '2018 Sony Music Associated Records', 'resource_reference': 'A1', }, ], 'participants': [ { 'name': 'Giveon', 'artist_id': '11', 'label_participant_id': '12', 'label_participant_uuid': 'AAA', }, { 'name': 'Artist', 'artist_id': '21', 'label_participant_id': '22', 'label_participant_uuid': 'BBB', }, { 'name': 'Composer Name', 'artist_id': '31', 'label_participant_id': '32', 'label_participant_uuid': 'CCC', }, { 'name': 'ComposerLyricist Name', 'artist_id': '41', 'label_participant_id': '42', 'label_participant_uuid': 'DDD', }, { 'name': 'PrimaryMusician Name', 'artist_id': '51', 'label_participant_id': '52', 'label_participant_uuid': 'EEE', }, { 'name': 'BackgroundVocalist Name', 'artist_id': '61', 'label_participant_id': '62', 'label_participant_uuid': 'FFF', }, { 'name': 'StudioMusician Name', 'artist_id': '71', 'label_participant_id': '72', 'label_participant_uuid': 'GGG', }, { 'name': 'VocalEngineer Name', 'artist_id': '81', 'label_participant_id': '82', 'label_participant_uuid': 'HHH', }, { 'name': 'FeatArtist', 'artist_id': '91', 'label_participant_id': '92', 'label_participant_uuid': 'III', }, { 'name': 'Resource Contributor Producer', 'artist_id': '101', 'label_participant_id': '102', 'label_participant_uuid': 'JJJ' } ], 'error_correction': { 'release_correction_id': 123, 'release_id': 999, 'items': [] }, 'ddex_provider': 'SME', 'deals': None, 'bucket': 'ddex-bucket', 'key': 'key', 'message_id': '345243524', 'message_thread_id': 'G01452345234524_3452345', 'update_indicator': 'OriginalMessage', 'party_id': 'PADPIDA2012041004F', 'label_participants': [ { 'name': 'Giveon', 'artist_id': '11', 'label_participant_id': '12', 'label_participant_uuid': 'AAA', }, { 'name': 'Artist', 'artist_id': '21', 'label_participant_id': '22', 'label_participant_uuid': 'BBB', }, { 'name': 'Composer Name', 'artist_id': '31', 'label_participant_id': '32', 'label_participant_uuid': 'CCC', }, { 'name': 'ComposerLyricist Name', 'artist_id': '41', 'label_participant_id': '42', 'label_participant_uuid': 'DDD', }, { 'name': 'PrimaryMusician Name', 'artist_id': '51', 'label_participant_id': '52', 'label_participant_uuid': 'EEE', }, { 'name': 'BackgroundVocalist Name', 'artist_id': '61', 'label_participant_id': '62', 'label_participant_uuid': 'FFF', }, { 'name': 'StudioMusician Name', 'artist_id': '71', 'label_participant_id': '72', 'label_participant_uuid': 'GGG', }, { 'name': 'VocalEngineer Name', 'artist_id': '81', 'label_participant_id': '82', 'label_participant_uuid': 'HHH', }, { 'name': 'FeatArtist', 'artist_id': '91', 'label_participant_id': '92', 'label_participant_uuid': 'III', }, { 'name': 'Resource Contributor Producer', 'artist_id': '101', 'label_participant_id': '102', 'label_participant_uuid': 'JJJ' } ] }, 'track': { 'release_reference': 'R1', 'resource_reference': 'A1', 'asset': { 'filename': 'audio.flac', 'filepath': 'resources/', 'bucket': 'ddex-bucket', 'key': 'folder/subfolder/resources/audio.flac' }, 'volume': 1, 'tuid': 45677, 'sequence_number': 1, 'isrc': 'USSM12001698', 'release_type': 'TrackRelease', 'track_name': 'first', 'track_version': None, 'lyrics_language': 'ENG', 'explicit': 'C', 'p_line': '2018 Sony Music Associated Records', 'recording_country_code': 'US', 'display_artists': [ { 'name': 'Giveon', 'sequence_number': 1, 'apple_id': '1A', 'spotify_uri': '1S', 'roles': [ 'MainArtist' ] }, { 'name': 'Artist', 'sequence_number': 2, 'apple_id': '2A', 'spotify_uri': '2S', 'roles': [ 'FeaturedArtist', 'TestRole' ] }, { 'name': 'Composer Name', 'sequence_number': 3, 'apple_id': '3A', 'spotify_uri': '3S', 'roles': [ 'Composer' ] }, { 'name': 'ComposerLyricist Name', 'sequence_number': 4, 'apple_id': '4A', 'spotify_uri': '4S', 'roles': [ 'ComposerLyricist', 'TestRole' ] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 5, 'apple_id': '5A', 'spotify_uri': '5S', 'roles': [ 'PrimaryMusician', 'Soloist', ] }, { 'name': 'PrimaryMusician Name', 'sequence_number': 6, 'apple_id': '6A', 'spotify_uri': '6S', 'roles': [ 'AssociatedPerformer', 'Choir' ] }, { 'name': 'BackgroundVocalist Name', 'sequence_number': 7, 'apple_id': '7A', 'spotify_uri': '7S', 'roles': [ 'BackgroundVocalist', 'TestRole' ] }, ], 'resource_contributors': [ { 'name': 'StudioMusician Name', 'sequence_number': 8, 'apple_id': '8A', 'spotify_uri': '8S', 'roles': [ 'StudioMusician', 'DJ', 'AAndRAdministrator', 'ARAdministrator', 'ARCoordinator' ] }, { 'name': 'VocalEngineer Name', 'sequence_number': 7, 'apple_id': '9A', 'spotify_uri': '9S', 'roles': [ 'VocalEngineer' ] } ], } } @pytest.fixture def mock_update_track_metadata_payload(): """Mock event.""" return {'update': {'tracks': [45677], 'body': {'upc': '231232563123', 'isrc': 'USSM12001698', 'trackName': 'first', 'metaLanguageCode': 'ENG', 'explicit': 'C', 'pInfo': '2018 Sony Music Associated Records', 'lyrics': 'track lyrics', 'recordingCountryId': 1, 'originalRightsHolderCountryId': 1, 'ownershipRights': 'original_owner', 'usPublishingObligation': 'COMPOSITION', 'participations': [ {'labelParticipantUuid': 'AAA', 'role': 'PERFORMER', 'localizations': [{'languageId': 35, 'name': 'Russian Giveon'}]}, {'labelParticipantUuid': 'BBB', 'role': 'FEATURED_ARTIST', 'localizations': [ {'languageId': 35, 'name': 'Russian Artist'}]}, {'labelParticipantUuid': 'CCC', 'role': 'COMPOSER'}, {'labelParticipantUuid': 'CCC', 'role': 'WRITER'}, {'labelParticipantUuid': 'DDD', 'role': 'WRITER'}, {'labelParticipantUuid': 'GGG', 'role': 'COMPOSER'}, {'labelParticipantUuid': 'GGG', 'role': 'WRITER'}, {'labelParticipantUuid': 'HHH', 'role': 'WRITER'}, {'labelParticipantUuid': 'JJJ', 'role': 'PRODUCER'}], 'performers': [ {'name': 'PrimaryMusician Name', 'roleId': 27, 'type': 'primary'}, {'name': 'PrimaryMusician Name', 'roleId': 129, 'type': 'primary'}, {'name': 'BackgroundVocalist Name', 'roleId': 74, 'type': 'primary'}, {'name': 'StudioMusician Name', 'roleId': 27, 'type': 'non-featured'}, {'name': 'StudioMusician Name', 'roleId': 10, 'type': 'non-featured'}], 'publishers': [{'name': 'publisher1'}, {'name': 'publisher2'}, {'name': 'publisher3'}], 'localizations': [{'languageId': 35, 'trackName': 'Russian Title', 'version': 'Remaster'}], 'previewStartTime': 30000, 'offerType': 'STREAM_ONLY'}}}