0001-backoffice-let-agent-select-channel-during-submissio.patch
tests/backoffice_pages/test_submission.py | ||
---|---|---|
1184 | 1184 |
assert data_class.get(formdata_no).submission_channel == 'mail' |
1185 | 1185 | |
1186 | 1186 | |
1187 |
def test_backoffice_submission_manual_channel_with_return_url(pub): |
|
1188 |
user = create_user(pub) |
|
1189 | ||
1190 |
FormDef.wipe() |
|
1191 |
formdef = FormDef() |
|
1192 |
formdef.name = 'form title' |
|
1193 |
formdef.fields = [ |
|
1194 |
fields.StringField( |
|
1195 |
id='1', label='1st field', type='string', |
|
1196 |
display_locations=['validation', 'summary', 'listings']), |
|
1197 |
] |
|
1198 |
formdef.backoffice_submission_roles = user.roles[:] |
|
1199 |
formdef.workflow_roles = {'_receiver': '23'} # role the user doesn't have |
|
1200 |
formdef.store() |
|
1201 | ||
1202 |
app = login(get_app(pub)) |
|
1203 |
resp = app.get('/backoffice/submission/%s/?ReturnURL=http://example.net' % formdef.url_name) |
|
1204 |
resp = resp.follow().follow() |
|
1205 | ||
1206 |
assert resp.form['submission_channel'].attrs['type'] == 'hidden' |
|
1207 |
resp.form['submission_channel'] = 'mail' |
|
1208 |
resp.form['f1'] = 'test submission' |
|
1209 |
resp = resp.form.submit('submit') |
|
1210 |
assert 'Check values then click submit.' in resp.text |
|
1211 | ||
1212 |
# final submit |
|
1213 |
resp = resp.form.submit('submit') |
|
1214 |
# as the user doesn't have a role to view the submitted form there's a |
|
1215 |
# redirection to the preset URL. |
|
1216 |
assert resp.location == 'http://example.net' |
|
1217 | ||
1218 | ||
1187 | 1219 |
def test_backoffice_submission_no_manual_channel_with_welco(pub, welco_url): |
1188 | 1220 |
user = create_user(pub) |
1189 | 1221 |
wcs/backoffice/submission.py | ||
---|---|---|
219 | 219 |
if self.on_validation_page or self.edit_mode: |
220 | 220 |
r += FormBackOfficeStatusPage(self.formdef, formdata).get_extra_context_bar() |
221 | 221 |
else: |
222 |
if formdata and formdata.submission_context: |
|
222 |
if formdata and formdata.submission_context and \ |
|
223 |
set(formdata.submission_context.keys()) != {'return_url'}: |
|
223 | 224 |
r += FormBackOfficeStatusPage(self.formdef, formdata).get_extra_submission_context_bar() |
224 | 225 |
elif self.has_channel_support: |
225 | 226 |
r += htmltext('<div class="submit-channel-selection" style="display: none;">') |
226 |
- |