4053 |
4053 |
assert '<!-- backoffice: False -->' in resp.body
|
4054 |
4054 |
|
4055 |
4055 |
def test_form_status_appearance_keywords(pub):
|
|
4056 |
create_user(pub)
|
|
4057 |
formdef = create_formdef()
|
|
4058 |
formdef.data_class().wipe()
|
|
4059 |
|
4056 |
4060 |
formdef = create_formdef()
|
4057 |
4061 |
formdef.fields = [
|
4058 |
4062 |
fields.ItemField(id='1', label='select', type='item',
|
... | ... | |
4081 |
4085 |
|
4082 |
4086 |
resp = get_app(pub).get('/test/')
|
4083 |
4087 |
assert 'class="quixote foobar plop"' in resp.body
|
|
4088 |
|
|
4089 |
def test_user_global_action(pub):
|
|
4090 |
user = create_user(pub)
|
|
4091 |
|
|
4092 |
workflow = Workflow.get_default_workflow()
|
|
4093 |
workflow.id = '2'
|
|
4094 |
action = workflow.add_global_action('FOOBAR')
|
|
4095 |
register_comment = action.append_item('register-comment')
|
|
4096 |
register_comment.comment = 'HELLO WORLD GLOBAL ACTION'
|
|
4097 |
jump = action.append_item('jump')
|
|
4098 |
jump.status = 'finished'
|
|
4099 |
trigger = action.triggers[0]
|
|
4100 |
|
|
4101 |
workflow.store()
|
|
4102 |
|
|
4103 |
formdef = FormDef()
|
|
4104 |
formdef.name = 'test global action'
|
|
4105 |
formdef.fields = []
|
|
4106 |
formdef.workflow_id = workflow.id
|
|
4107 |
formdef.workflow_roles = {}
|
|
4108 |
formdef.store()
|
|
4109 |
|
|
4110 |
formdef.data_class().wipe()
|
|
4111 |
|
|
4112 |
app = login(get_app(pub), username='foo', password='foo')
|
|
4113 |
resp = app.get(formdef.get_url())
|
|
4114 |
resp = resp.form.submit('submit')
|
|
4115 |
resp = resp.form.submit('submit')
|
|
4116 |
|
|
4117 |
assert formdef.data_class().count() == 1
|
|
4118 |
formdata = formdef.data_class().select()[0]
|
|
4119 |
|
|
4120 |
resp = app.get(formdata.get_url())
|
|
4121 |
assert not 'button-action-1' in resp.body
|
|
4122 |
|
|
4123 |
trigger.roles = ['_submitter']
|
|
4124 |
workflow.store()
|
|
4125 |
|
|
4126 |
resp = app.get(formdata.get_url())
|
|
4127 |
assert 'button-action-1' in resp.form.fields
|
|
4128 |
resp = resp.form.submit('button-action-1')
|
|
4129 |
|
|
4130 |
resp = app.get(formdata.get_url())
|
|
4131 |
assert 'HELLO WORLD GLOBAL ACTION' in resp.body
|
|
4132 |
assert formdef.data_class().get(formdata.id).status == 'wf-finished'
|