0001-misc-remove-fields-blocks-site-option-57260.patch
tests/admin_pages/test_block.py | ||
---|---|---|
34 | 34 |
clean_temporary_pub() |
35 | 35 | |
36 | 36 | |
37 |
def test_block_404(pub, blocks_feature):
|
|
37 |
def test_block_404(pub): |
|
38 | 38 |
create_superuser(pub) |
39 | 39 |
create_role(pub) |
40 | 40 |
BlockDef.wipe() |
... | ... | |
42 | 42 |
app.get('/backoffice/forms/blocks/1/', status=404) |
43 | 43 | |
44 | 44 | |
45 |
def test_block_new(pub, blocks_feature):
|
|
45 |
def test_block_new(pub): |
|
46 | 46 |
create_superuser(pub) |
47 | 47 |
create_role(pub) |
48 | 48 |
BlockDef.wipe() |
... | ... | |
73 | 73 |
assert str(BlockDef.get(1).fields[0].id) != '1' # don't use integers |
74 | 74 | |
75 | 75 | |
76 |
def test_block_options(pub, blocks_feature):
|
|
76 |
def test_block_options(pub): |
|
77 | 77 |
create_superuser(pub) |
78 | 78 |
BlockDef.wipe() |
79 | 79 |
block = BlockDef() |
... | ... | |
104 | 104 |
resp = resp.follow() |
105 | 105 | |
106 | 106 | |
107 |
def test_block_options_digest_template(pub, blocks_feature):
|
|
107 |
def test_block_options_digest_template(pub): |
|
108 | 108 |
create_superuser(pub) |
109 | 109 |
BlockDef.wipe() |
110 | 110 |
block = BlockDef() |
... | ... | |
130 | 130 |
assert block.digest_template == 'X{{foobar_var_foo}}Y' |
131 | 131 | |
132 | 132 | |
133 |
def test_block_export_import(pub, blocks_feature):
|
|
133 |
def test_block_export_import(pub): |
|
134 | 134 |
create_superuser(pub) |
135 | 135 |
BlockDef.wipe() |
136 | 136 |
block = BlockDef() |
... | ... | |
177 | 177 |
assert 'Invalid File' in resp |
178 | 178 | |
179 | 179 | |
180 |
def test_block_delete(pub, blocks_feature):
|
|
180 |
def test_block_delete(pub): |
|
181 | 181 |
create_superuser(pub) |
182 | 182 |
BlockDef.wipe() |
183 | 183 |
FormDef.wipe() |
... | ... | |
213 | 213 |
assert 'This block is still used' in resp |
214 | 214 | |
215 | 215 | |
216 |
def test_block_edit_duplicate_delete_field(pub, blocks_feature):
|
|
216 |
def test_block_edit_duplicate_delete_field(pub): |
|
217 | 217 |
create_superuser(pub) |
218 | 218 |
BlockDef.wipe() |
219 | 219 |
block = BlockDef() |
... | ... | |
241 | 241 |
assert len(BlockDef.get(block.id).fields) == 1 |
242 | 242 | |
243 | 243 | |
244 |
def test_block_use_in_formdef(pub, blocks_feature):
|
|
244 |
def test_block_use_in_formdef(pub): |
|
245 | 245 |
create_superuser(pub) |
246 | 246 |
FormDef.wipe() |
247 | 247 |
BlockDef.wipe() |
tests/backoffice_pages/test_carddata.py | ||
---|---|---|
541 | 541 |
assert pub.loggederror_class.select()[0].get_formdata().data == {'1': 'plop'} |
542 | 542 | |
543 | 543 | |
544 |
def test_block_card_item_link(pub, blocks_feature):
|
|
544 |
def test_block_card_item_link(pub): |
|
545 | 545 |
user = create_user(pub) |
546 | 546 |
CardDef.wipe() |
547 | 547 |
carddef = CardDef() |
tests/conftest.py | ||
---|---|---|
52 | 52 |
return site_options(request, pub, 'options', 'welco_url', 'http://welco.example.net') |
53 | 53 | |
54 | 54 | |
55 |
@pytest.fixture |
|
56 |
def blocks_feature(request, pub): |
|
57 |
return site_options(request, pub, 'options', 'fields-blocks', 'true') |
|
58 | ||
59 | ||
60 | 55 |
@pytest.fixture |
61 | 56 |
def emails(): |
62 | 57 |
with EmailsMocking() as mock: |
tests/form_pages/test_block.py | ||
---|---|---|
44 | 44 |
clean_temporary_pub() |
45 | 45 | |
46 | 46 | |
47 |
def test_block_simple(pub, blocks_feature):
|
|
47 |
def test_block_simple(pub): |
|
48 | 48 |
FormDef.wipe() |
49 | 49 |
BlockDef.wipe() |
50 | 50 | |
... | ... | |
79 | 79 |
assert '>bar<' in resp |
80 | 80 | |
81 | 81 | |
82 |
def test_block_required(pub, blocks_feature):
|
|
82 |
def test_block_required(pub): |
|
83 | 83 |
FormDef.wipe() |
84 | 84 |
BlockDef.wipe() |
85 | 85 | |
... | ... | |
145 | 145 |
assert 'Check values then click submit.' in resp.text |
146 | 146 | |
147 | 147 | |
148 |
def test_block_required_previous_page(pub, blocks_feature):
|
|
148 |
def test_block_required_previous_page(pub): |
|
149 | 149 |
FormDef.wipe() |
150 | 150 |
BlockDef.wipe() |
151 | 151 | |
... | ... | |
243 | 243 |
assert formdata.data['1']['data'] == [{'123': 'foo', '234': 'bar'}, {'123': 'foo2', '234': 'bar2'}] |
244 | 244 | |
245 | 245 | |
246 |
def test_block_date(pub, blocks_feature):
|
|
246 |
def test_block_date(pub): |
|
247 | 247 |
FormDef.wipe() |
248 | 248 |
BlockDef.wipe() |
249 | 249 | |
... | ... | |
273 | 273 |
assert '>2020-06-16<' in resp |
274 | 274 | |
275 | 275 | |
276 |
def test_block_bool(pub, blocks_feature):
|
|
276 |
def test_block_bool(pub): |
|
277 | 277 |
FormDef.wipe() |
278 | 278 |
BlockDef.wipe() |
279 | 279 | |
... | ... | |
309 | 309 |
assert '<div class="value">No</div>' in resp |
310 | 310 | |
311 | 311 | |
312 |
def test_block_autocomplete_list(pub, blocks_feature):
|
|
312 |
def test_block_autocomplete_list(pub): |
|
313 | 313 |
FormDef.wipe() |
314 | 314 |
BlockDef.wipe() |
315 | 315 | |
... | ... | |
346 | 346 |
assert '>Bar<' in resp |
347 | 347 | |
348 | 348 | |
349 |
def test_block_geoloc_prefill(pub, blocks_feature):
|
|
349 |
def test_block_geoloc_prefill(pub): |
|
350 | 350 |
FormDef.wipe() |
351 | 351 |
BlockDef.wipe() |
352 | 352 | |
... | ... | |
376 | 376 |
assert resp.html.find('div', {'data-geolocation': 'road'}) |
377 | 377 | |
378 | 378 | |
379 |
def test_block_string_prefill(pub, blocks_feature):
|
|
379 |
def test_block_string_prefill(pub): |
|
380 | 380 |
FormDef.wipe() |
381 | 381 |
BlockDef.wipe() |
382 | 382 | |
... | ... | |
476 | 476 |
assert resp.form['f3$element0$f123'].value == 'Foobar' |
477 | 477 | |
478 | 478 | |
479 |
def test_block_prefill_and_required(pub, blocks_feature):
|
|
479 |
def test_block_prefill_and_required(pub): |
|
480 | 480 |
FormDef.wipe() |
481 | 481 |
BlockDef.wipe() |
482 | 482 | |
... | ... | |
526 | 526 |
assert formdata.data['3']['data'][0]['234'] is True |
527 | 527 | |
528 | 528 | |
529 |
def test_block_locked_prefill(pub, blocks_feature):
|
|
529 |
def test_block_locked_prefill(pub): |
|
530 | 530 |
FormDef.wipe() |
531 | 531 |
BlockDef.wipe() |
532 | 532 | |
... | ... | |
714 | 714 |
assert resp.form['fxxx_3$element0$f123'].value == 'foo@localhost' |
715 | 715 | |
716 | 716 | |
717 |
def test_block_title_and_comment(pub, blocks_feature):
|
|
717 |
def test_block_title_and_comment(pub): |
|
718 | 718 |
FormDef.wipe() |
719 | 719 |
BlockDef.wipe() |
720 | 720 | |
... | ... | |
743 | 743 |
resp = resp.follow() |
744 | 744 | |
745 | 745 | |
746 |
def test_block_label(pub, blocks_feature):
|
|
746 |
def test_block_label(pub): |
|
747 | 747 |
FormDef.wipe() |
748 | 748 |
BlockDef.wipe() |
749 | 749 | |
... | ... | |
787 | 787 |
assert 'Block Label' not in resp.text |
788 | 788 | |
789 | 789 | |
790 |
def test_block_multipage(pub, blocks_feature):
|
|
790 |
def test_block_multipage(pub): |
|
791 | 791 |
FormDef.wipe() |
792 | 792 |
BlockDef.wipe() |
793 | 793 | |
... | ... | |
828 | 828 |
assert '>bar<' in resp |
829 | 829 | |
830 | 830 | |
831 |
def test_block_repeated(pub, blocks_feature):
|
|
831 |
def test_block_repeated(pub): |
|
832 | 832 |
FormDef.wipe() |
833 | 833 |
BlockDef.wipe() |
834 | 834 | |
... | ... | |
895 | 895 |
assert '>bar2<' in resp |
896 | 896 | |
897 | 897 | |
898 |
def test_block_repeated_over_limit(pub, blocks_feature):
|
|
898 |
def test_block_repeated_over_limit(pub): |
|
899 | 899 |
FormDef.wipe() |
900 | 900 |
BlockDef.wipe() |
901 | 901 | |
... | ... | |
943 | 943 |
assert 'Too many elements (maximum: 2)' in resp |
944 | 944 | |
945 | 945 | |
946 |
def test_block_repeated_files(pub, blocks_feature):
|
|
946 |
def test_block_repeated_files(pub): |
|
947 | 947 |
FormDef.wipe() |
948 | 948 |
BlockDef.wipe() |
949 | 949 | |
... | ... | |
1001 | 1001 | |
1002 | 1002 | |
1003 | 1003 |
@pytest.mark.parametrize('removed_line', [0, 1, 2]) |
1004 |
def test_block_repeated_remove_line(pub, blocks_feature, removed_line):
|
|
1004 |
def test_block_repeated_remove_line(pub, removed_line): |
|
1005 | 1005 |
FormDef.wipe() |
1006 | 1006 |
BlockDef.wipe() |
1007 | 1007 | |
... | ... | |
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 |
@pytest.mark.parametrize('block_name', ['foobar', 'Foo bar']) |
1082 |
def test_block_digest(pub, blocks_feature, block_name):
|
|
1082 |
def test_block_digest(pub, block_name): |
|
1083 | 1083 |
FormDef.wipe() |
1084 | 1084 |
BlockDef.wipe() |
1085 | 1085 | |
... | ... | |
1139 | 1139 |
assert formdef.data_class().select()[0].data['1_display'] == 'XfooY, Xfoo2Y' |
1140 | 1140 | |
1141 | 1141 | |
1142 |
def test_block_digest_item(pub, blocks_feature):
|
|
1142 |
def test_block_digest_item(pub): |
|
1143 | 1143 |
FormDef.wipe() |
1144 | 1144 |
BlockDef.wipe() |
1145 | 1145 |
NamedDataSource.wipe() |
... | ... | |
1210 | 1210 |
assert formdef.data_class().select()[0].data['1_display'] == 'XunY, XdeuxY' |
1211 | 1211 | |
1212 | 1212 | |
1213 |
def test_block_post_condition_on_2nd_page(pub, blocks_feature):
|
|
1213 |
def test_block_post_condition_on_2nd_page(pub): |
|
1214 | 1214 |
FormDef.wipe() |
1215 | 1215 |
BlockDef.wipe() |
1216 | 1216 | |
... | ... | |
1253 | 1253 | |
1254 | 1254 | |
1255 | 1255 |
@mock.patch('wcs.qommon.misc.urlopen') |
1256 |
def test_block_with_dynamic_item_field(mock_urlopen, pub, blocks_feature):
|
|
1256 |
def test_block_with_dynamic_item_field(mock_urlopen, pub): |
|
1257 | 1257 |
def data_source(url): |
1258 | 1258 |
url, query = url.split('?q=') |
1259 | 1259 |
payload = [] |
... | ... | |
1333 | 1333 |
assert resp.form['f2'].value == '1' |
1334 | 1334 | |
1335 | 1335 | |
1336 |
def test_block_used_in_later_prefill(pub, blocks_feature):
|
|
1336 |
def test_block_used_in_later_prefill(pub): |
|
1337 | 1337 |
FormDef.wipe() |
1338 | 1338 |
BlockDef.wipe() |
1339 | 1339 | |
... | ... | |
1375 | 1375 |
assert resp.form['f3'].value == '9' |
1376 | 1376 | |
1377 | 1377 | |
1378 |
def test_block_add_and_locked_field(pub, blocks_feature):
|
|
1378 |
def test_block_add_and_locked_field(pub): |
|
1379 | 1379 |
FormDef.wipe() |
1380 | 1380 |
BlockDef.wipe() |
1381 | 1381 | |
... | ... | |
1409 | 1409 |
resp = resp.form.submit('submit') # -> submit |
1410 | 1410 | |
1411 | 1411 | |
1412 |
def test_block_subfields_display_locations(pub, blocks_feature):
|
|
1412 |
def test_block_subfields_display_locations(pub): |
|
1413 | 1413 |
FormDef.wipe() |
1414 | 1414 |
BlockDef.wipe() |
1415 | 1415 |
tests/test_formdata.py | ||
---|---|---|
3016 | 3016 |
assert variables['form'].parent is not None |
3017 | 3017 | |
3018 | 3018 | |
3019 |
def test_block_variables(pub, blocks_feature):
|
|
3019 |
def test_block_variables(pub): |
|
3020 | 3020 |
BlockDef.wipe() |
3021 | 3021 |
FormDef.wipe() |
3022 | 3022 |
tests/test_snapshots.py | ||
---|---|---|
257 | 257 |
assert 'Can not restore snapshot (Unknown datasources [unknown])' in resp |
258 | 258 | |
259 | 259 | |
260 |
def test_block_snapshot_browse(pub, blocks_feature):
|
|
260 |
def test_block_snapshot_browse(pub): |
|
261 | 261 |
create_superuser(pub) |
262 | 262 |
create_role(pub) |
263 | 263 |
tests/workflow/test_all.py | ||
---|---|---|
5639 | 5639 |
formdata.store() |
5640 | 5640 | |
5641 | 5641 | |
5642 |
def test_set_backoffice_field_block(two_pubs, blocks_feature):
|
|
5642 |
def test_set_backoffice_field_block(two_pubs): |
|
5643 | 5643 |
BlockDef.wipe() |
5644 | 5644 |
Workflow.wipe() |
5645 | 5645 |
FormDef.wipe() |
wcs/admin/forms.py | ||
---|---|---|
1792 | 1792 |
r += htmltext('<span class="actions">') |
1793 | 1793 |
if is_global_accessible('forms'): |
1794 | 1794 |
r += htmltext('<a href="data-sources/">%s</a>') % _('Data sources') |
1795 |
if get_publisher().has_site_option('fields-blocks'): |
|
1796 |
r += htmltext('<a href="blocks/">%s</a>') % _('Fields blocks') |
|
1795 |
r += htmltext('<a href="blocks/">%s</a>') % _('Fields blocks') |
|
1797 | 1796 |
if get_publisher().get_backoffice_root().is_accessible('categories'): |
1798 | 1797 |
r += htmltext('<a href="categories/">%s</a>') % _('Categories') |
1799 | 1798 |
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import') |
wcs/admin/settings.py | ||
---|---|---|
988 | 988 |
if StudioDirectory.is_visible(): |
989 | 989 |
form.add(CheckboxWidget, 'carddefs', title=_('Card Models'), value=True) |
990 | 990 |
form.add(CheckboxWidget, 'workflows', title=_('Workflows'), value=True) |
991 |
if get_publisher().has_site_option('fields-blocks'): |
|
992 |
form.add(CheckboxWidget, 'blockdefs', title=_('Fields Blocks'), value=True) |
|
991 |
form.add(CheckboxWidget, 'blockdefs', title=_('Fields Blocks'), value=True) |
|
993 | 992 |
if not get_cfg('sp', {}).get('idp-manage-roles'): |
994 | 993 |
form.add(CheckboxWidget, 'roles', title=_('Roles'), value=True) |
995 | 994 |
form.add(CheckboxWidget, 'categories', title=_('Categories'), value=True) |
wcs/backoffice/cards.py | ||
---|---|---|
254 | 254 |
r += htmltext('<span class="actions">') |
255 | 255 |
if get_publisher().get_backoffice_root().is_global_accessible('forms'): |
256 | 256 |
r += htmltext('<a href="../forms/data-sources/">%s</a>') % _('Data sources') |
257 |
if get_publisher().has_site_option('fields-blocks'): |
|
258 |
r += htmltext('<a href="../forms/blocks/">%s</a>') % _('Fields blocks') |
|
257 |
r += htmltext('<a href="../forms/blocks/">%s</a>') % _('Fields blocks') |
|
259 | 258 |
if get_publisher().get_backoffice_root().is_global_accessible('cards'): |
260 | 259 |
r += htmltext('<a href="categories/">%s</a>') % _('Categories') |
261 | 260 |
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import') |
wcs/fields.py | ||
---|---|---|
3507 | 3507 |
# add computed field in its own "section" |
3508 | 3508 |
options.extend([('', '—', ''), (ComputedField.key, ComputedField.description, ComputedField.key)]) |
3509 | 3509 | |
3510 |
if get_publisher().has_site_option('fields-blocks') and ( |
|
3511 |
not blacklisted_types or 'blocks' not in blacklisted_types |
|
3512 |
): |
|
3510 |
if not blacklisted_types or 'blocks' not in blacklisted_types: |
|
3513 | 3511 |
position = len(options) |
3514 | 3512 |
for blockdef in BlockDef.select(order_by='name'): |
3515 | 3513 |
options.append(('block:%s' % blockdef.slug, blockdef.name, 'block:%s' % blockdef.slug)) |
wcs/qommon/publisher.py | ||
---|---|---|
393 | 393 |
'studio': True, |
394 | 394 |
'mail-templates': True, |
395 | 395 |
'external-workflow': True, |
396 |
'fields-blocks': True, |
|
397 | 396 |
'complex-data': True, |
398 | 397 |
} |
399 | 398 |
if self.site_options is None: |
400 |
- |