"""Test Setup.""" import pytest @pytest.fixture def mock_event(): """Mock an event.""" return { 'abacus_event_id': 1, 'target_type': 'accounting_run', 'target_id': '1506', 'event_name': 'reserves_take', 'timestamp': '2020-01-10T01:12:25.15+01:00', 'user_type': 'royalties', 'user_id': '1' } @pytest.fixture def mock_contract_reserves_response(): """Mock contract reserve response body.""" return [ { 'reserve_rate': '18.00', 'release_schedule': [ '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666667', '0.066666666662' ], 'contract_reserve_id': 1, 'installments_in_months': 15, 'reserve_release_offset_in_months': 10, 'contract_id': 500286 }, { 'reserve_rate': '18.00', 'release_schedule': [ '0.999999999999', '0.000000000001' ], 'contract_reserve_id': 2, 'installments_in_months': 2, 'reserve_release_offset_in_months': 1, 'contract_id': 500295 } ] @pytest.fixture def mock_contract_ids_response(): """Mock contract_ids response body.""" return [ 500286, 500295, 500293, 500287, 500008, 500009, 500010 ] @pytest.fixture def mock_ledger_reserve_taken_body(): """Mock body for POST /ledger_reserve_taken request.""" return [ { 'abacus_event_id': 1, 'contract_reserve_id': 123, 'accounting_run_id': 12, 'statement_period_id': 270, 'currency_code': 'EUR', 'gross_sales': '1234.56', 'gross_returns': '-789.12', 'net_revenue': '445.44', 'reserve_amount': '-80.18', 'net_revenue_after_reserve': '365.26' } ] @pytest.fixture def mock_ledger_deposit_body(): """Mock body for POST /ledger/bulk request.""" return [ { 'account_id': 3456, 'contract_id': 6543, 'abacus_event_id': 1, 'model_type': 'deposit', 'currency_code': 'EUR', 'rounded_amount': '445.44', 'remaining_amount': '0.003322109989' } ] @pytest.fixture def mock_accounting_run_response(): """Mock response for GET accounting run detail request.""" return { 'accounting_period_name': 'Test 2', 'accounting_run_status': 'Committed', 'run_controller_name': 'AWAL GDA', 'run_controller_id': 3, 'start_date': '2022-07-14', 'accounting_period_id': 3, 'accounting_run_id': 35, 'summary_export_url': 's3://test-2-awal-gda-summary.tsv' } @pytest.fixture def mock_accounting_period_response(): """Mock response for GET accounting period detail request.""" return { 'accounting_period_name': 'Test 2', 'statement_period_id': 267, 'closed_date': '2022-07-14', 'accounting_period_status': 'closed', 'contract_type': 'distribution', 'accounting_period_id': 3 } @pytest.fixture def mock_sales_transactions_response(): """Mock response from Snowflake to get sales transactions.""" return [ { 'CONTRACT_ID': 500005, 'ACCOUNT_ID': 35968, 'CURRENCY_CODE': 'AUD', 'PHYSICAL_SALES_ACCOUNT_CURRENCY': '161.527018347541', 'PHYSICAL_RETURNS_ACCOUNT_CURRENCY': '-12.352832640000' }, { 'CONTRACT_ID': 500286, 'ACCOUNT_ID': 35976, 'CURRENCY_CODE': 'GBP', 'PHYSICAL_SALES_ACCOUNT_CURRENCY': '2142.428780856736', 'PHYSICAL_RETURNS_ACCOUNT_CURRENCY': '-9.298115505883' }, { 'CONTRACT_ID': 500295, 'ACCOUNT_ID': 35978, 'CURRENCY_CODE': 'JPY', 'PHYSICAL_SALES_ACCOUNT_CURRENCY': '1689.554338237098', 'PHYSICAL_RETURNS_ACCOUNT_CURRENCY': '-8.142076865883' } ]