Files
odoo_source/addons/website/tests/test_website_reset_password.py
T
Sébastien Theys c1be1993f9 [FIX] *: share URL on the correct website if possible
* = base, auth_signup, mail, portal, sale, website, website_sale

Before this commit, sending an object by email would always link to web.base.url
even if the object was created from a specific website.

Now if the object has a website, we use the URL of that website if it is set.
The fallback will always be on the web.base.url.

opw-1921030
PR: #30000
2019-02-06 09:50:38 +00:00

35 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
try:
from unittest.mock import patch
except ImportError:
from mock import patch
import odoo
from odoo.tests import tagged
from odoo.tests.common import HttpCase
@tagged('post_install', '-at_install')
class TestWebsiteResetPassword(HttpCase):
def test_01_website_reset_password_tour(self):
"""The goal of this test is to make sure the reset password works."""
# We override unlink because we don't want the email to be auto deleted
# if the send works.
MailMail = odoo.addons.mail.models.mail_mail.MailMail
# We override send_mail because in HttpCase on runbot we don't have an
# SMTP server, so if force_send is set, the test is going to fail.
MailTemplate = odoo.addons.mail.models.mail_template.MailTemplate
original_send_mail = MailTemplate.send_mail
def my_send_mail(*args, **kwargs):
kwargs.update(force_send=False)
return original_send_mail(*args, **kwargs)
with patch.object(MailMail, 'unlink', lambda self: None), patch.object(MailTemplate, 'send_mail', my_send_mail):
self.browser_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('website_reset_password')", "odoo.__DEBUG__.services['web_tour.tour'].tours.website_reset_password.ready", login="admin")