mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Implemented automatic tests
This commit is contained in:
@@ -18,7 +18,7 @@ class Base(models.AbstractModel):
|
||||
:param operation: a list of ``read``, ``create``, ``write``, ``unlink``
|
||||
:return: {operation: access} (access is a boolean)
|
||||
"""
|
||||
if operations or None:
|
||||
if not operations:
|
||||
operations = ['read', 'create', 'write', 'unlink']
|
||||
result = {}
|
||||
for operation in operations:
|
||||
|
||||
3
web_access_rule_buttons/tests/__init__.py
Normal file
3
web_access_rule_buttons/tests/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from . import test_access_rule_buttons
|
||||
19
web_access_rule_buttons/tests/test_access_rule_buttons.py
Normal file
19
web_access_rule_buttons/tests/test_access_rule_buttons.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2019 Onestein BV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestAccessRuleButtons(TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestAccessRuleButtons, self).setUp()
|
||||
|
||||
self.curr_obj = self.env['res.currency']
|
||||
self.curr_record = self.env.ref('base.USD')
|
||||
|
||||
def test_check_access_rule_1(self):
|
||||
res = self.curr_obj.check_access_rule_all(['write'])
|
||||
self.assertTrue(res['write'])
|
||||
|
||||
def test_check_access_rule_2(self):
|
||||
res = self.curr_record.check_access_rule_all(['write'])
|
||||
self.assertTrue(res['write'])
|
||||
Reference in New Issue
Block a user