"""Tests for sound recordings metadata schema.""" from sound_recordings.schemas.sound_recording_metadata import ( SoundRecordingMetadataSchema, ) class TestSoundRecordingMetadataSchema: """Tests for SoundRecordingMetadataSchema.""" unnormalized = { "artist_name": "The Drums", "artists": [{"artist_name": "The Drums", "type": "performer"}], "first_id": "label:6971:isrc:GBUM71105426", "isrc": "GBUM71105426", "label_id": "6971", "product_id": "320039", "products": [ { "artists": [{"artist_name": "The Drums", "type": "performer"}], "image_location": "https://qa-images.theorchard.io/product/large_cover/1dab096719e6786012d07c6bb67dcf51.jpg", # noqa "product_id": "320039", "release_artist": "The Drums", "release_date": "2011-09-06", "release_version": "Full Length", "release_id": "886788021921", "release_name": "Portamento", "release_format": "Album", "sales_start_date": "2011-09-06", "track_cd": 1, "track_number": 4, "product_version": "Deluxe", "subaccount_id": "12345", "subaccount_name": "Hickman Holler Records", } ], "second_id": "label:6971:isrc:GBUM71105426", "subaccount_id": None, "track_name": "Money", "track_unique_id": "4203496", "upc": "886788106154", } normalized = { "artist_name": "The Drums", "isrc": "GBUM71105426", "name": "Money", "primary_artists": [{"artist_name": "The Drums", "artist_type": "performer"}], "products": [ { "format": "Album", "primary_artists": [ {"artist_name": "The Drums", "artist_type": "performer"} ], "product_id": "320039", "product_name": "Portamento", "release_date": "2011-09-06T00:00:00Z", "sale_start_date": "2011-09-06T00:00:00Z", "version": "Full Length", "upc": "886788021921", "subaccount_id": "12345", "subaccount_name": "Hickman Holler Records", } ], } def test_normalize(self): """Test normalizing a model payload into JSON format.""" assert ( SoundRecordingMetadataSchema.normalize(self.unnormalized) == self.normalized )