4312 |
4312 |
assert resp.forms[0]['f2'].value == 'foo@localhost'
|
4313 |
4313 |
|
4314 |
4314 |
|
|
4315 |
def test_formdata_workflow_many_forms(pub):
|
|
4316 |
create_user(pub)
|
|
4317 |
wf = Workflow(name='status')
|
|
4318 |
st1 = wf.add_status('Status1', 'st1')
|
|
4319 |
|
|
4320 |
display_form1 = FormWorkflowStatusItem()
|
|
4321 |
display_form1.id = '_x'
|
|
4322 |
display_form1.by = ['_submitter']
|
|
4323 |
display_form1.varname = 'xxx'
|
|
4324 |
display_form1.formdef = WorkflowFormFieldsFormDef(item=display_form1)
|
|
4325 |
display_form1.formdef.fields.append(fields.StringField(id='1', label='blah1'))
|
|
4326 |
st1.items.append(display_form1)
|
|
4327 |
display_form1.parent = st1
|
|
4328 |
|
|
4329 |
display_form2 = FormWorkflowStatusItem()
|
|
4330 |
display_form2.id = '_y'
|
|
4331 |
display_form2.by = ['_submitter']
|
|
4332 |
display_form2.varname = 'yyy'
|
|
4333 |
display_form2.formdef = WorkflowFormFieldsFormDef(item=display_form2)
|
|
4334 |
display_form2.formdef.fields.append(fields.StringField(id='1', label='blah2'))
|
|
4335 |
st1.items.append(display_form2)
|
|
4336 |
display_form2.parent = st1
|
|
4337 |
|
|
4338 |
wf.store()
|
|
4339 |
|
|
4340 |
formdef = create_formdef()
|
|
4341 |
formdef.workflow_id = wf.id
|
|
4342 |
formdef.fields = []
|
|
4343 |
formdef.store()
|
|
4344 |
formdef.data_class().wipe()
|
|
4345 |
|
|
4346 |
resp = login(get_app(pub), username='foo', password='foo').get('/test/')
|
|
4347 |
resp = resp.forms[0].submit('submit')
|
|
4348 |
assert 'Check values then click submit.' in resp.text
|
|
4349 |
resp = resp.forms[0].submit('submit')
|
|
4350 |
assert resp.status_int == 302
|
|
4351 |
resp = resp.follow()
|
|
4352 |
assert 'The form has been recorded' in resp.text
|
|
4353 |
|
|
4354 |
|
4315 |
4355 |
def test_form_map_field_back_and_submit(pub):
|
4316 |
4356 |
formdef = create_formdef()
|
4317 |
4357 |
formdef.fields = [
|
4318 |
|
-
|