Skip to content

Commit

Permalink
[MIG] adapt tests to v15
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzegorz Marczynski committed Aug 10, 2023
1 parent 62a65ad commit ac4ed77
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions web_progress/tests/test_web_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@tagged('at_install', '-post_install')
class WebProgressTest(common.SavepointCase):
class WebProgressTest(common.TransactionCase):

def check_all_progress_data_empty(self):
"""
Expand Down Expand Up @@ -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

Expand All @@ -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()

0 comments on commit ac4ed77

Please sign in to comment.