|
|
|
@ -455,7 +455,7 @@ def test_backoffice_custom_view_status_filter(pub):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_backoffice_custom_view_delete(pub):
|
|
|
|
|
create_superuser(pub)
|
|
|
|
|
user = create_superuser(pub)
|
|
|
|
|
|
|
|
|
|
FormDef.wipe()
|
|
|
|
|
pub.custom_view_class.wipe()
|
|
|
|
@ -481,6 +481,42 @@ def test_backoffice_custom_view_delete(pub):
|
|
|
|
|
resp = resp.follow()
|
|
|
|
|
assert 'custom test view' not in resp.text
|
|
|
|
|
|
|
|
|
|
CardDef.wipe()
|
|
|
|
|
carddef = CardDef()
|
|
|
|
|
carddef.name = 'foo'
|
|
|
|
|
carddef.fields = [
|
|
|
|
|
fields.StringField(id='1', label='Test', type='string', varname='foo'),
|
|
|
|
|
]
|
|
|
|
|
carddef.backoffice_submission_roles = user.roles
|
|
|
|
|
carddef.workflow_roles = {'_editor': user.roles[0]}
|
|
|
|
|
carddef.digest_templates = {
|
|
|
|
|
'default': 'plop',
|
|
|
|
|
'custom-view:custom-test-view': 'FOO {{ form_var_foo }}',
|
|
|
|
|
'custom-view:another-view': '{{ form_var_foo }}',
|
|
|
|
|
}
|
|
|
|
|
carddef.store()
|
|
|
|
|
|
|
|
|
|
custom_view = pub.custom_view_class()
|
|
|
|
|
custom_view.title = 'custom test view'
|
|
|
|
|
custom_view.formdef = carddef
|
|
|
|
|
custom_view.visibility = 'datasource'
|
|
|
|
|
custom_view.columns = {'list': [{'id': 'id'}]}
|
|
|
|
|
custom_view.filters = {}
|
|
|
|
|
custom_view.store()
|
|
|
|
|
|
|
|
|
|
resp = app.get('/backoffice/data/foo/custom-test-view/')
|
|
|
|
|
resp = resp.click('Delete')
|
|
|
|
|
resp = resp.form.submit()
|
|
|
|
|
assert resp.location.endswith('/data/foo/')
|
|
|
|
|
resp = resp.follow()
|
|
|
|
|
assert 'custom test view' not in resp.text
|
|
|
|
|
|
|
|
|
|
carddef.refresh_from_storage()
|
|
|
|
|
assert carddef.digest_templates == {
|
|
|
|
|
'default': 'plop',
|
|
|
|
|
'custom-view:another-view': '{{ form_var_foo }}',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_backoffice_custom_map_view(pub):
|
|
|
|
|
user = create_superuser(pub)
|
|
|
|
|