diff --git a/web_progress/tests/test_web_progress.py b/web_progress/tests/test_web_progress.py index 1336864..a7b8942 100644 --- a/web_progress/tests/test_web_progress.py +++ b/web_progress/tests/test_web_progress.py @@ -10,7 +10,7 @@ @tagged('at_install', '-post_install') -class WebProgressTest(common.SavepointCase): +class WebProgressTest(common.TransactionCase): def check_all_progress_data_empty(self): """ @@ -119,7 +119,7 @@ def test_web_progress_percent(self): self.partner_ids.web_progress_percent(100, "End") -class WebProgressTestAllProgress(common.SavepointCase): +class WebProgressTestAllProgress(common.TransactionCase): at_install = True post_install = False @@ -132,17 +132,16 @@ def test_get_all_progress(self): progress_code = str(uuid.uuid4()) partner_obj = self.env['res.partner'].with_context(progress_code=progress_code) partner_obj.web_progress_percent(0, "Start") - with api.Environment.manage(): - with registry(self.env.cr.dbname).cursor() as new_cr: - # Create a new environment with a new cursor - new_env = api.Environment(new_cr, self.env.uid, self.env.context) - progress_obj = self.env['web.progress'].with_env(new_env) - res = progress_obj.get_all_progress() - self.assertEqual(res, [{'code': progress_code}]) - res = progress_obj.get_all_progress(0) - self.assertEqual(res, []) - with self.assertRaises(ProgrammingError) as e: - progress_obj.get_all_progress("0 SECOND' GROUP BY code; " - "SELECT code, array_agg(state) FROM web_progress " - "WHERE create_date > timezone('utc', now()) - INTERVAL '10") - new_cr.rollback() + with registry(self.env.cr.dbname).cursor() as new_cr: + # Create a new environment with a new cursor + new_env = api.Environment(new_cr, self.env.uid, self.env.context) + progress_obj = self.env['web.progress'].with_env(new_env) + res = progress_obj.get_all_progress() + self.assertEqual(res, [{'code': progress_code}]) + res = progress_obj.get_all_progress(0) + self.assertEqual(res, []) + with self.assertRaises(ProgrammingError) as e: + progress_obj.get_all_progress("0 SECOND' GROUP BY code; " + "SELECT code, array_agg(state) FROM web_progress " + "WHERE create_date > timezone('utc', now()) - INTERVAL '10") + new_cr.rollback()