Steps_scenario_doctests - lampmantech/behaving.trytond GitHub Wiki

scenario_doctests.py

This is a straight cut-and-paste from trytond_*-2.8.*/tests/scenario_*.rst to refactor the doctests to eliminate duplication. All the steps in this file are used by all of the feature files that impelment the doctest scenari. The aim is to make each step idempotent, so that if you run a step again from another feature file, the work is not repeated, and will not error. That's easy in the early steps, but harder farther on, so some feature files will need to be run on their own. Most steps are commented as either idempotent or FixMe. It should be improved to be more like a Behave BDD.

STEP: Create database

STEP: Set the default feature data

You can use this step to define a set of default feature data that will be available using the vSetFeatureData and vSetFeatureData functions to pass data between steps. The default data is pulled from the Tryton code, but you can override this for your own production Chart of Accounts, users...

STEP: Set the feature data with values

You can use this step to define a set of default feature data that will be available using the vSetFeatureData and vSetFeatureData functions to pass data between steps. It expects a |name|value| table.

STEP: Create database with pool.test set to True

Sets pool.test set to True

STEP: Install the test module named "{uName}"

Installs a module using trytond.tests.test_tryton.install_module in case thats different to installing a module.

STEP: Create the Company with default COMPANY_NAME and Currency code "{uCode}"

Given \ Create the Company with default COMPANY_NAME and Currency code "{uCode}"

STEP: Create the Company associated with the party named "{uParty}" and using the currency "{uCode}"

STEP: Create the currency with Currency code "{uCode}"

Given \ Create the currency with Currency code "{uCode}" You'll need to do this before you use any other currencies than the company's base currency.

STEP: Reload the default User preferences into the context

Reload the default User get_preferences.

STEP: Create a saved instance of "{uKlass}" named "{uName}"

Given \ Create an instance of a Model, like Model.get('party.party') with the name attribute of 'uName'. Idempotent.

STEP: Create an instance of "{uKlass}" keyed "{uKey}" "{uName}" with |name|value| fields

STEP: Create an instance of "{uKlass}" named "{uName}" with fields

STEP: Create an instance of "{uKlass}" named "{uName}" with |name|value| fields

Given \ Create an instance of a Model, like Model.get('party.party') with the name attribute of 'uName' and the fields from the table. It expects a |name|value| table. Idempotent.

STEP: Set the slots of the instance named "{uName}" of model "{uKlass}" to the values

STEP: Set the instance named "{uName}" of model "{uKlass}" with fields

STEP: Set the instance named "{uName}" of model "{uKlass}" with |name|value| fields

Given \ Guven an instance named "uName" of a Model, like Model.get('party.party') set the attributes to the values. It expects a |name|value| table. Idempotent.

STEP: Set the slots of the instance described "{uName}" of model "{uKlass}" to the values

STEP: Set the instance described "{uName}" of model "{uKlass}" with fields

STEP: Set the instance described "{uName}" of model "{uKlass}" with |name|value| fields

Given \ Guven an instance described "uName" of a Model, like Model.get('account.invoice') set the attributes to the values. It expects a |name|value| table. Idempotent.

STEP: I find an instance of "{uKlass}" named "{uName}"

Find an instance of a Model, like Model.get('party.party') Idempotent.

STEP: Create parties

Given \ Create a party named "Supplier" And \ Create a party named "Customer"

STEP: Create a party named "{uName}"

STEP: Create a party named "{uName}" with Payable and Receivable

STEP: Create a party named "{uName}" with an account_payable attribute

STEP: Create a party named "{uName}" with payable and receivable properties

Given \ Create a party named "uName" with payable and receivable properties. The account_payable Account is taken from the 'account.template,main_payable' entry of the feature data (use 'Set the feature data with values' to override) Idempotent.

STEP: Create a party named "{uName}" with payable and receivable properties with fields

STEP: Create a party named "{uName}" with payable and receivable properties with |name|value| fields

Given \ Create a party named "uName" with payable and receivable properties. \ The account_payable Account is taken from the 'account.template,main_payable' entry of the feature data (use 'Set the feature data with values' to override) Then use the following |name|value| fields to set fields on the party. Idempotent.

STEP: Create a user named "{uName}" with the fields

STEP: Create a user named "{uName}" with the |name|value| fields

Given \ Create a res.user named 'uName' and the given field values. It expects a |name|value| table. If one of the field names is 'group', it will add the User to that group. It also loads the values into the feature data under the keys 'user,'+uName+","+row['name'] Idempotent.

STEP: Create a grouped user named "{uName}" with |name|value| fields

Given \ Create a user named "{uName}" with |name|value| fields

name value
login sale
group Sales

group can be repeated for list of groups.

STEP: Create a sale user

Given \ Create a grouped user named "Sale" with |name|value| fields

name value
login sale
group Sales

STEP: Create a purchase user

Given \ Given Create a grouped user named "Purchase" with |name|value| fields

name value
login purchase
group Purchase

STEP: Create a stock user

Given Create a grouped user named "Stock" with |name|value| fields

name value
login stock
group Stock

STEP: Create a account user

STEP: Create an account user

Given \ Create a grouped user named "Account" with |name|value| fields

name value
login account
group Account

STEP: Create a product user

Given \ Create a grouped user named "Product" with |name|value| fields

name value
login product
group Product Administration

STEP: Create a stock_admin user

Given \ Create a grouped user named "Stock Admin" with |name|value| fields

name value
login stock_admin
group Stock Administration

This file is automatically generated from the source code: do not edit.

⚠️ **GitHub.com Fallback** ⚠️