tests: add trigger jump + redirect test (#83418)
gitea/wcs/pipeline/head This commit looks good
Details
gitea/wcs/pipeline/head This commit looks good
Details
This commit is contained in:
parent
dfb7c39498
commit
b1cc42c2ee
|
@ -2872,7 +2872,7 @@ def test_form_workflow_trigger(pub):
|
|||
jump2.status = 'st3'
|
||||
jump2.set_marker_on_status = True
|
||||
|
||||
workflow.add_status('Status2', 'st2')
|
||||
st2 = workflow.add_status('Status2', 'st2')
|
||||
workflow.add_status('Status3', 'st3')
|
||||
workflow.store()
|
||||
|
||||
|
@ -2899,8 +2899,8 @@ def test_form_workflow_trigger(pub):
|
|||
|
||||
user.roles = [role.id]
|
||||
user.store()
|
||||
app.post(formdata.get_url() + 'jump/trigger/XXX', status=302)
|
||||
|
||||
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302)
|
||||
assert resp.location == formdata.get_url()
|
||||
formdata = formdef.data_class().get(formdata.id)
|
||||
assert formdata.status == 'wf-st2'
|
||||
|
||||
|
@ -2924,6 +2924,16 @@ def test_form_workflow_trigger(pub):
|
|||
formdata = formdef.data_class().get(formdata.id)
|
||||
assert formdata.workflow_data.get('data') == {'foo': 'bar'}
|
||||
|
||||
# check with redirect action
|
||||
formdata.status = 'wf-st1'
|
||||
formdata.store()
|
||||
redirect = st2.add_action('redirect_to_url')
|
||||
redirect.url = 'https://example.net'
|
||||
workflow.store()
|
||||
|
||||
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302)
|
||||
assert resp.location == 'https://example.net'
|
||||
|
||||
|
||||
def test_form_worklow_multiple_identical_status(pub):
|
||||
user = create_user(pub)
|
||||
|
|
Loading…
Reference in New Issue