[FIX] tests: move enter test_mode in setUpClass

Before this commit, the registry was entering test_mode in setUp,
leading to a hole during the setUpClass with a registry not in test mode
at this moment.

closes odoo/odoo#122585

X-original-commit: 993e4d2f98b9982eb64123d6cd0de8cc3b2056f4
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
This commit is contained in:
Christophe Monniez
2023-05-26 10:29:22 +02:00
parent ba5087cc6d
commit 428b78e9bd
+3 -3
View File
@@ -1595,6 +1595,9 @@ class HttpCase(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
if cls.registry_test_mode:
cls.registry.enter_test_mode(cls.cr)
cls.addClassCleanup(cls.registry.leave_test_mode)
ICP = cls.env['ir.config_parameter']
ICP.set_param('web.base.url', cls.base_url())
@@ -1605,9 +1608,6 @@ class HttpCase(TransactionCase):
def setUp(self):
super().setUp()
if self.registry_test_mode:
self.registry.enter_test_mode(self.cr)
self.addCleanup(self.registry.leave_test_mode)
self.xmlrpc_common = xmlrpclib.ServerProxy(self.xmlrpc_url + 'common', transport=Transport(self.cr))
self.xmlrpc_db = xmlrpclib.ServerProxy(self.xmlrpc_url + 'db', transport=Transport(self.cr))