From 54ccd5b96757e4e59cbf06ae7596188a405c3ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 2 Aug 2017 19:38:23 +0200 Subject: [PATCH] Add set_user tools for test scenario When changing the user of proteus, the context should be reloaded. issue6652 review42551002 --- tests/scenario_stock_shipment_internal.rst | 8 ++++---- tests/scenario_stock_shipment_out.rst | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/scenario_stock_shipment_internal.rst b/tests/scenario_stock_shipment_internal.rst index 7c28d808b5..37b769fb1f 100644 --- a/tests/scenario_stock_shipment_internal.rst +++ b/tests/scenario_stock_shipment_internal.rst @@ -8,7 +8,7 @@ Imports:: >>> from dateutil.relativedelta import relativedelta >>> from decimal import Decimal >>> from proteus import Model, Wizard - >>> from trytond.tests.tools import activate_modules + >>> from trytond.tests.tools import activate_modules, set_user >>> from trytond.modules.company.tests.tools import create_company, \ ... get_company >>> today = datetime.date.today() @@ -68,7 +68,7 @@ Create stock user:: Create Internal Shipment:: - >>> config.user = stock_user.id + >>> set_user(stock_user) >>> Shipment = Model.get('stock.shipment.internal') >>> StockMove = Model.get('stock.move') >>> shipment = Shipment() @@ -133,7 +133,7 @@ Check that now whe can finish the older shipment:: Add lead time inside the warehouse:: - >>> config.user = 1 + >>> set_user(1) >>> LeadTime = Model.get('stock.location.lead_time') >>> lead_time = LeadTime() >>> lead_time.from_warehouse = storage_loc.warehouse @@ -143,7 +143,7 @@ Add lead time inside the warehouse:: Create Internal Shipment with lead time:: - >>> config.user = stock_user.id + >>> set_user(stock_user) >>> shipment = Shipment() >>> shipment.planned_date = tomorrow >>> shipment.from_location = internal_loc diff --git a/tests/scenario_stock_shipment_out.rst b/tests/scenario_stock_shipment_out.rst index ad389c1733..aa97edc0c3 100644 --- a/tests/scenario_stock_shipment_out.rst +++ b/tests/scenario_stock_shipment_out.rst @@ -8,7 +8,7 @@ Imports:: >>> from dateutil.relativedelta import relativedelta >>> from decimal import Decimal >>> from proteus import Model, Wizard - >>> from trytond.tests.tools import activate_modules + >>> from trytond.tests.tools import activate_modules, set_user >>> from trytond.modules.company.tests.tools import create_company, \ ... get_company >>> today = datetime.date.today() @@ -63,7 +63,7 @@ Create stock user:: >>> stock_user.employee = employee >>> stock_user.save() - >>> config.user = stock_user.id + >>> set_user(stock_user) Get stock locations::