Skip to content

[tests] Fixed password date assertion at timezone boundaries - #581

Merged
nemesifier merged 1 commit into
masterfrom
fix-password-date-test
Oct 3, 2026
Merged

nemesifier merged 1 commit into
masterfrom
fix-password-date-test

Conversation

@nemesifier

Copy link
Copy Markdown
Member

Checklist

  • I have read the OpenWISP Contributing Guidelines and OpenWISP Anti AI Spam Policy.
  • N/A: I have manually tested the changes proposed in this pull request. This only changes an automated test.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • N/A: I have updated the documentation. No product behavior changes.

Reference to Existing Issue

Related to #375. Unblocks openwisp/openwisp-controller#1499.

Description of Changes

The password-updated admin test still expected the UTC date from now(), although User.set_password() correctly records the active local date. This fails when UTC and the configured timezone are on different dates, as seen in Controller's inherited integration test shortly after midnight in Europe/Rome.

Used localdate() in the expected admin output and froze the test at 23:00 UTC with Europe/Rome active, making the boundary regression deterministic. No production code changes.

Screenshot

N/A.

@nemesifier nemesifier self-assigned this Oct 2, 2026
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6c50174e-baae-483c-9f28-a9d2383fad99
📥 Commits

Reviewing files that changed from the base of the PR and between aac9769 and e830574.

📒 Files selected for processing (1)
  • openwisp_users/tests/test_admin.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (14)
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=5.0.0
  • GitHub Check: Python==3.11 | django~=5.0.0
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.0.0
  • GitHub Check: Python==3.10 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=5.2.0
  • GitHub Check: Python==3.11 | django~=5.1.0
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (3)
Ensure tests cover relevant success, error, boundary, and unusual input scenarios.

⚙️ CodeRabbit configuration file

Files:

  • openwisp_users/tests/test_admin.py
Flag potential security vulnerabilities Flag obvious performance regressions, such as heavy loops, repeated I/O, or unoptimized queries Flag unused or redundant code Flag outdated or incorrect comments/docstrings Ensure new code handles err...

⚙️ CodeRabbit configuration file

Files:

  • openwisp_users/tests/test_admin.py
Source excerpt: Changes to core logic, model validation, migrations, database schema, tenant isolation, authentication, or shared behavior require all affected package and integration suites.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • openwisp_users/tests/test_admin.py
🔇 Additional comments (1)
openwisp_users/tests/test_admin.py (1)

265-266: LGTM!

Also applies to: 281-281


📝 Walkthrough

Walkthrough

The password-updated admin display test now freezes time in the Europe/Rome timezone. It expects the rendered date to match localdate().

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Suggested reviewers: pandafy

Merge Risk: ⚪ Minimal · up to e8305

This change corrects the test’s timezone-boundary expectation without changing production behavior. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required [tests] prefix and clearly describes the timezone-boundary test assertion fix.
Description check ✅ Passed The description includes the checklist, issue reference, detailed change summary, testing context, and screenshot status. It is complete for a test-only change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Ui Changes, Regression Test, Docs ✅ Passed Only openwisp_users/tests/test_admin.py changed. The PR updates an existing admin password-date regression test and adds deterministic timezone/time freezing. It does not change application UI or do…
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 98.139%. remained the same — fix-password-date-test into master

@nemesifier
nemesifier merged commit dd09714 into master Oct 3, 2026
21 checks passed
@nemesifier
nemesifier deleted the fix-password-date-test branch October 3, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants