fix(tests): expire_all() before DATEV bypass query to avoid stale identity map
Security Audit / Python Dependency Audit (push) Canceled after 0s
Security Audit / Node.js Dependency Audit (push) Canceled after 0s
Security Audit / Frontend Build (tsc + vite) (push) Canceled after 0s

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Ahyx6D3r7G1EuAc42nezn
This commit is contained in:
2026-09-02 23:32:02 +02:00
co-authored by Claude Sonnet 5
parent 21b65087d3
commit 55d54e0ff0
+3 -1
View File
@@ -492,8 +492,10 @@ async def test_datev_holiday_takes_precedence_over_vacation(
assert approve.status_code == 200, approve.text assert approve.status_code == 200, approve.text
# RLS-Bypass gilt nur innerhalb der aktuellen Transaktion (SET LOCAL) -- der # RLS-Bypass gilt nur innerhalb der aktuellen Transaktion (SET LOCAL) -- der
# vorherige Bypass ist mit dem commit() oben verfallen. # vorherige Bypass ist mit dem commit() oben verfallen. expire_all() erzwingt
# frische Queries unter dem neuen Bypass (statt gecachter Identity-Map-Objekte).
await db_session.execute(text("SET LOCAL app.bypass_rls = 'on'")) await db_session.execute(text("SET LOCAL app.bypass_rls = 'on'"))
db_session.expire_all()
sheet = await report_service.datev_monthly_report(company_id, user_id, 2027, 1, db_session) sheet = await report_service.datev_monthly_report(company_id, user_id, 2027, 1, db_session)
jan1_row = next(row for row in sheet.rows if row.day == 1) jan1_row = next(row for row in sheet.rows if row.day == 1)
assert jan1_row.code == "F", f"Feiertag muss Vorrang vor Urlaubs-Kürzel haben, got code={jan1_row.code!r}" assert jan1_row.code == "F", f"Feiertag muss Vorrang vor Urlaubs-Kürzel haben, got code={jan1_row.code!r}"