Fix Transaction.start to use keyword argument for context
(transplanted from d2f919d970fb08f0da63127fc7e2f2bfd4919a27)
This commit is contained in:
1 parent
20922c8248
commit
015a1344e0
1 file changed
+7
-5
@@ -41,7 +41,8 @@ class ProductTestCase(unittest.TestCase):
|
||||
'''
|
||||
Test uom non_zero_rate_factor constraint.
|
||||
'''
|
||||
with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
|
||||
with Transaction().start(DB_NAME, USER,
|
||||
context=CONTEXT) as transaction:
|
||||
category_id = self.uom_category.create({'name': 'Test'})
|
||||
transaction.cursor.commit()
|
||||
|
||||
@@ -83,7 +84,8 @@ class ProductTestCase(unittest.TestCase):
|
||||
'''
|
||||
Test uom check_factor_and_rate constraint.
|
||||
'''
|
||||
with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
|
||||
with Transaction().start(DB_NAME, USER,
|
||||
context=CONTEXT) as transaction:
|
||||
category_id = self.uom_category.search([
|
||||
('name', '=', 'Test'),
|
||||
], limit=1)[0]
|
||||
@@ -123,7 +125,7 @@ class ProductTestCase(unittest.TestCase):
|
||||
('centimeter', 'rate'),
|
||||
('Foot', 'factor'),
|
||||
]
|
||||
with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
|
||||
with Transaction().start(DB_NAME, USER, context=CONTEXT):
|
||||
for name, result in tests:
|
||||
uom_id = self.uom.search([
|
||||
('name', '=', name),
|
||||
@@ -143,7 +145,7 @@ class ProductTestCase(unittest.TestCase):
|
||||
('Second', 25, 'Hour', 0.0069444444444444441, 0.01),
|
||||
('Millimeter', 3, 'Inch', 0.11811023622047245, 0.12),
|
||||
]
|
||||
with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
|
||||
with Transaction().start(DB_NAME, USER, context=CONTEXT):
|
||||
for from_name, qty, to_name, result, rounded_result in tests:
|
||||
from_uom = self.uom.browse(self.uom.search(
|
||||
[
|
||||
@@ -176,7 +178,7 @@ class ProductTestCase(unittest.TestCase):
|
||||
('Second', Decimal('25'), 'Hour', Decimal('90000')),
|
||||
('Millimeter', Decimal('3'), 'Inch', Decimal('76.2')),
|
||||
]
|
||||
with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
|
||||
with Transaction().start(DB_NAME, USER, context=CONTEXT):
|
||||
for from_name, price, to_name, result in tests:
|
||||
from_uom = self.uom.browse(self.uom.search(
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user