1061 |
1061 |
|
1062 |
1062 |
# attachments without backoffice fields: python expressions
|
1063 |
1063 |
resp = app.get(item_url)
|
1064 |
|
assert "Attachments (templates or Python expressions)" in resp.text
|
|
1064 |
assert "Attachments (templates)" in resp.text
|
1065 |
1065 |
resp.form['attachments$element0'] = 'form_var_upload_raw'
|
1066 |
1066 |
resp = resp.form.submit('submit')
|
1067 |
1067 |
assert resp.location
|
1068 |
1068 |
resp = app.get(item_url)
|
1069 |
|
assert "Attachments (templates or Python expressions)" in resp.text
|
|
1069 |
assert "Attachments (templates)" in resp.text
|
1070 |
1070 |
assert resp.form['attachments$element0'].value == 'form_var_upload_raw'
|
1071 |
1071 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
1072 |
1072 |
assert sendmail.attachments == ['form_var_upload_raw']
|
... | ... | |
1082 |
1082 |
workflow.store()
|
1083 |
1083 |
resp = app.get(item_url)
|
1084 |
1084 |
assert "Attachments" in resp.text
|
1085 |
|
assert "Attachments (templates or Python expressions)" not in resp.text
|
1086 |
|
assert resp.form['attachments$element0$choice'].value == 'form_var_upload_raw'
|
|
1085 |
assert "Attachments (templates)" not in resp.text
|
|
1086 |
assert resp.form['attachments$element0$choice'].value == '{{form_var_upload_raw}}'
|
1087 |
1087 |
assert len(resp.form['attachments$element0$choice'].options) == 5
|
1088 |
1088 |
resp = resp.form.submit('attachments$add_element') # add one
|
1089 |
|
resp.form['attachments$element1$choice'] = 'form_var_upload2_raw'
|
|
1089 |
resp.form['attachments$element1$choice'] = '{{form_var_upload2_raw}}'
|
1090 |
1090 |
resp = resp.form.submit('submit')
|
1091 |
1091 |
assert resp.location
|
1092 |
1092 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
1093 |
|
assert sendmail.attachments == ['form_var_upload_raw', 'form_var_upload2_raw']
|
|
1093 |
assert sendmail.attachments == ['{{form_var_upload_raw}}', '{{form_var_upload2_raw}}']
|
1094 |
1094 |
|
1095 |
1095 |
resp = app.get(item_url)
|
1096 |
1096 |
resp = resp.form.submit('attachments$add_element') # add one
|
1097 |
|
resp.form['attachments$element2$choice'] = 'form_fbo3_3x'
|
|
1097 |
resp.form['attachments$element2$choice'] = '{{form_fbo3_3x}}'
|
1098 |
1098 |
resp = resp.form.submit('submit')
|
1099 |
1099 |
assert resp.location
|
1100 |
1100 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
1101 |
|
assert sendmail.attachments == ['form_var_upload_raw', 'form_var_upload2_raw', 'form_fbo3_3x']
|
|
1101 |
assert sendmail.attachments == ['{{form_var_upload_raw}}', '{{form_var_upload2_raw}}', '{{form_fbo3_3x}}']
|
1102 |
1102 |
|
1103 |
1103 |
resp = app.get(item_url)
|
1104 |
1104 |
resp = resp.form.submit('attachments$add_element') # add one
|
... | ... | |
1108 |
1108 |
assert resp.location
|
1109 |
1109 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
1110 |
1110 |
assert sendmail.attachments == [
|
|
1111 |
'{{form_var_upload_raw}}',
|
|
1112 |
'{{form_var_upload2_raw}}',
|
|
1113 |
'{{form_fbo3_3x}}',
|
|
1114 |
'{"content":"foo", "filename":"bar.txt"}',
|
|
1115 |
]
|
|
1116 |
|
|
1117 |
# check old attachments python expressions are converted to templates
|
|
1118 |
workflow.refresh_from_storage()
|
|
1119 |
workflow.get_status(st1.id).items[0].attachments = [
|
1111 |
1120 |
'form_var_upload_raw',
|
1112 |
1121 |
'form_var_upload2_raw',
|
1113 |
|
'form_fbo3_3x',
|
|
1122 |
'{"content":"foo", "filename":"bar.txt"}',
|
|
1123 |
]
|
|
1124 |
workflow.store()
|
|
1125 |
resp = app.get(item_url)
|
|
1126 |
resp = resp.form.submit('submit')
|
|
1127 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
|
1128 |
assert sendmail.attachments == [
|
|
1129 |
'{{form_var_upload_raw}}',
|
|
1130 |
'{{form_var_upload2_raw}}',
|
1114 |
1131 |
'{"content":"foo", "filename":"bar.txt"}',
|
1115 |
1132 |
]
|
1116 |
1133 |
|
... | ... | |
1125 |
1142 |
assert resp.location
|
1126 |
1143 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
1127 |
1144 |
assert sendmail.attachments == [
|
1128 |
|
'form_var_upload_raw',
|
1129 |
|
'form_var_upload2_raw',
|
|
1145 |
'{{form_var_upload_raw}}',
|
|
1146 |
'{{form_var_upload2_raw}}',
|
1130 |
1147 |
'{"content":"foo", "filename":"bar.txt"}',
|
1131 |
1148 |
]
|
|
1149 |
|
1132 |
1150 |
# remove all backoffice fields
|
1133 |
1151 |
workflow = Workflow.get(workflow.id)
|
1134 |
1152 |
workflow.backoffice_fields_formdef.fields = []
|
1135 |
1153 |
workflow.store()
|
1136 |
1154 |
resp = app.get(item_url)
|
1137 |
|
assert "Attachments (templates or Python expressions)" in resp.text
|
|
1155 |
assert "Attachments (templates)" in resp.text
|
1138 |
1156 |
resp = resp.form.submit('submit')
|
1139 |
1157 |
assert resp.location
|
1140 |
1158 |
sendmail = Workflow.get(workflow.id).get_status(st1.id).items[0]
|
1141 |
1159 |
assert sendmail.attachments == [
|
1142 |
|
'form_var_upload_raw',
|
1143 |
|
'form_var_upload2_raw',
|
|
1160 |
'{{form_var_upload_raw}}',
|
|
1161 |
'{{form_var_upload2_raw}}',
|
1144 |
1162 |
'{"content":"foo", "filename":"bar.txt"}',
|
1145 |
1163 |
]
|
1146 |
1164 |
|