"""Test Payment Hold History schemas.""" from abacus_common_logic.utils.dates import parse_date from abacus_account.schemas.payment_hold_history import PaymentHoldHistorySchema from tests.utils.factories import PaymentHoldHistoryFactory def test_payment_hold_history_schema(): """Test payment hold history serialization.""" history = PaymentHoldHistoryFactory.create() res = PaymentHoldHistorySchema().dump(history) assert res['payment_hold_history_id'] == history.payment_hold_history_id assert parse_date(res['end_date']) == history.end_date assert res['is_on_hold'] == history.is_on_hold assert res['account_id'] == history.account_id assert res['payment_hold_id'] == history.payment_hold_id assert parse_date(res['start_date']) == history.start_date assert res['reason'] == history.reason assert res['created_by'] == history.created_by assert res['created_at'] == history.created_at.strftime('%Y-%m-%d') assert res['last_modified_by'] == history.last_modified_by assert res['last_modified'] == history.last_modified.strftime('%Y-%m-%d')