migration/postcreate.py
author Julien Cristau <julien.cristau@logilab.fr>
Mon, 13 Apr 2015 11:12:49 +0200
changeset 1825 b859e64fc3ee
parent 1461 906875682b46
child 1580 2f465d1682da
permissions -rw-r--r--
Move setting of TestExecution.{options,execution_of} to a hook (closes #5242517) Apart from the 'archive' setting, they're inherited from the ProjectEnvironment and/or TestConfig. Make 'archive' a separate attribute instead.

# postcreate script. You could setup a workflow here for example

wf = add_workflow(u'Test configuration workflow', 'TestConfig')
activated = wf.add_state(_('activated'), initial=True)
deactivated = wf.add_state(_('deactivated'))
wf.add_transition(_('deactivate'), activated, deactivated,
                  requiredgroups=('managers',))
wf.add_transition(_('activate'), deactivated, activated,
                  requiredgroups=('managers',))

# workflows don't consider schema inheritance, so we need to set it explicitly
rql('SET WF workflow_of TE, TE default_workflow WF WHERE WF workflow_of P, P name "Plan", TE name "TestExecution"')
commit()

from cubes.apycot import recipes
recipes.create_quick_recipe(session)
recipes.create_full_recipe(session)
commit()