0001-tests-add-basic-backoffice-form-fts-search-test-6551.patch
tests/api/test_formdata.py | ||
---|---|---|
807 | 807 |
resp = get_app(pub).get(sign_uri('/api/forms/test/list?full=on&order_by=-foobar', user=local_user)) |
808 | 808 |
assert [d['fields']['foobar'] for d in resp.json] == ['FOO BAR %02d' % i for i in range(29, -1, -1)] |
809 | 809 | |
810 |
# check fts |
|
811 |
resp = get_app(pub).get(sign_uri('/api/forms/test/list?full=on&q=foo', user=local_user)) |
|
812 |
assert len(resp.json) == 30 |
|
813 |
resp = get_app(pub).get(sign_uri('/api/forms/test/list?full=on&q=baz', user=local_user)) |
|
814 |
assert len(resp.json) == 14 |
|
815 | ||
810 | 816 | |
811 | 817 |
def test_api_list_formdata_unknown_filter(pub, local_user): |
812 | 818 |
pub.role_class.wipe() |
tests/backoffice_pages/test_all.py | ||
---|---|---|
492 | 492 |
assert resp.text.count('data-link') == 9 |
493 | 493 | |
494 | 494 | |
495 |
def test_backoffice_listing_fts(pub): |
|
496 |
if not pub.is_using_postgresql(): |
|
497 |
pytest.skip('this requires SQL') |
|
498 |
return |
|
499 |
create_superuser(pub) |
|
500 |
create_environment(pub) |
|
501 |
formdef = FormDef.get_by_urlname('form-title') |
|
502 | ||
503 |
app = login(get_app(pub)) |
|
504 |
resp = app.get('/backoffice/management/form-title/') |
|
505 |
assert resp.text.count('data-link') == 17 |
|
506 |
resp = app.get('/backoffice/management/form-title/') |
|
507 |
resp.forms['listing-settings']['filter'] = 'all' |
|
508 |
resp.forms['listing-settings']['q'] = 'foo' |
|
509 |
resp.forms['listing-settings']['limit'] = '100' |
|
510 |
resp = resp.forms['listing-settings'].submit() |
|
511 |
assert resp.pyquery('tbody tr').length == 50 |
|
512 |
assert [x.text for x in resp.pyquery('tbody tr .cell-id a')] == [ |
|
513 |
'%s-%s' % (formdef.id, i) for i in range(50, 0, -1) |
|
514 |
] |
|
515 | ||
516 |
resp.forms['listing-settings']['q'] = 'baz' |
|
517 |
resp = resp.forms['listing-settings'].submit() |
|
518 |
assert resp.pyquery('tbody tr').length == 24 |
|
519 | ||
520 | ||
495 | 521 |
def test_backoffice_legacy_urls(pub): |
496 | 522 |
create_superuser(pub) |
497 | 523 |
create_environment(pub) |
498 |
- |