10 |
10 |
|
11 |
11 |
import pytest
|
12 |
12 |
from webtest import Upload
|
13 |
13 |
|
14 |
14 |
from wcs.qommon.http_request import HTTPRequest
|
15 |
15 |
from wcs.roles import Role
|
16 |
16 |
from wcs.workflows import (
|
17 |
17 |
Workflow, WorkflowCriticalityLevel, DisplayMessageWorkflowStatusItem,
|
18 |
|
WorkflowBackofficeFieldsFormDef, CommentableWorkflowStatusItem)
|
|
18 |
WorkflowBackofficeFieldsFormDef, CommentableWorkflowStatusItem,
|
|
19 |
ChoiceWorkflowStatusItem)
|
19 |
20 |
from wcs.wf.dispatch import DispatchWorkflowStatusItem
|
20 |
21 |
from wcs.wf.export_to_model import ExportToModel
|
21 |
22 |
from wcs.wf.jump import JumpWorkflowStatusItem
|
22 |
23 |
from wcs.wf.register_comment import RegisterCommenterWorkflowStatusItem
|
23 |
24 |
from wcs.wf.wscall import WebserviceCallStatusItem
|
24 |
25 |
from wcs.carddef import CardDef
|
25 |
26 |
from wcs.formdef import FormDef
|
26 |
27 |
from wcs import fields
|
... | ... | |
946 |
947 |
|
947 |
948 |
resp = app.get('/backoffice/workflows/1/')
|
948 |
949 |
resp = resp.click('baz')
|
949 |
950 |
resp = resp.click(href='items/1/', index=0)
|
950 |
951 |
assert 'foobar' not in [x[2] for x in resp.form['by$element0'].options]
|
951 |
952 |
assert '_receiver' in [x[0] for x in resp.form['by$element0'].options]
|
952 |
953 |
|
953 |
954 |
|
|
955 |
def test_workflows_edit_choice_action_line_details(pub):
|
|
956 |
create_superuser(pub)
|
|
957 |
create_role()
|
|
958 |
|
|
959 |
Workflow.wipe()
|
|
960 |
wf = Workflow(name='foo')
|
|
961 |
st1 = wf.add_status('New')
|
|
962 |
st2 = wf.add_status('Resubmit')
|
|
963 |
|
|
964 |
jump = ChoiceWorkflowStatusItem()
|
|
965 |
jump.id = '1'
|
|
966 |
jump.parent = st1
|
|
967 |
st1.items.append(jump)
|
|
968 |
wf.store()
|
|
969 |
|
|
970 |
app = login(get_app(pub))
|
|
971 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
972 |
assert resp.html.find('a', {'href': 'items/1/'}).text == 'Manual Jump (not completed)'
|
|
973 |
|
|
974 |
jump.label = 'Resubmit'
|
|
975 |
wf.store()
|
|
976 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
977 |
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
|
978 |
'Manual Jump (not completed)'
|
|
979 |
|
|
980 |
jump.status = st2.id
|
|
981 |
wf.store()
|
|
982 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
983 |
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
|
984 |
'Manual Jump ("Resubmit", to Resubmit)'
|
|
985 |
|
|
986 |
jump.label = 'Resubmit'
|
|
987 |
wf.store()
|
|
988 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
989 |
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
|
990 |
'Manual Jump ("Resubmit", to Resubmit)'
|
|
991 |
|
|
992 |
jump.set_marker_on_status = True
|
|
993 |
wf.store()
|
|
994 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
995 |
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
|
996 |
'Manual Jump ("Resubmit", to Resubmit (and set marker))'
|
|
997 |
|
|
998 |
jump.set_marker_on_status = False
|
|
999 |
jump.by = ['_submitter']
|
|
1000 |
wf.store()
|
|
1001 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
1002 |
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
|
1003 |
'Manual Jump ("Resubmit", to Resubmit, by User)'
|
|
1004 |
|
|
1005 |
jump.set_marker_on_status = True
|
|
1006 |
wf.store()
|
|
1007 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (wf.id, st1.id))
|
|
1008 |
assert resp.html.find('a', {'href': 'items/1/'}).text == \
|
|
1009 |
'Manual Jump ("Resubmit", to Resubmit, by User (and set marker))'
|
|
1010 |
|
|
1011 |
|
954 |
1012 |
def test_workflows_action_subpath(pub):
|
955 |
1013 |
create_superuser(pub)
|
956 |
1014 |
create_role()
|
957 |
1015 |
Workflow.wipe()
|
958 |
1016 |
workflow = Workflow(name='foo')
|
959 |
1017 |
baz_status = workflow.add_status(name='baz')
|
960 |
1018 |
display_message = DisplayMessageWorkflowStatusItem()
|
961 |
1019 |
display_message.parent = baz_status
|