Files
tableau-de-bord/tests/test_leave_calc.py
Antoine Van Elstraete 4c0093c2b0 feat: increase RTT from 18 to 19
- Update LeaveBalance model default rtt_total to 19
- Update all tests to verify 19 RTT instead of 18
- Update documentation (design and technical plan)
- Update run.py to bind to 0.0.0.0 for external access
- Update CLAUDE.md deployment instructions

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-13 13:45:19 +01:00

42 lines
1.3 KiB
Python

from app.business.leave_calc import compute_leave_used, get_or_create_balance
from app.models import WorkEntry, LeaveBalance
from app import db
from datetime import date
import sqlalchemy as sa
def test_compute_leave_used_conges(app):
with app.app_context():
entries = [
WorkEntry(date=date(2025, 1, 6), day_type="CONGE"),
WorkEntry(date=date(2025, 1, 7), day_type="CONGE"),
WorkEntry(date=date(2025, 1, 8), day_type="RTT"),
WorkEntry(date=date(2025, 1, 9), day_type="WORK"),
]
for e in entries:
db.session.add(e)
db.session.commit()
used = compute_leave_used(2025)
assert used["conges"] == 2
assert used["rtt"] == 1
def test_get_or_create_balance_creates_default(app):
with app.app_context():
balance = get_or_create_balance(2025)
assert balance.year == 2025
assert balance.conges_total == 28
assert balance.rtt_total == 19
def test_get_or_create_balance_returns_existing(app):
with app.app_context():
existing = LeaveBalance(year=2025, conges_total=25, rtt_total=15)
db.session.add(existing)
db.session.commit()
balance = get_or_create_balance(2025)
assert balance.conges_total == 25
assert balance.rtt_total == 15