|
@ -18,6 +18,7 @@ |
|
|
# |
|
|
# |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
from openerp import exceptions |
|
|
from openerp import exceptions |
|
|
|
|
|
from openerp.tools import mute_logger |
|
|
from openerp.tests.common import TransactionCase |
|
|
from openerp.tests.common import TransactionCase |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,9 +35,11 @@ class TestBaseSuspendSecurity(TransactionCase): |
|
|
}) |
|
|
}) |
|
|
# be sure what we try is forbidden |
|
|
# be sure what we try is forbidden |
|
|
with self.assertRaises(exceptions.AccessError): |
|
|
with self.assertRaises(exceptions.AccessError): |
|
|
self.env.ref('base.user_root').sudo(user_id).name = 'test' |
|
|
|
|
|
|
|
|
with mute_logger('openerp.addons.base.ir.ir_model'): |
|
|
|
|
|
self.env.ref('base.user_root').sudo(user_id).name = 'test' |
|
|
with self.assertRaises(exceptions.AccessError): |
|
|
with self.assertRaises(exceptions.AccessError): |
|
|
other_company.sudo(user_id).name = 'test' |
|
|
|
|
|
|
|
|
with mute_logger('openerp.addons.base.ir.ir_model'): |
|
|
|
|
|
other_company.sudo(user_id).name = 'test' |
|
|
# this tests ir.model.access |
|
|
# this tests ir.model.access |
|
|
self.env.ref('base.user_root').sudo(user_id).suspend_security().write({ |
|
|
self.env.ref('base.user_root').sudo(user_id).suspend_security().write({ |
|
|
'name': 'test'}) |
|
|
'name': 'test'}) |
|
|