fix(tests): expire_all() before DATEV bypass query to avoid stale identity map
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Ahyx6D3r7G1EuAc42nezn
This commit is contained in:
@@ -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}"
|
||||||
|
|||||||
Reference in New Issue
Block a user