494 |
494 |
def test_formdef_schema(pub):
|
495 |
495 |
Workflow.wipe()
|
496 |
496 |
workflow = Workflow(name='test')
|
497 |
|
workflow.add_status('Status1', 'st1')
|
498 |
|
workflow.add_status('Status2', 'st2')
|
|
497 |
st1 = workflow.add_status('Status1', 'st1')
|
|
498 |
jump = JumpWorkflowStatusItem()
|
|
499 |
jump.status = 'st2'
|
|
500 |
jump.timeout = 100
|
|
501 |
st1.items.append(jump)
|
|
502 |
st2 = workflow.add_status('Status2', 'st2')
|
|
503 |
jump = JumpWorkflowStatusItem()
|
|
504 |
jump.status = 'st3'
|
|
505 |
st2.items.append(jump)
|
|
506 |
st2 = workflow.add_status('Status3', 'st3')
|
499 |
507 |
workflow.backoffice_fields_formdef = WorkflowBackofficeFieldsFormDef(workflow)
|
500 |
508 |
workflow.backoffice_fields_formdef.fields = [
|
501 |
509 |
fields.StringField(id='bo1', label='1st backoffice field',
|
... | ... | |
575 |
583 |
assert resp4.json['fields'][1]['items'] == []
|
576 |
584 |
|
577 |
585 |
# workflow checks
|
578 |
|
assert len(resp.json['workflow']['statuses']) == 2
|
|
586 |
assert len(resp.json['workflow']['statuses']) == 3
|
|
587 |
assert resp.json['workflow']['statuses'][0]['id'] == 'st1'
|
|
588 |
assert resp.json['workflow']['statuses'][0]['endpoint'] is False
|
|
589 |
assert resp.json['workflow']['statuses'][0]['waitpoint'] is True
|
|
590 |
assert resp.json['workflow']['statuses'][1]['id'] == 'st2'
|
|
591 |
assert resp.json['workflow']['statuses'][1]['endpoint'] is False
|
|
592 |
assert resp.json['workflow']['statuses'][1]['waitpoint'] is False
|
|
593 |
assert resp.json['workflow']['statuses'][2]['id'] == 'st3'
|
|
594 |
assert resp.json['workflow']['statuses'][2]['endpoint'] is True
|
|
595 |
assert resp.json['workflow']['statuses'][2]['waitpoint'] is True
|
579 |
596 |
assert len(resp.json['workflow']['fields']) == 1
|
|
597 |
|
580 |
598 |
assert resp.json['workflow']['fields'][0]['label'] == '1st backoffice field'
|
581 |
599 |
|
582 |
600 |
get_app(pub).get('/api/formdefs/xxx/schema', status=404)
|