"""conftest.""" from decimal import Decimal from pytest import fixture @fixture def mock_statement_periods(): """Mock statement periods.""" return { 2024: { 1: 301, 2: 302 } } @fixture def mock_reference_adjustment_types(): """Mock UPCs.""" return {'label earnings': 1, 'publisher earnings': 2, 'legal fees': 3} @fixture def mock_event(): """Mock abacus event.""" return { 'abacus_event_id': 1, 'target_type': 'statement_period_adjustment_file', 'target_id': '1', 'statement_period_id': 123, 'event_name': 'adjustment_file_worksheet_import', 'event_date': '2021-07-11T11:20:35.45+01:00' } @fixture def mock_adjustment_file_content(): """Mock adjustment file data.""" return [{ 'account_id': '68952', 'contract_id': '533565', 'upc': '196626383143', 'amount': '-50.8979990', 'currency': 'USD', 'activity_year': 2024, 'activity_month': 1, 'statement_year': 2024, 'statement_month': 2, 'adjustment_type': 'Label Earnings', 'client_facing_comments': 'comment', 'distribution_type': 'digital', 'internal_note': None }, { 'account_id': '123456', 'contract_id': '908781', 'upc': None, 'amount': '-50.8979990', 'currency': 'USD', 'activity_year': 2024, 'activity_month': 1, 'statement_year': 2024, 'statement_month': 2, 'adjustment_type': 'Publisher Earnings', 'client_facing_comments': 'comment', 'distribution_type': None, 'internal_note': None }] @fixture def mock_adjustment_file_content_special_characters(): """Mock adjustment file data with special characters.""" return [{ 'account_id': '68952\u200B', 'contract_id': '533565 ', 'upc': '196626383143\xa0', 'amount': '-50.8979990', 'currency': 'USD', 'activity_year': 2024, 'activity_month': 1, 'statement_year': 2024, 'statement_month': 2, 'adjustment_type': 'Label Earnings', 'client_facing_comments': 'comment', 'distribution_type': 'digital', 'internal_note': None }, { 'account_id': '123456', 'contract_id': '908781', 'upc': None, 'amount': '-50.8979990', 'currency': 'USD', 'activity_year': 2024, 'activity_month': 1, 'statement_year': 2024, 'statement_month': 2, 'adjustment_type': 'Publisher Earnings', 'client_facing_comments': 'comment', 'distribution_type': None, 'internal_note': None }] @fixture def mock_worksheet_adjustment_details(): """Mock worksheet_adjustment_details.""" return [{ 'statement_period_adjustment_file_id': 1, 'account_id': '1234', 'contract_id': '1234', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 1, 'amount': Decimal('-90.122'), 'currency_code': 'USD', 'upc': '1234567890', 'distribution_type': 'digital', 'note': None, 'internal_note': None, 'apply_to_flowthrough_payment': True }, { 'statement_period_adjustment_file_id': 1, 'account_id': '1234', 'contract_id': '1234', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 1, 'amount': Decimal('1897.678'), 'currency_code': 'USD', 'upc': '196925277303', 'distribution_type': 'digital', 'note': None, 'internal_note': None, 'apply_to_flowthrough_payment': 1 }] @fixture def mock_worksheet_adjustment_details_special_characters(): """Mock worksheet_adjustment_details with special characters.""" return [{ 'statement_period_adjustment_file_id': 1, 'account_id': '1234\xa0', 'contract_id': '1234\u200B', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 1, 'amount': Decimal('-90.122 '), 'currency_code': 'USD', 'upc': '1234567890', 'distribution_type': 'digital', 'note': None, 'internal_note': None }, { 'statement_period_adjustment_file_id': 1, 'account_id': '1234', 'contract_id': '1234', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 1, 'amount': Decimal('1897.678'), 'currency_code': 'USD', 'upc': '196925277303', 'distribution_type': 'digital', 'note': None, 'internal_note': None }] @fixture def mock_expense_details_entries(): """Mock expense entries.""" return [{ 'worksheet_adjustment': { 'statement_period_adjustment_file_id': 1, 'abacus_event_id': 1, 'account_id': '1234', 'contract_id': '1234', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 65, 'adjustment_amount': Decimal('1807.556'), 'adjustment_currency_code': 'USD', 'note': None, 'internal_note': None, 'apply_to_flowthrough_payment': None }, 'worksheet_adjustment_detail': [{ 'statement_period_adjustment_file_id': 1, 'account_id': '1234', 'contract_id': '1234', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 1, 'amount': Decimal('-90.122'), 'currency_code': 'USD', 'upc': '1234567890', 'distribution_type': 'digital', 'note': None, 'internal_note': None }, { 'statement_period_adjustment_file_id': 1, 'account_id': '1234', 'contract_id': '1234', 'activity_statement_period_id': 301, 'apply_to_statement_period_id': 302, 'reference_adjustment_type_id': 1, 'amount': Decimal('1897.678'), 'currency_code': 'USD', 'upc': '196925277303', 'distribution_type': 'digital', 'note': None, 'internal_note': None }] }]