[FIX] base: tests on test cursor

This commit is contained in:
Raphael Collet
2020-11-24 13:23:32 +00:00
parent b580f74502
commit 3e77accdc3
+8 -14
View File
@@ -33,21 +33,15 @@ class TestExecute(BaseCase):
class TestTestCursor(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestTestCursor, cls).setUpClass()
r = registry()
r.enter_test_mode(r.cursor())
@classmethod
def tearDownClass(cls):
r = registry()
r.test_cr.close()
r.leave_test_mode()
super(TestTestCursor, cls).tearDownClass()
def setUp(self):
super(TestTestCursor, self).setUp()
super().setUp()
# make the registry in test mode
self.registry.enter_test_mode(self.cr)
self.addCleanup(self.registry.leave_test_mode)
# now we make a test cursor for self.cr
self.cr = self.registry.cursor()
self.addCleanup(self.cr.close)
self.env = odoo.api.Environment(self.cr, odoo.SUPERUSER_ID, {})
self.record = self.env['res.partner'].create({'name': 'Foo'})
def write(self, record, value):