add test_backoffice_global_action_jump_to_current_status

This commit is contained in:
Frédéric Péters 2021-10-11 19:36:27 +02:00
parent d15cd247eb
commit 7bbb071a68
1 changed files with 42 additions and 0 deletions

View File

@ -2089,6 +2089,48 @@ def test_backoffice_global_remove_action(pub):
assert 'The form has been deleted.' in resp.text
def test_backoffice_global_action_jump_to_current_status(pub):
create_user(pub)
create_environment(pub)
formdef = FormDef()
formdef.name = 'test jump to current status'
formdef.fields = []
workflow = Workflow()
st1 = workflow.add_status('Status1')
register_comment = RegisterCommenterWorkflowStatusItem()
register_comment.id = '_comment'
register_comment.comment = '<p>WORKFLOW COMMENT</p>'
st1.items.append(register_comment)
register_comment.parent = st1
action = workflow.add_global_action('FOOBAR')
action.append_item('jump')
action.items[0].status = st1.id
trigger = action.triggers[0]
trigger.roles = [x.id for x in pub.role_class.select() if x.name == 'foobar']
workflow.store()
formdef.workflow_id = workflow.id
formdef.workflow_roles = {'_receiver': 1}
formdef.store()
formdata = formdef.data_class()()
formdata.just_created()
formdata.perform_workflow()
formdata.store()
app = login(get_app(pub))
resp = app.get('/backoffice/management/%s/%s/' % (formdef.url_name, formdata.id))
assert resp.text.count('WORKFLOW COMMENT') == 1
assert 'button-action-1' in resp.form.fields
resp = resp.form.submit('button-action-1')
resp = resp.follow()
assert resp.text.count('WORKFLOW COMMENT') == 2
def test_backoffice_submission_context(pub):
user = create_user(pub)
create_environment(pub)