Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions checklog-odoo.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
13 changes: 11 additions & 2 deletions password_security/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = [
Expand Down
9 changes: 5 additions & 4 deletions password_security/tests/test_signup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
responses
httpx2
odoo-test-helper
Loading