diff --git a/base_suspend_security/tests/test_base_suspend_security.py b/base_suspend_security/tests/test_base_suspend_security.py index ff2fd658..eac0871e 100644 --- a/base_suspend_security/tests/test_base_suspend_security.py +++ b/base_suspend_security/tests/test_base_suspend_security.py @@ -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([])