test: stop the trial-end POST tests expiring with the calendar #674
No reviewers
Labels
No labels
API
Billing
UI/UX
dependencies
bug
change
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
servala/servala-portal!674
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/trial-end-post-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Three staff view tests have failed on
main, and on every PR, since 2026-09-11:test_trial_end_post_writes_to_odootest_trial_end_post_rejected_when_portal_manages_windowtest_trial_end_post_reports_odoo_failureEach creates its organization at test time and posts a fixed trial end of
2026-09-10.OrganizationTrialEndFormonly accepts dates from the organization's creation day onward, so once that date was in the past the form refused it: no Odoo write happened (0 writes instead of 1), a second error message appeared, and the failure message was never rendered.The product code is correct. The tests expired with the calendar.
Fix
A helper pins the organization's
created_atto the fixture sale order's trial start (2026-06-01) in the three tests. The fixed date then stays valid permanently: the lower bound is fixed, and the upper bound moves forward with today. Keeping the date fixed, rather than relative to today, also keeps the expected Odoo value (2026-09-10 23:59:59) in summer time, so the tests cannot start failing at a daylight saving change either.I checked the rest of the suite for other tests posting a fixed trial end: there are none.
Testing
src/tests/test_staff_views.py: 131 passed.This unblocks CI on PR 673 (Plausible attribution), which inherited the failures from
main.Design Decisions
created_atinstead of adding a time-freezing library: the project has no freezegun or time-machine, and only the organization's age matters to the form. The file already backdatescreated_atwith a queryset update (_backdate), which also avoids firing the trial-window signals.mainand unrelated to that change.🤖 Generated with Claude Code
https://claude.ai/code/session_014S5eLBkR9DQyhYAG11hBZw