"""Configuration for tests.""" from datetime import datetime import pytest from soundrecording_utils.metadata.types import Asset from soundrecording_utils.metadata.types import ExplicitStatus from soundrecording_utils.metadata.types import FingerprintRule from soundrecording_utils.metadata.types import Genre from soundrecording_utils.metadata.types import HasFingerprintRules from soundrecording_utils.metadata.types import Label from soundrecording_utils.metadata.types import LabelID from soundrecording_utils.metadata.types import LabelParticipant from soundrecording_utils.metadata.types import LabelType from soundrecording_utils.metadata.types import Language from soundrecording_utils.metadata.types import OrchardSoundRecording from soundrecording_utils.metadata.types import Product from soundrecording_utils.metadata.types import ProductStatus from soundrecording_utils.metadata.types import Profile from soundrecording_utils.metadata.types import Subgenre from soundrecording_utils.metadata.types import Track from soundrecording_utils.metadata.types import TrackConnection from soundrecording_utils.metadata.types import TrackParticipation @pytest.fixture def execution_meta(): """Create Execution Metadata with default values.""" return { 'message_thread_id': 'message_thread_id', 'message_id': 'message_id', 'timestamp': datetime.fromisoformat('2020-01-02T03:04:05+00:00'), } @pytest.fixture def mock_vendor_rules() -> HasFingerprintRules: """Create a mock vendor rules with default values.""" return HasFingerprintRules( rules=[] ) @pytest.fixture def mock_label( mock_vendor_rules: HasFingerprintRules, mock_fingerprint_rule: FingerprintRule) -> Label: """Create a mock label with default values.""" return Label( uuid='94177d6a-51d4-496f-aa1a-a52b75516814', name='Test Label', type=LabelType('Subaccount'), id=LabelID( vendor=999, subaccount=888 ), rules=[], vendor=mock_vendor_rules ) @pytest.fixture def mock_product(mock_label: Label) -> Product: """Create a mock product with default values.""" return Product( label=mock_label, status=ProductStatus.in_content, release_date='2019-06-15', subgenre=Subgenre( id=2, name='Electronic', genre=Genre( id=1, name='Rock' ) ), id='777', display_upc='upc-123' ) @pytest.fixture def mock_label_participant() -> LabelParticipant: """Create a mock LabelParticipant with default values.""" return LabelParticipant( name='Test Participant', uuid='00000000-0000-0000-0000-000000000000' ) @pytest.fixture def mock_track_participation( mock_label_participant: LabelParticipant, ) -> TrackParticipation: """Create a mock Track Participation with default values.""" return TrackParticipation( participant=mock_label_participant, participated_as='performer' ) @pytest.fixture def mock_track( mock_product: Product, mock_asset: Asset, mock_fingerprint_rule: FingerprintRule) -> Track: """Create a mock track with default values.""" return Track( tuid='123', primary=True, explicit=ExplicitStatus.N, product=mock_product, isrc='XXAAA2100000', name='Test Track Name', version=None, duration_minutes=1, duration_seconds=2, meta_language_code=None, language=Language(iso_639_1_code=None), p_info='2021 Example Label', territories=['XX'], participations=[], original_rights_holder_country=None, recording_country=None, label_sound_recording=None, rules=[mock_fingerprint_rule] ) @pytest.fixture def mock_asset() -> Asset: """Create a mock asset with default values.""" return Asset( uuid='b3955ca9-bfb0-4d09-8f18-9eb4fd8737ff', filename='90e575bd-94a5-4a3e-9f1f-dade36feb8c3', extension='flac', ) @pytest.fixture def mock_orchard_sound_recording( mock_track: Track, mock_asset: Asset) -> OrchardSoundRecording: """Create a mock OrchardSoundRecording with one track.""" return OrchardSoundRecording( isrc='isrc-123', track_connection=TrackConnection( tracks=[ mock_track, ], ), assets=[mock_asset] ) @pytest.fixture def mock_profile() -> Profile: """Create a mock profile with default values.""" return Profile( id='123', type='ORCHADMIN' ) @pytest.fixture def mock_fingerprint_rule(mock_profile: Profile) -> FingerprintRule: """Create a mock fingerprint rule with * values.""" return FingerprintRule( active=True, start_date='2024-01-01T10:01:40.000Z', end_date=None, territory='*', policy='monetize', service='*', created_by=mock_profile, last_modified_by=mock_profile, created_date='2023-01-01T10:25:17.227Z', last_modified_date='2023-01-01T10:25:17.227Z' )