Browse Source

Implemented automatic tests

pull/1243/head
antonio 6 years ago
parent
commit
811437e192
  1. 2
      web_access_rule_buttons/models/models.py
  2. 3
      web_access_rule_buttons/tests/__init__.py
  3. 19
      web_access_rule_buttons/tests/test_access_rule_buttons.py

2
web_access_rule_buttons/models/models.py

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

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

@ -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'])
Loading…
Cancel
Save