375 |
375 |
assert resp.text.count('"cell-user">admin<') == 0
|
376 |
376 |
|
377 |
377 |
|
|
378 |
def test_backoffice_custom_view_status_filter(pub):
|
|
379 |
create_superuser(pub)
|
|
380 |
|
|
381 |
FormDef.wipe()
|
|
382 |
pub.custom_view_class.wipe()
|
|
383 |
formdef = FormDef()
|
|
384 |
formdef.name = 'form title'
|
|
385 |
formdef.fields = [
|
|
386 |
fields.ItemField(
|
|
387 |
id='1',
|
|
388 |
label='field',
|
|
389 |
type='item',
|
|
390 |
items=['foo', 'bar', 'baz'],
|
|
391 |
display_locations=['validation', 'summary', 'listings'],
|
|
392 |
),
|
|
393 |
]
|
|
394 |
formdef.workflow_roles = {'_receiver': 1}
|
|
395 |
formdef.store()
|
|
396 |
|
|
397 |
formdef.data_class().wipe()
|
|
398 |
for i in range(3):
|
|
399 |
formdata = formdef.data_class()()
|
|
400 |
formdata.data = {}
|
|
401 |
if i == 0:
|
|
402 |
formdata.data['1'] = 'foo'
|
|
403 |
formdata.data['1_display'] = 'foo'
|
|
404 |
else:
|
|
405 |
formdata.data['1'] = 'baz'
|
|
406 |
formdata.data['1_display'] = 'baz'
|
|
407 |
formdata.jump_status('new')
|
|
408 |
formdata.store()
|
|
409 |
|
|
410 |
# change status of latest
|
|
411 |
formdata.jump_status('rejected')
|
|
412 |
formdata.store()
|
|
413 |
|
|
414 |
app = login(get_app(pub))
|
|
415 |
resp = app.get('/backoffice/management/form-title/')
|
|
416 |
assert resp.pyquery('tbody tr').length == 2
|
|
417 |
|
|
418 |
# filters
|
|
419 |
resp.forms['listing-settings']['filter'].value = 'rejected'
|
|
420 |
resp = resp.forms['listing-settings'].submit()
|
|
421 |
|
|
422 |
assert resp.pyquery('tbody tr').length == 1
|
|
423 |
|
|
424 |
resp.forms['save-custom-view']['title'] = 'custom test view'
|
|
425 |
resp = resp.forms['save-custom-view'].submit()
|
|
426 |
assert resp.location.endswith('/user-custom-test-view/')
|
|
427 |
resp = resp.follow()
|
|
428 |
assert resp.pyquery('tbody tr').length == 1
|
|
429 |
|
|
430 |
resp.forms['listing-settings']['filter-operator'] = 'ne'
|
|
431 |
resp = resp.forms['listing-settings'].submit()
|
|
432 |
assert resp.pyquery('tbody tr').length == 2
|
|
433 |
assert resp.forms['save-custom-view']['update'].checked is True
|
|
434 |
resp = resp.forms['save-custom-view'].submit()
|
|
435 |
assert pub.custom_view_class.select()[0].filters == {
|
|
436 |
'filter-operator': 'ne',
|
|
437 |
'filter': 'rejected',
|
|
438 |
'filter-status': 'on',
|
|
439 |
}
|
|
440 |
assert resp.location.endswith('/user-custom-test-view/')
|
|
441 |
resp = resp.follow()
|
|
442 |
assert resp.forms['listing-settings']['filter-operator'].value == 'ne'
|
|
443 |
assert resp.pyquery('tbody tr').length == 2
|
|
444 |
|
|
445 |
|
378 |
446 |
def test_backoffice_custom_view_delete(pub):
|
379 |
447 |
create_superuser(pub)
|
380 |
448 |
|