Add some test tools to ease scenario writing
review11331002
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
Stock Package Scenario
|
||||
======================
|
||||
|
||||
=============
|
||||
General Setup
|
||||
=============
|
||||
|
||||
Imports::
|
||||
|
||||
>>> import datetime
|
||||
@@ -13,6 +9,8 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from proteus import config, Model, Wizard
|
||||
>>> from trytond.exceptions import UserError
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> today = datetime.date.today()
|
||||
|
||||
Create database::
|
||||
@@ -23,35 +21,14 @@ Create database::
|
||||
Install stock Module::
|
||||
|
||||
>>> Module = Model.get('ir.module.module')
|
||||
>>> modules = Module.find([('name', '=', 'stock_package')])
|
||||
>>> Module.install([x.id for x in modules], config.context)
|
||||
>>> module, = Module.find([('name', '=', 'stock_package')])
|
||||
>>> module.click('install')
|
||||
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
|
||||
|
||||
Create company::
|
||||
|
||||
>>> Currency = Model.get('currency.currency')
|
||||
>>> CurrencyRate = Model.get('currency.currency.rate')
|
||||
>>> Company = Model.get('company.company')
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> company_config = Wizard('company.company.config')
|
||||
>>> company_config.execute('company')
|
||||
>>> company = company_config.form
|
||||
>>> party = Party(name='Dunder Mifflin')
|
||||
>>> party.save()
|
||||
>>> company.party = party
|
||||
>>> currencies = Currency.find([('code', '=', 'USD')])
|
||||
>>> if not currencies:
|
||||
... currency = Currency(name='US Dollar', symbol='$', code='USD',
|
||||
... rounding=Decimal('0.01'), mon_grouping='[]',
|
||||
... mon_decimal_point='.')
|
||||
... currency.save()
|
||||
... CurrencyRate(date=today + relativedelta(month=1, day=1),
|
||||
... rate=Decimal('1.0'), currency=currency).save()
|
||||
... else:
|
||||
... currency, = currencies
|
||||
>>> company.currency = currency
|
||||
>>> company_config.execute('add')
|
||||
>>> company, = Company.find()
|
||||
>>> _ = create_company()
|
||||
>>> company = get_company()
|
||||
|
||||
Reload the context::
|
||||
|
||||
@@ -111,7 +88,7 @@ Add two shipment lines of same product::
|
||||
... move.to_location = customer_loc
|
||||
... move.company = company
|
||||
... move.unit_price = Decimal('1')
|
||||
... move.currency = currency
|
||||
... move.currency = company.currency
|
||||
>>> shipment_out.save()
|
||||
|
||||
Pack shipment::
|
||||
|
||||
Reference in New Issue
Block a user