From 68909be110985d28369bb99e2a39b3050f4c7f45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Mon, 20 Jun 2022 17:29:26 +0200
Subject: [PATCH] misc: apply new limits (#66421)

---
 tests/admin_pages/test_block.py | 8 ++++----
 tests/admin_pages/test_card.py  | 4 ++--
 tests/admin_pages/test_form.py  | 4 ++--
 wcs/admin/blocks.py             | 4 ++--
 wcs/admin/fields.py             | 2 +-
 wcs/admin/workflows.py          | 8 ++++----
 wcs/wf/form.py                  | 4 ++--
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/tests/admin_pages/test_block.py b/tests/admin_pages/test_block.py
index be0810360..26bbfe7d9 100644
--- a/tests/admin_pages/test_block.py
+++ b/tests/admin_pages/test_block.py
@@ -425,20 +425,20 @@ def test_block_edit_field_warnings(pub):
     assert 'more than 20 fields' not in resp.text
 
     blockdef.fields.extend(
-        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(10, 21)]
+        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(10, 31)]
     )
     blockdef.store()
     resp = app.get('/backoffice/forms/blocks/%s/' % blockdef.id)
-    assert 'more than 20 fields' not in resp.text
+    assert 'more than 30 fields' not in resp.text
     assert '<div id="new-field"><h3>New Field</h3>' in resp.text
     assert '>Duplicate<' in resp.text
 
     blockdef.fields.extend(
-        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(21, 31)]
+        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(21, 51)]
     )
     blockdef.store()
     resp = app.get('/backoffice/forms/blocks/%s/' % blockdef.id)
-    assert 'This block of fields contains 30 fields.' in resp.text
+    assert 'This block of fields contains 60 fields.' in resp.text
     assert '<div id="new-field"><h3>New Field</h3>' not in resp.text
     assert '>Duplicate<' not in resp.text
 
diff --git a/tests/admin_pages/test_card.py b/tests/admin_pages/test_card.py
index 9dbd3949f..35a9da1c7 100644
--- a/tests/admin_pages/test_card.py
+++ b/tests/admin_pages/test_card.py
@@ -914,11 +914,11 @@ def test_card_edit_field_warnings(pub):
     assert '>Duplicate<' in resp.text
 
     carddef.fields.extend(
-        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 310)]
+        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 410)]
     )
     carddef.store()
     resp = app.get('/backoffice/cards/%s/fields/' % carddef.id)
-    assert 'This card model contains 310 fields.' in resp.text
+    assert 'This card model contains 410 fields.' in resp.text
     assert 'first field should be of type "page"' in resp.text
     assert '<div id="new-field"><h3>New Field</h3>' not in resp.text
     assert '>Duplicate<' not in resp.text
diff --git a/tests/admin_pages/test_form.py b/tests/admin_pages/test_form.py
index 70c2b4127..0c8f23be4 100644
--- a/tests/admin_pages/test_form.py
+++ b/tests/admin_pages/test_form.py
@@ -2656,11 +2656,11 @@ def test_form_edit_field_warnings(pub):
     assert '>Duplicate<' in resp.text
 
     formdef.fields.extend(
-        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 310)]
+        [fields.StringField(id='%d' % i, label='field %d' % i, type='string') for i in range(210, 410)]
     )
     formdef.store()
     resp = app.get('/backoffice/forms/%s/fields/' % formdef.id)
-    assert 'This form contains 310 fields.' in resp.text
+    assert 'This form contains 410 fields.' in resp.text
     assert 'no new fields can be added.' in resp.text
     assert 'first field should be of type "page"' in resp.text
     assert '<div id="new-field"><h3>New Field</h3>' not in resp.text
diff --git a/wcs/admin/blocks.py b/wcs/admin/blocks.py
index 724715414..b8e9ba625 100644
--- a/wcs/admin/blocks.py
+++ b/wcs/admin/blocks.py
@@ -54,8 +54,8 @@ class BlockDirectory(FieldsDirectory):
 
     field_count_message = _('This block of fields contains %d fields.')
     field_over_count_message = _('This block of fields contains more than %d fields.')
-    fields_count_total_soft_limit = 20
-    fields_count_total_hard_limit = 30
+    fields_count_total_soft_limit = 30
+    fields_count_total_hard_limit = 60
 
     def __init__(self, section='forms', *args, **kwargs):
         if kwargs.pop('component', None):  # snapshot
diff --git a/wcs/admin/fields.py b/wcs/admin/fields.py
index f4a18d1e2..f0961b19a 100644
--- a/wcs/admin/fields.py
+++ b/wcs/admin/fields.py
@@ -296,7 +296,7 @@ class FieldsDirectory(Directory):
 
     support_import = True
     fields_count_total_soft_limit = 200
-    fields_count_total_hard_limit = 300
+    fields_count_total_hard_limit = 400
 
     def html_top(self, title, *args, **kwargs):
         html_top(self.section, title, *args, **kwargs)
diff --git a/wcs/admin/workflows.py b/wcs/admin/workflows.py
index a5f674764..787a6feb8 100644
--- a/wcs/admin/workflows.py
+++ b/wcs/admin/workflows.py
@@ -1056,8 +1056,8 @@ class WorkflowVariablesFieldsDirectory(FieldsDirectory):
 
     field_count_message = _('This workflow contains %d variables.')
     field_over_count_message = _('This workflow contains more than %d variables.')
-    fields_count_total_soft_limit = 20
-    fields_count_total_hard_limit = 30
+    fields_count_total_soft_limit = 40
+    fields_count_total_hard_limit = 80
 
     def index_top(self):
         r = TemplateIO(html=True)
@@ -1084,8 +1084,8 @@ class WorkflowBackofficeFieldsDirectory(FieldsDirectory):
     new_field_history_message = _('New backoffice field "%s"')
     field_count_message = _('This workflow contains %d backoffice fields.')
     field_over_count_message = _('This workflow contains more than %d backoffice fields.')
-    fields_count_total_soft_limit = 30
-    fields_count_total_hard_limit = 45
+    fields_count_total_soft_limit = 40
+    fields_count_total_hard_limit = 80
 
     def index_top(self):
         r = TemplateIO(html=True)
diff --git a/wcs/wf/form.py b/wcs/wf/form.py
index cd6f3c539..c7d06fbb9 100644
--- a/wcs/wf/form.py
+++ b/wcs/wf/form.py
@@ -104,8 +104,8 @@ class WorkflowFormFieldsDirectory(FieldsDirectory):
     support_import = False
     blacklisted_types = ['page', 'computed']
     field_def_page_class = WorkflowFormFieldDefPage
-    fields_count_total_soft_limit = 20
-    fields_count_total_hard_limit = 30
+    fields_count_total_soft_limit = 40
+    fields_count_total_hard_limit = 80
 
 
 class FormWorkflowStatusItem(WorkflowStatusItem):
-- 
2.36.1

