"""Contract model tests.""" from moneyhub.models.contract_advance import ContractAdvance from tests.unit.conftest import insert_mock_data def _insert_mock_data(account_id: int): """Insert mock data for the tests with a given account ID. Args: account_id (int): Account ID to use in the mock data """ insert_mock_data({ 'account': {'account_id': account_id}, 'reference_payment_entity': {'reference_payment_entity_id': 1}, 'reference_sap_profit_center': { 'reference_sap_profit_center_id': 1, 'company_code': '1234', }, 'reference_signing_entity': { 'reference_signing_entity_id': 1, 'reference_payment_entity_id': 1, 'reference_sap_profit_center_id': 1, 'company_code': '1234', 'tax_entity_company_code': '1234', }, 'contract': { 'contract_id': 1001, 'reference_signing_entity_id': 1, }, 'account_contract': {'account_id': account_id, 'contract_id': 1001}, 'contract_advance': { 'contract_id': 1001, 'amount': 100, 'currency_code': 'NOK' }, }) def test_get_account_advance_activity(): """Test getting advance activity by account.""" account_id = 24601 _insert_mock_data(account_id) result = ContractAdvance.get_account_advance_activity(account_id) assert bool(result) is True def test_get_account_advance_activity_no_data(): """Test getting advance activity by account when there is no data.""" account_id = 24601 _insert_mock_data(99999) result = ContractAdvance.get_account_advance_activity(account_id) assert bool(result) is False