test: add context to product-create

This commit is contained in:
Frederik Jaeckel 2023-06-07 19:24:43 +02:00
parent 8f12741d76
commit ebb6d71be3
3 changed files with 55 additions and 42 deletions

View file

@ -80,6 +80,7 @@ class AssetTestCase(object):
Asset = Pool().get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -111,6 +112,7 @@ class AssetTestCase(object):
Asset = Pool().get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -141,6 +143,7 @@ class AssetTestCase(object):
Asset = Pool().get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product1 = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -223,6 +226,7 @@ class AssetTestCase(object):
cursor = Transaction().connection.cursor()
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -289,6 +293,7 @@ class AssetTestCase(object):
Asset = Pool().get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -399,6 +404,7 @@ class AssetTestCase(object):
Asset = Pool().get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -484,6 +490,7 @@ class AssetTestCase(object):
OnlineSource = pool.get('investment.source')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -521,6 +528,7 @@ class AssetTestCase(object):
Asset = pool.get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')
@ -626,6 +634,7 @@ class AssetTestCase(object):
Asset = pool.get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product1 = self.prep_asset_product(
name='Product unit', unit='u')
product2 = self.prep_asset_product(
@ -733,6 +742,7 @@ class AssetTestCase(object):
""" check update of product on asset
"""
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product1 = self.prep_asset_product(
name='Product unit', unit='u')
product2 = self.prep_asset_product(

View file

@ -4,6 +4,7 @@
# full copyright notices and license terms.
from trytond.tests.test_tryton import with_transaction
from trytond.transaction import Transaction
from trytond.pool import Pool
from decimal import Decimal
from datetime import date
@ -19,6 +20,7 @@ class RateTestCase(object):
Asset = Pool().get('investment.asset')
company = self.prep_asset_company()
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')

View file

@ -36,6 +36,7 @@ class SourceTestCase(object):
}])
self.assertEqual(osource.rec_name, 'Source 1')
with Transaction().set_context({'company': company.id}):
product = self.prep_asset_product(
name='Product 1',
description='some asset')