"""Fixtures for the adjustments validation functional tests.""" import pytest from abacus_common_logic.adjustments_validation.types_definitions import ( Adjustment, ) # NOTE: Importing the unit tests fixture to be accessible to the functional tests from tests.unit.adjustments_validation.conftest import sf_config_mock @pytest.fixture def adjustments_mock() -> list[Adjustment]: """Return some adjustments to validate.""" return [ # Fail: Missing Account { 'account_id': '11', 'contract_id': '1', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Adjustment', 'client_facing_comments': 'Comments', }, # Fail: Missing Contract { 'account_id': '1', 'contract_id': '11', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Adjustment', 'client_facing_comments': 'Comments', }, # Fail: Contract not in Account { 'account_id': '1', 'contract_id': '2', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Adjustment', 'client_facing_comments': 'Comments', }, # Fail: UPC not on Contract { 'account_id': '1', 'contract_id': '1', 'upc': '333333333333', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', 'distribution_type': 'Physical', }, # Fail: No Distribution Type { 'account_id': '1', 'contract_id': '1', 'upc': '111111111111', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', }, # Fail: Balance is closed { 'account_id': '2', 'contract_id': '2', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Adjustment', 'client_facing_comments': 'Comments', }, # Fail: Invalid format { 'account_id': '1', 'contract_id': '1', 'amount': 'Ten', 'currency': 'Euros', 'activity_month': '13', 'activity_year': '2024', 'statement_month': 'January', 'statement_year': '2025', 'adjustment_type': 'Unknown', 'client_facing_comments': '', }, # Fail when validating flowthrough payment, Pass otherwise { 'account_id': '1', 'contract_id': '1', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Flowthrough', 'client_facing_comments': 'Comments', }, # Pass: Without UPC { 'account_id': '1', 'contract_id': '1', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Adjustment', 'client_facing_comments': 'Comments', }, # Pass: With UPC { 'account_id': '1', 'contract_id': '1', 'upc': '111111111111', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', 'distribution_type': 'Physical', }, # Pass: With UPC with leading zeros { 'account_id': '1', 'contract_id': '1', 'upc': '0111111111111', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', 'distribution_type': 'Physical', }, # Pass: With UPC matching a Display UPC { 'account_id': '1', 'contract_id': '1', 'upc': '111111111110', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', 'distribution_type': 'Physical', }, # Pass: With UPC matching through a label term { 'account_id': '1', 'contract_id': '1', 'upc': '101010101010', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', 'distribution_type': 'Physical', }, # Pass: With UPC with leading zero matching through a label term { 'account_id': '1', 'contract_id': '1', 'upc': '010101010101', 'amount': '1.11', 'currency': 'USD', 'activity_month': '1', 'activity_year': '2024', 'statement_month': '1', 'statement_year': '2025', 'adjustment_type': 'Physical Storage', 'client_facing_comments': 'Comments', 'distribution_type': 'Physical', }, ] @pytest.fixture def sf_close_balance_statuses_mock(): """Return some Snowflake rows representing some close balance statuses.""" return [ {'PAYMENT_ENTITY_ID': 1, 'ACTION_STATUS': 'init'}, {'PAYMENT_ENTITY_ID': 2, 'ACTION_STATUS': 'complete'}, ] @pytest.fixture def sf_accounts_mock(): """Return some Snowflake rows representing some accounts.""" return [ {'ACCOUNT_ID': 1}, {'ACCOUNT_ID': 2}, ] @pytest.fixture def sf_account_contracts_mock(): """Return some Snowflake rows representing some account contracts.""" return [ {'ACCOUNT_ID': 1, 'CONTRACT_ID': 1}, {'ACCOUNT_ID': 2, 'CONTRACT_ID': 2}, ] @pytest.fixture def sf_payment_entities_mock(): """Return some Snowflake rows representing some payment entities.""" return [ {'ACCOUNT_ID': 1, 'PAYMENT_ENTITY_ID': 1}, {'ACCOUNT_ID': 2, 'PAYMENT_ENTITY_ID': 2}, ] @pytest.fixture def sf_display_upcs_mock(): """Return some Snowflake rows representing some display UPCs.""" return [ {'DISPLAY_UPC': '111111111111', 'UPCS': '111111111110'}, ] @pytest.fixture def sf_product_terms_mock(): """Return some Snowflake rows representing some product terms.""" return [ { 'CONTRACT_ID': 1, 'TERM_TYPE': 'product', 'ATTACHMENTS': '["111111111111"]', } ] @pytest.fixture def sf_label_terms_mock(): """Return some Snowflake rows representing some label terms.""" return [ { 'CONTRACT_ID': 1, 'TERM_TYPE': 'label', 'ATTACHMENTS': '["1"]', }, { 'CONTRACT_ID': 1, 'TERM_TYPE': 'label', 'ATTACHMENTS': '["10"]', }, ] @pytest.fixture def sf_account_upcs_mock(): """Return some Snowflake rows representing some UPCs and their account.""" return [ { 'VENDOR_ID': 1, 'UPC': '111111111111', 'DISPLAY_UPC': '111111111110', }, { 'VENDOR_ID': 10, 'UPC': '101010101010', 'DISPLAY_UPC': '101010101010', }, { 'VENDOR_ID': 10, 'UPC': '010101010101', 'DISPLAY_UPC': '010101010101', }, ] @pytest.fixture def sf_statement_periods_mock(): """Return some Snowflake rows representing some statement periods.""" return [ { 'STATEMENT_YEAR': 2024, 'STATEMENT_MONTH': 1, 'STATEMENT_PERIOD_STATUS': 'closed', }, { 'STATEMENT_YEAR': 2025, 'STATEMENT_MONTH': 1, 'STATEMENT_PERIOD_STATUS': 'current', }, ] @pytest.fixture def sf_adjustment_types_mock(): """Return some Snowflake rows representing some adjustment types.""" return [ {'TYPE_NAME': 'Physical Storage'}, {'TYPE_NAME': 'Adjustment'}, {'TYPE_NAME': 'Flowthrough'}, ]