mirror of
https://github.com/bringout/oca-ocb-test.git
synced 2026-04-19 13:42:03 +02:00
Initial commit: Test packages
This commit is contained in:
commit
080accd21c
338 changed files with 32413 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.addons.mail.tests.common import mail_new_test_user
|
||||
from odoo.addons.test_mail.tests.common import TestMailCommon
|
||||
from odoo.exceptions import AccessError
|
||||
|
||||
|
||||
class TestSubtypeAccess(TestMailCommon):
|
||||
|
||||
def test_subtype_access(self):
|
||||
"""
|
||||
The function aims to formally verify the access restrictions on mail.message.subtype for
|
||||
normal and admin users. It ensures that normal users are unable to modify it,
|
||||
while admin users possess the necessary privileges to modify it successfully.
|
||||
"""
|
||||
|
||||
test_subtype = self.env['mail.message.subtype'].create({
|
||||
'name': 'Test',
|
||||
'description': 'only description',
|
||||
})
|
||||
|
||||
user = mail_new_test_user(self.env, 'Internal user', groups='base.group_user')
|
||||
|
||||
with self.assertRaises(AccessError):
|
||||
test_subtype.with_user(user).write({'description': 'changing description'})
|
||||
|
||||
test_subtype.with_user(self.user_admin).write({'description': 'testing'})
|
||||
self.assertEqual(test_subtype.description, 'testing')
|
||||
Loading…
Add table
Add a link
Reference in a new issue