From 71e5a7489811322bcbb20891f71e1c81d3454cfb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= <zebuline@entrouvert.com>
Date: Fri, 2 Apr 2021 16:27:18 +0200
Subject: [PATCH 18/18] misc: pylint fix astroid-error (#52630)

************* Module tests.admin_pages.test_form
tests/admin_pages/test_form.py:1: [F0002(astroid-error), ]
<class 'RecursionError'>: maximum recursion depth exceeded

split testcase, it seems to fix the error
---
 tests/admin_pages/test_form.py | 76 ++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 9 deletions(-)

diff --git a/tests/admin_pages/test_form.py b/tests/admin_pages/test_form.py
index 3b5b04c9..f3d4e6ed 100644
--- a/tests/admin_pages/test_form.py
+++ b/tests/admin_pages/test_form.py
@@ -50,6 +50,16 @@ def teardown_module(module):
     clean_temporary_pub()
 
 
+@pytest.fixture
+def formdef(pub):
+    FormDef.wipe()
+    formdef = FormDef()
+    formdef.name = 'form title'
+    formdef.fields = []
+    formdef.store()
+    return formdef
+
+
 def test_forms(pub):
     create_superuser(pub)
     pub.role_class.wipe()
@@ -114,21 +124,13 @@ def assert_option_display(resp, label, value):
     assert '</li>' not in option_line
 
 
-def test_forms_edit(pub):
+def test_forms_edit_confirmation_page(pub, formdef):
     create_superuser(pub)
     create_role(pub)
 
-    FormDef.wipe()
-    formdef = FormDef()
-    formdef.name = 'form title'
-    formdef.fields = []
-    formdef.store()
-
     app = login(get_app(pub))
     resp = app.get('/backoffice/forms/1/')
 
-    # try changing an option
-
     # confirmation page
     assert_option_display(resp, 'Confirmation Page', 'Enabled')
     resp = resp.click('Confirmation Page')
@@ -150,6 +152,14 @@ def test_forms_edit(pub):
     assert_option_display(resp, 'Confirmation Page', 'Disabled')
     assert FormDef.get(1).confirmation is False
 
+
+def test_forms_edit_limit_one_form(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # Limit to one form
     assert_option_display(resp, 'Limit to one form', 'Disabled')
     resp = resp.click('Limit to one form')
@@ -161,6 +171,14 @@ def test_forms_edit(pub):
     assert_option_display(resp, 'Limit to one form', 'Enabled')
     assert FormDef.get(1).only_allow_one is True
 
+
+def test_forms_edit_management(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # Misc management
     assert_option_display(resp, 'Management', 'Default')
     resp = resp.click('Management', href='options/management')
@@ -172,6 +190,14 @@ def test_forms_edit(pub):
     assert_option_display(resp, 'Management', 'Custom')
     assert FormDef.get(1).include_download_all_button is True
 
+
+def test_forms_edit_tracking_code(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # Tracking code
     assert_option_display(resp, 'Tracking Code', 'Disabled')
     resp = resp.click('Tracking Code')
@@ -195,6 +221,14 @@ def test_forms_edit(pub):
     resp = resp.forms[0].submit().follow()
     assert FormDef.get(1).drafts_lifespan == '5'
 
+
+def test_forms_edit_captcha(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # CAPTCHA
     assert_option_display(resp, 'CAPTCHA for anonymous users', 'Disabled')
     resp = resp.click('CAPTCHA for anonymous users')
@@ -206,6 +240,14 @@ def test_forms_edit(pub):
     assert_option_display(resp, 'CAPTCHA for anonymous users', 'Enabled')
     assert FormDef.get(1).has_captcha is True
 
+
+def test_forms_edit_appearance(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # Appearance
     assert_option_display(resp, 'Appearance', 'Standard')
     resp = resp.click('Appearance')
@@ -217,6 +259,14 @@ def test_forms_edit(pub):
     assert_option_display(resp, 'Appearance', 'foobar')
     assert FormDef.get(1).appearance_keywords == 'foobar'
 
+
+def test_forms_edit_publication(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # Publication
     assert_option_display(resp, 'Online Status', 'Active')
     resp = resp.click('Online Status')
@@ -246,6 +296,14 @@ def test_forms_edit(pub):
     resp = resp.follow()
     assert_option_display(resp, 'Online Status', 'Inactive by date')
 
+
+def test_forms_edit_geolocation(pub, formdef):
+    create_superuser(pub)
+    create_role(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/forms/1/')
+
     # enable geolocation
     resp = resp.click('Geolocation')
     resp.forms[0]['geoloc_label'] = 'Foobar'
-- 
2.30.2

