Files
odoo_source/addons/mail/tests/test_security.py
T
Thibault Delavallée 3d4cf03ca6 [MOV] bus, mail: move and regroup some tests
Purpose of this commit is to regroup some tests, or rename some too specific
files in order to avoid explosion of files, making tests hard to find when
looking for feature-specific tests.

Task-3346388

Part-of: odoo/odoo#123678
2023-07-10 16:59:11 +02:00

37 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.mail.tests.common import MailCommon
from odoo.tests import users
class TestNotifySecurityUpdate(MailCommon):
@users('employee')
def test_security_update_email(self):
""" User should be notified on old email address when the email changes """
with self.mock_mail_gateway():
self.env.user.write({'email': 'new@example.com'})
self.assertMailMailWEmails(['e.e@example.com'], 'outgoing', fields_values={
'subject': 'Security Update: Email Changed',
})
@users('employee')
def test_security_update_login(self):
with self.mock_mail_gateway():
self.env.user.write({'login': 'newlogin'})
self.assertMailMailWEmails([self.env.user.email_formatted], 'outgoing', fields_values={
'subject': 'Security Update: Login Changed',
})
@users('employee')
def test_security_update_password(self):
with self.mock_mail_gateway():
self.env.user.write({'password': 'newpassword'})
self.assertMailMailWEmails([self.env.user.email_formatted], 'outgoing', fields_values={
'subject': 'Security Update: Password Changed',
})