Files
odoo_source/addons/auth_signup/tests/test_reset_password.py
T
std-odoo dab3d0a282 [FIX] mail: revert the unlink in batch of the <mail.mail>
Bug
===
The unlink of the <mail.mail> in the CRON is problematic because we
accumulate a lot of records, and the CRON timeout.

In particular, when we sent a mailing, we receive the "opened" event
(blank image in the email), and so we need to update the mailing trace.
But, if we unlink the mail at the same time, it locked the mailing trace
table and we couldn't write the new value.

The reason for that is that before, the unlink took more queries, but
it was done one record at a time, so we could commit the change and
release the lock between each unlink.

Task-3179157
See odoo/odoo/pull/73271

closes odoo/odoo#112703

X-original-commit: 57ae1b9b8b61f5f4719a8a81e9d0d21fab58cfda
Related: odoo/enterprise#37069
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-02-15 10:14:53 +01:00

28 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import HttpCase
from werkzeug.urls import url_parse
class TestResetPassword(HttpCase):
def test_reset_password(self):
"""
Test that first signup link and password reset link are different to accomodate for the different behaviour
on first signup if a password is already set user is redirected to login page when accessing that link again
'signup_email' is used in the web controller (web_auth_reset_password) to detect this behaviour
"""
test_user = self.env['res.users'].create({
'login': 'test',
'name': 'The King',
'email': 'noop@example.com',
})
self.assertEqual(test_user.email, url_parse(test_user.with_context(create_user=True).signup_url).decode_query()["signup_email"], "query must contain 'signup_email'")
# Invalidate signup_url to skip signup process
self.env.invalidate_all()
test_user.action_reset_password()
self.assertNotIn("signup_email", url_parse(test_user.signup_url).decode_query(), "query should not contain 'signup_email'")