Implemented automatic tests

This commit is contained in:
antonio
2019-05-09 13:15:20 +02:00
parent db24654f65
commit 811437e192
3 changed files with 23 additions and 1 deletions

View File

@@ -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:

View File

@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import test_access_rule_buttons

View 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'])