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
This commit is contained in:
parent
f79705fa5e
commit
71e5a74898
|
@ -50,6 +50,16 @@ def teardown_module(module):
|
||||||
clean_temporary_pub()
|
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):
|
def test_forms(pub):
|
||||||
create_superuser(pub)
|
create_superuser(pub)
|
||||||
pub.role_class.wipe()
|
pub.role_class.wipe()
|
||||||
|
@ -114,21 +124,13 @@ def assert_option_display(resp, label, value):
|
||||||
assert '</li>' not in option_line
|
assert '</li>' not in option_line
|
||||||
|
|
||||||
|
|
||||||
def test_forms_edit(pub):
|
def test_forms_edit_confirmation_page(pub, formdef):
|
||||||
create_superuser(pub)
|
create_superuser(pub)
|
||||||
create_role(pub)
|
create_role(pub)
|
||||||
|
|
||||||
FormDef.wipe()
|
|
||||||
formdef = FormDef()
|
|
||||||
formdef.name = 'form title'
|
|
||||||
formdef.fields = []
|
|
||||||
formdef.store()
|
|
||||||
|
|
||||||
app = login(get_app(pub))
|
app = login(get_app(pub))
|
||||||
resp = app.get('/backoffice/forms/1/')
|
resp = app.get('/backoffice/forms/1/')
|
||||||
|
|
||||||
# try changing an option
|
|
||||||
|
|
||||||
# confirmation page
|
# confirmation page
|
||||||
assert_option_display(resp, 'Confirmation Page', 'Enabled')
|
assert_option_display(resp, 'Confirmation Page', 'Enabled')
|
||||||
resp = resp.click('Confirmation Page')
|
resp = resp.click('Confirmation Page')
|
||||||
|
@ -150,6 +152,14 @@ def test_forms_edit(pub):
|
||||||
assert_option_display(resp, 'Confirmation Page', 'Disabled')
|
assert_option_display(resp, 'Confirmation Page', 'Disabled')
|
||||||
assert FormDef.get(1).confirmation is False
|
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
|
# Limit to one form
|
||||||
assert_option_display(resp, 'Limit to one form', 'Disabled')
|
assert_option_display(resp, 'Limit to one form', 'Disabled')
|
||||||
resp = resp.click('Limit to one form')
|
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_option_display(resp, 'Limit to one form', 'Enabled')
|
||||||
assert FormDef.get(1).only_allow_one is True
|
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
|
# Misc management
|
||||||
assert_option_display(resp, 'Management', 'Default')
|
assert_option_display(resp, 'Management', 'Default')
|
||||||
resp = resp.click('Management', href='options/management')
|
resp = resp.click('Management', href='options/management')
|
||||||
|
@ -172,6 +190,14 @@ def test_forms_edit(pub):
|
||||||
assert_option_display(resp, 'Management', 'Custom')
|
assert_option_display(resp, 'Management', 'Custom')
|
||||||
assert FormDef.get(1).include_download_all_button is True
|
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
|
# Tracking code
|
||||||
assert_option_display(resp, 'Tracking Code', 'Disabled')
|
assert_option_display(resp, 'Tracking Code', 'Disabled')
|
||||||
resp = resp.click('Tracking Code')
|
resp = resp.click('Tracking Code')
|
||||||
|
@ -195,6 +221,14 @@ def test_forms_edit(pub):
|
||||||
resp = resp.forms[0].submit().follow()
|
resp = resp.forms[0].submit().follow()
|
||||||
assert FormDef.get(1).drafts_lifespan == '5'
|
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
|
# CAPTCHA
|
||||||
assert_option_display(resp, 'CAPTCHA for anonymous users', 'Disabled')
|
assert_option_display(resp, 'CAPTCHA for anonymous users', 'Disabled')
|
||||||
resp = resp.click('CAPTCHA for anonymous users')
|
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_option_display(resp, 'CAPTCHA for anonymous users', 'Enabled')
|
||||||
assert FormDef.get(1).has_captcha is True
|
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
|
# Appearance
|
||||||
assert_option_display(resp, 'Appearance', 'Standard')
|
assert_option_display(resp, 'Appearance', 'Standard')
|
||||||
resp = resp.click('Appearance')
|
resp = resp.click('Appearance')
|
||||||
|
@ -217,6 +259,14 @@ def test_forms_edit(pub):
|
||||||
assert_option_display(resp, 'Appearance', 'foobar')
|
assert_option_display(resp, 'Appearance', 'foobar')
|
||||||
assert FormDef.get(1).appearance_keywords == '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
|
# Publication
|
||||||
assert_option_display(resp, 'Online Status', 'Active')
|
assert_option_display(resp, 'Online Status', 'Active')
|
||||||
resp = resp.click('Online Status')
|
resp = resp.click('Online Status')
|
||||||
|
@ -246,6 +296,14 @@ def test_forms_edit(pub):
|
||||||
resp = resp.follow()
|
resp = resp.follow()
|
||||||
assert_option_display(resp, 'Online Status', 'Inactive by date')
|
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
|
# enable geolocation
|
||||||
resp = resp.click('Geolocation')
|
resp = resp.click('Geolocation')
|
||||||
resp.forms[0]['geoloc_label'] = 'Foobar'
|
resp.forms[0]['geoloc_label'] = 'Foobar'
|
||||||
|
|
Loading…
Reference in New Issue