Browse Source

test: cover reconciliation status id ordering

master
Codex 2 months ago
parent
commit
2e322ba46e
  1. 35
      tests/finance/test_reconciliation.py

35
tests/finance/test_reconciliation.py

@ -309,3 +309,38 @@ def test_latest_checkpoint_statuses_order_selected_accounts_by_checkpoint_recenc
older_same_date.pk, older_same_date.pk,
oldest.pk, oldest.pk,
] ]
def test_latest_checkpoint_statuses_order_equal_recency_by_checkpoint_id_descending():
first_account = Account.objects.create(
id=UUID("00000000-0000-0000-0000-000000000004"),
name="Synthetic first equal-recency account",
kind="BANK",
)
second_account = Account.objects.create(
id=UUID("00000000-0000-0000-0000-000000000005"),
name="Synthetic second equal-recency account",
kind="BANK",
)
first = create_reconciliation_checkpoint(
account_id=first_account.pk,
as_of_date=date(2026, 9, 2),
institution_balance=Decimal("0.00"),
actor=ACTOR,
)
second = create_reconciliation_checkpoint(
account_id=second_account.pk,
as_of_date=date(2026, 9, 2),
institution_balance=Decimal("0.00"),
actor=ACTOR,
)
same_creation_time = timezone.make_aware(datetime(2026, 9, 1, 12, 0))
ReconciliationCheckpoint.objects.filter(pk__in=[first.pk, second.pk]).update(
created_at=same_creation_time
)
statuses = latest_checkpoint_statuses("BRL")
assert [status.checkpoint_id for status in statuses] == sorted(
[first.pk, second.pk], reverse=True
)

Loading…
Cancel
Save