mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
Tests the search with suspend security.
This commit is contained in:
@@ -30,3 +30,18 @@ class TestBaseSuspendSecurity(TransactionCase):
|
||||
# this tests if _normalize_args conversion works
|
||||
self.env['res.users'].browse(
|
||||
self.env['res.users'].suspend_security().env.uid)
|
||||
|
||||
def test_suspend_security_on_search(self):
|
||||
user_without_access = self.env["res.users"].create(
|
||||
dict(
|
||||
name="Testing Suspend Security",
|
||||
login="nogroups",
|
||||
email="nogroups@suspendsecurity.com",
|
||||
groups_id=[(5,)],
|
||||
)
|
||||
)
|
||||
# the search is forbidden
|
||||
with self.assertRaises(exceptions.AccessError):
|
||||
self.env["ir.config_parameter"].sudo(user_without_access).search([])
|
||||
# this tests the search
|
||||
self.env["ir.config_parameter"].sudo(user_without_access).suspend_security().search([])
|
||||
|
||||
Reference in New Issue
Block a user