From 7ee7628e6c0e96c0d7651464eef3f20c49960010 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Tue, 8 Jan 2019 10:54:28 +0000 Subject: [PATCH] publish muk_utils - 12.0 --- muk_utils/__manifest__.py | 2 +- muk_utils/tests/common.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index 0b60eb4..675fc8b 100644 --- a/muk_utils/__manifest__.py +++ b/muk_utils/__manifest__.py @@ -19,7 +19,7 @@ { "name": "MuK Utils", "summary": """Utility Features""", - "version": '12.0.1.4.2', + "version": '12.0.1.4.3', "category": 'Extra Tools', "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_utils/tests/common.py b/muk_utils/tests/common.py index 2a4270a..e54e05b 100644 --- a/muk_utils/tests/common.py +++ b/muk_utils/tests/common.py @@ -51,13 +51,14 @@ _logger = logging.getLogger(__name__) # 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): @functools.wraps(func) def wrapper(self, *args, **kwargs): user_list = users(self) if callable(users) else users test_results = [] for user in user_list: + self.cr.execute('SAVEPOINT test_multi_users') try: if not isinstance(user[0], int): 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, '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 = [] for result in test_results: if result['expect'] != result['result']: