Repository navigation
[19.0][FIX] password_security: avoid crash in password rules when no test is running - #1051
Open
jacar-javi wants to merge 1 commit into
Open
jacar-javi wants to merge 1 commit into
jacar-javi wants to merge 1 commit into
Conversation
…s running With tests enabled but no test running yet, `current_test` is a boolean instead of a test case. `_check_password_policy` already reads `test_module` with `getattr` for this reason (e36eb70), but `_check_password_rules` still reads it directly, so calling it in that state (e.g. from the signup controller) fails with an AttributeError. Read `test_module` the same way in both places. Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With tests enabled (
--test-enable) but no test running yet,odoo.modules.module.current_testis a boolean instead of a test case.e36eb70 already made
_check_password_policyreadtest_modulewithgetattrfor this reason, but_check_password_rulesstill readscurrent_test.test_moduledirectly. Called in that state (for instance from the signup controller,PasswordSecurityHome.do_signup), it fails with:This reads
test_modulethe same way in both places, and adds a test that patchescurrent_testtoFalse(it fails without the fix).Found while running the tests of a project that depends on
password_securitywith--test-enable.This change was prepared with AI assistance (Claude) and reviewed by me.