4083 |
4083 |
assert '<!-- backoffice: False -->' in resp.body
|
4084 |
4084 |
|
4085 |
4085 |
def test_form_status_appearance_keywords(pub):
|
|
4086 |
create_user(pub)
|
|
4087 |
formdef = create_formdef()
|
|
4088 |
formdef.data_class().wipe()
|
|
4089 |
|
4086 |
4090 |
formdef = create_formdef()
|
4087 |
4091 |
formdef.fields = [
|
4088 |
4092 |
fields.ItemField(id='1', label='select', type='item',
|
... | ... | |
4111 |
4115 |
|
4112 |
4116 |
resp = get_app(pub).get('/test/')
|
4113 |
4117 |
assert 'class="quixote foobar plop"' in resp.body
|
|
4118 |
|
|
4119 |
def test_user_global_action(pub):
|
|
4120 |
user = create_user(pub)
|
|
4121 |
|
|
4122 |
workflow = Workflow.get_default_workflow()
|
|
4123 |
workflow.id = '2'
|
|
4124 |
action = workflow.add_global_action('FOOBAR')
|
|
4125 |
register_comment = action.append_item('register-comment')
|
|
4126 |
register_comment.comment = 'HELLO WORLD GLOBAL ACTION'
|
|
4127 |
jump = action.append_item('jump')
|
|
4128 |
jump.status = 'finished'
|
|
4129 |
trigger = action.triggers[0]
|
|
4130 |
|
|
4131 |
workflow.store()
|
|
4132 |
|
|
4133 |
formdef = FormDef()
|
|
4134 |
formdef.name = 'test global action'
|
|
4135 |
formdef.fields = []
|
|
4136 |
formdef.workflow_id = workflow.id
|
|
4137 |
formdef.workflow_roles = {}
|
|
4138 |
formdef.store()
|
|
4139 |
|
|
4140 |
formdef.data_class().wipe()
|
|
4141 |
|
|
4142 |
app = login(get_app(pub), username='foo', password='foo')
|
|
4143 |
resp = app.get(formdef.get_url())
|
|
4144 |
resp = resp.form.submit('submit')
|
|
4145 |
resp = resp.form.submit('submit')
|
|
4146 |
|
|
4147 |
assert formdef.data_class().count() == 1
|
|
4148 |
formdata = formdef.data_class().select()[0]
|
|
4149 |
|
|
4150 |
resp = app.get(formdata.get_url())
|
|
4151 |
assert not 'button-action-1' in resp.body
|
|
4152 |
|
|
4153 |
trigger.roles = ['_submitter']
|
|
4154 |
workflow.store()
|
|
4155 |
|
|
4156 |
resp = app.get(formdata.get_url())
|
|
4157 |
assert 'button-action-1' in resp.form.fields
|
|
4158 |
resp = resp.form.submit('button-action-1')
|
|
4159 |
|
|
4160 |
resp = app.get(formdata.get_url())
|
|
4161 |
assert 'HELLO WORLD GLOBAL ACTION' in resp.body
|
|
4162 |
assert formdef.data_class().get(formdata.id).status == 'wf-finished'
|