tests: add test around export to model action

This commit is contained in:
Frédéric Péters 2020-12-20 17:51:37 +01:00
parent 0f26a16d28
commit fd45925d20
1 changed files with 31 additions and 0 deletions

View File

@ -1054,6 +1054,37 @@ def test_workflows_edit_choice_action_line_details(pub):
'Manual Jump ("Resubmit", to previously marked status, by User (and set marker))'
def test_workflows_edit_export_to_model_action(pub):
create_superuser(pub)
Workflow.wipe()
workflow = Workflow(name='foo')
workflow.add_status(name='baz')
workflow.store()
app = login(get_app(pub))
resp = app.get('/backoffice/workflows/1/')
resp = resp.click('baz')
resp.forms[0]['action-formdata-action'] = 'Document Creation'
resp = resp.forms[0].submit()
resp = resp.follow()
resp = resp.click('Document Creation')
model_content = open(os.path.join(os.path.dirname(__file__), '../template.odt'), 'rb').read()
resp.form['model_file$file'] = Upload('test.odt', model_content)
resp = resp.form.submit('submit')
resp = resp.follow()
resp = resp.follow()
resp = resp.click('Document Creation')
resp_model_content = resp.click('test.odt')
assert resp_model_content.body == model_content
resp = resp.form.submit('submit').follow().follow()
# check file model is still there
resp = resp.click('Document Creation')
resp_model_content = resp.click('test.odt')
assert resp_model_content.body == model_content
def test_workflows_action_subpath(pub):
create_superuser(pub)
create_role()