forms: use proper role message for past forms (#49627)

This commit is contained in:
Frédéric Péters 2020-12-20 15:48:52 +01:00
parent 0f571321be
commit f747428404
2 changed files with 24 additions and 1 deletions

View File

@ -563,6 +563,29 @@ def test_form_string_with_invalid_xml_chars(pub):
assert data.data == {'0': 'helloworld'}
def test_form_submit_handling_role_info(pub):
role = Role(name='xxx')
role.details = 'Managing service'
role.store()
formdef = create_formdef()
formdef.workflow_roles = {'_receiver': role.id}
formdef.store()
formdef.data_class().wipe()
resp = get_app(pub).get('/test/')
resp = resp.form.submit('submit')
assert 'Check values then click submit.' in resp
resp = resp.form.submit('submit').follow()
assert 'The form has been recorded' in resp
assert 'Your case is handled by' in resp
assert 'Managing service' in resp
formdata = formdef.data_class().select()[0]
formdata.jump_status('rejected')
formdata.store()
resp = resp.test_app.get(resp.request.url)
assert 'Your case has been handled by' in resp
def assert_current_page(resp, page_label):
for li_tag in resp.html.findAll('li'):
if 'current' in li_tag.attrs['class']:

View File

@ -236,7 +236,7 @@ class FormStatusPage(Directory, FormTemplateMixin):
r = TemplateIO(html=True)
endpoint_status = self.formdef.workflow.get_endpoint_status()
r += htmltext('<p>')
if self.filled.status in [x.id for x in endpoint_status]:
if self.filled.status in ['wf-%s' % x.id for x in endpoint_status]:
r += _('Your case has been handled by:')
else:
r += _('Your case is handled by:')