0001-submission-warn-when-an-anonymous-form-is-created-if.patch
tests/test_backoffice_pages.py | ||
---|---|---|
3383 | 3383 |
assert formdata.submission_channel == 'mail' |
3384 | 3384 |
assert formdata.status == 'wf-new' |
3385 | 3385 | |
3386 |
# target user is unknown |
|
3387 |
app = login(get_app(pub)) |
|
3388 |
resp = app.get('/backoffice/submission/form-title/?NameID=UNKNOWN_NAMEID') |
|
3389 |
assert resp.location.startswith('http://example.net/backoffice/submission/form-title/') |
|
3390 |
formdata_no = resp.location.split('/')[-2] |
|
3391 |
formdata = formdef.data_class().get(formdata_no) |
|
3392 |
assert not formdata.user_id |
|
3393 |
resp = resp.follow() # redirect to created draft |
|
3394 |
resp = resp.follow() # redirect to ?mt= |
|
3395 |
assert 'The target user was not found, this form is anonymous.' in resp.text |
|
3396 | ||
3386 | 3397 | |
3387 | 3398 |
def test_backoffice_wscall_failure_display(http_requests, pub): |
3388 | 3399 |
user = create_user(pub) |
wcs/backoffice/submission.py | ||
---|---|---|
116 | 116 |
users = list(get_publisher().user_class.get_users_with_name_identifier(name_id)) |
117 | 117 |
if users: |
118 | 118 |
formdata.user_id = users[0].id |
119 |
else: |
|
120 |
get_session().message = ('warning', _('The target user was not found, this form is anonymous.')) |
|
119 | 121 |
if return_url: |
120 | 122 |
formdata.submission_context['return_url'] = return_url |
121 | 123 |
formdata.store() |
122 |
- |