"""Shared test mocks.""" import pytest @pytest.fixture def mock_graphql_response_subaccount(mock_graphql_response): """Mock graphql response for a subaccount's product.""" mock_graphql_response['data']['product']['label'] = { 'name': 'Subaccount1', 'id': { 'subaccountId': 10, 'vendorId': 16160 }, 'vendor': { 'name': 'Label1' } } return mock_graphql_response @pytest.fixture def mock_row_data(): """Mock row data.""" return { 'reviewQueueId': 1, 'createdDatetime': '', 'productId': 1, } @pytest.fixture def mock_graphql_response(): """Mock graphql response for a label's product.""" return { 'data': { 'product': { 'artists': [ { 'artistId': '7222718', 'artistName': 'Sinaloha', 'artistType': 'primary_artist' }, { 'artistId': '7222720', 'artistName': 'PRONOUN', 'artistType': 'featuring' }, { 'artistId': '7222721', 'artistName': 'PeterPeter', 'artistType': 'remixer' }, { 'artistId': '7222722', 'artistName': 'CCubed', 'artistType': 'producer' } ], 'cLine': '2021 petertest', 'productConfiguration': 'Digital Audio', 'deliveredVersion': 'For Ui', 'format': 'Full Length', 'label': { 'name': 'Non-Mechanical M/USD', 'id': { 'subaccountId': 0, 'vendorId': 16160 } }, 'imageLocation': 'http://image.png', 'imprint': 'petertest', 'metadataLanguage': { 'name': 'English', 'code': 'ENG' }, 'productCode': 'CONTEST02', 'productId': 1, 'productName': 'Contest02', 'preorderDate': None, 'releaseDate': '2022-07-01', 'saleStartDate': '2022-07-01', 'specialInstructions': 'SI', 'subgenre': { 'id': 662, 'genre': { 'id': 20, 'name': 'Blues' } }, 'upc': '196292189827', 'version': 'Content Review UI Testing', 'reviewHistory': { 'totalCount': 0, 'items': [] } } } } @pytest.fixture def mock_index_document(mock_row_data, mock_graphql_response): """Mock an indexed product document.""" product_metadata = mock_graphql_response.get('data').get('product') return { 'added_at': mock_row_data.get('created_datetime'), 'review_queue_id': mock_row_data.get('reviewQueueId'), 'featuring_artist': 'Artist2', 'format': product_metadata.get('format'), 'image_location': product_metadata.get('imageLocation'), 'imprint': product_metadata.get('imprint'), 'label_id': product_metadata.get('label').get('id').get('vendorId'), 'label_name': 'Label1', 'metadata_language_code': product_metadata.get('metadataLanguage').get('code'), 'metadata_language_name': product_metadata.get('metadataLanguage').get('name'), 'preorder_date': product_metadata.get('preorderDate'), 'primary_artist': 'Artist1', 'product_id': mock_row_data.get('product_id'), 'product_name': product_metadata.get('productName'), 'sale_start_date': product_metadata.get('saleStartDate'), 'special_instructions': product_metadata.get('specialInstructions'), 'upc': product_metadata.get('upc'), 'subaccount_id': product_metadata.get('label').get('id').get( 'subaccountId'), 'subaccount_name': '', }