Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
7ee7628e6c
  1. 2
      muk_utils/__manifest__.py
  2. 8
      muk_utils/tests/common.py

2
muk_utils/__manifest__.py

@ -19,7 +19,7 @@
{ {
"name": "MuK Utils", "name": "MuK Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"version": '12.0.1.4.2',
"version": '12.0.1.4.3',
"category": 'Extra Tools', "category": 'Extra Tools',
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "author": "MuK IT",

8
muk_utils/tests/common.py

@ -51,13 +51,14 @@ _logger = logging.getLogger(__name__)
# Decorators # Decorators
#---------------------------------------------------------- #----------------------------------------------------------
def multi_users(users=[['base.user_root', True], ['base.user_admin', True]], raise_exception=True):
def multi_users(users=[['base.user_root', True], ['base.user_admin', True]], reset=True, raise_exception=True):
def decorator(func): def decorator(func):
@functools.wraps(func) @functools.wraps(func)
def wrapper(self, *args, **kwargs): def wrapper(self, *args, **kwargs):
user_list = users(self) if callable(users) else users user_list = users(self) if callable(users) else users
test_results = [] test_results = []
for user in user_list: for user in user_list:
self.cr.execute('SAVEPOINT test_multi_users')
try: try:
if not isinstance(user[0], int): if not isinstance(user[0], int):
self.uid = self.ref(user[0]) self.uid = self.ref(user[0])
@ -78,6 +79,11 @@ def multi_users(users=[['base.user_root', True], ['base.user_admin', True]], rai
'result': True, 'result': True,
'error': None, 'error': None,
}) })
if reset:
self.cr.execute('ROLLBACK TO SAVEPOINT test_multi_users')
self.registry.reset_changes()
else:
self._cr.execute('RELEASE SAVEPOINT test_multi_users')
test_fails = [] test_fails = []
for result in test_results: for result in test_results:
if result['expect'] != result['result']: if result['expect'] != result['result']:

Loading…
Cancel
Save