diff --git a/checklog-odoo.cfg b/checklog-odoo.cfg index 9cc94b30dd..01c09088b5 100644 --- a/checklog-odoo.cfg +++ b/checklog-odoo.cfg @@ -2,3 +2,5 @@ ignore= WARNING.* 0 failed, 0 error\(s\).* WARNING.* Missing widget: res_partner_many2one for field of type many2one.* + # from anyio>=4.15 see https://github.com/Kludex/starlette/issues/3497 + WARNING.* DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated.* diff --git a/password_security/models/res_users.py b/password_security/models/res_users.py index 46f1fb1258..a7bd1d1519 100644 --- a/password_security/models/res_users.py +++ b/password_security/models/res_users.py @@ -6,8 +6,9 @@ import re from datetime import datetime, timedelta -from odoo import _, api, fields, models +from odoo import _, api, fields, models, modules from odoo.exceptions import UserError, ValidationError +from odoo.tools import config def delta_now(**kwargs): @@ -68,6 +69,11 @@ def get_password_policy(self): return data def _check_password_policy(self, passwords): + if ( + config["test_enable"] + and not modules.module.current_test.test_module == "password_security" + ): + return True result = super()._check_password_policy(passwords) for password in passwords: @@ -114,7 +120,10 @@ def _check_password(self, password): def _check_password_rules(self, password): self.ensure_one() - if not password: + if not password or ( + config["test_enable"] + and not modules.module.current_test.test_module == "password_security" + ): return True pwd_params = self._get_all_password_params() password_regex = [ diff --git a/password_security/tests/test_signup.py b/password_security/tests/test_signup.py index b600f4cd12..8d199d0c64 100644 --- a/password_security/tests/test_signup.py +++ b/password_security/tests/test_signup.py @@ -57,12 +57,13 @@ def test_01_signup_user_fail(self): def test_02_signup_user_success(self): """It should succeed when signup user with strong password""" # Weak password: signup failed + user = self.env["res.users"].search([("login", "=", "jackoneill")]) + self.assertFalse(user) response = self.signup("jackoneill", "!asdQWE12345_3") - + user = self.env["res.users"].search([("login", "=", "jackoneill")]) + session = http.root.session_store.get(response.request._cookies["session_id"]) # Ensure we were logged in - self.assertEqual( - response.request.path_url, "/web/login_successful?account_created=True" - ) + self.assertEqual(user.id, session.uid) self.assertEqual(response.status_code, 200) def test_03_create_user_signup(self): diff --git a/test-requirements.txt b/test-requirements.txt index 24ef63a17b..e7fbad99e3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,3 @@ responses httpx2 +odoo-test-helper