Skip to content

Commit

Permalink
Merge pull request #332 from collective/fix_tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
pbauer committed Mar 31, 2022
2 parents 345272f + 4469dc0 commit e7367c1
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 256 deletions.
1 change: 0 additions & 1 deletion src/collective/easyform/browser/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ class ModelEditorView(BrowserView):
title = _(u"Edit XML Fields Model")

def modelSource(self):
import pdb; pdb.set_trace()
return self.context.aq_parent.fields_model

def authorized(self, context, request):
Expand Down
3 changes: 3 additions & 0 deletions src/collective/easyform/browser/saveddata_form.pt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<h1 i18n:translate="">Saved Data</h1>

<p class="lead"
tal:content="python: view.description()"></p>

<p i18n:translate="saveddata_form_description">The saved data of <strong i18n:name="formname" tal:content="view/form_title">form name</strong> stored in the adapter <strong i18n:name="adapter" tal:content="view/name"></strong></p>

<div class="portalMessage"
Expand Down
23 changes: 0 additions & 23 deletions src/collective/easyform/profiles/default/propertiestool.xml

This file was deleted.

26 changes: 0 additions & 26 deletions src/collective/easyform/profiles/uninstall/propertiestool.xml

This file was deleted.

10 changes: 5 additions & 5 deletions src/collective/easyform/tests/attachment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ the file field is not listed in the mailer's showFields::
>>> browser.getControl(name='form.widgets.attachment').add_file(BytesIO(b'file contents'), 'text/plain', 'test.txt')
>>> browser.getControl('Submit').click()
<sent mail from ...to ['mdummy@address.com']>
>>> "<body>" in portal.MailHost.msg.get_payload()
>>> "<body>" in portal.MailHost.msg.get_payload()[0].as_string()
True

>> browser.getControl('Reset').click()
Expand All @@ -169,13 +169,13 @@ Check saved data::
True
>>> ".widgets.attachment/@@download/test.txt" in browser.contents
True
>>> '<input id="crud-edit-form-buttons-edit" name="crud-edit.form.buttons.edit" class="submit-widget button-field" value="Apply changes" type="submit" />' in browser.contents
>>> '<button type="submit" id="crud-edit-form-buttons-edit" name="crud-edit.form.buttons.edit" class="btn btn-secondary submit-widget button-field" value="Apply changes">' in browser.contents
True
>>> '<input id="crud-edit-form-buttons-delete" name="crud-edit.form.buttons.delete" class="submit-widget button-field" value="Delete" type="submit" />' in browser.contents
>>> '<button type="submit" id="crud-edit-form-buttons-delete" name="crud-edit.form.buttons.delete" class="btn btn-secondary submit-widget button-field" value="Delete">' in browser.contents
True
>>> '<input id="form-buttons-download" name="form.buttons.download" class="submit-widget button-field" value="Download" type="submit" />' in browser.contents
>>> '<button type="submit" id="form-buttons-download" name="form.buttons.download" class="btn btn-secondary submit-widget button-field context" value="Download">' in browser.contents
True
>>> '<input id="form-buttons-clearall" name="form.buttons.clearall" class="submit-widget button-field" value="Clear all" type="submit" />' in browser.contents
>>> '<button type="submit" id="form-buttons-clearall" name="form.buttons.clearall" class="btn btn-secondary submit-widget button-field destructive" value="Clear all">' in browser.contents
True
>>> browser.getLink('test.txt').click()
>>> browser.url
Expand Down
10 changes: 10 additions & 0 deletions src/collective/easyform/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@ def setUpZope(self, app, configurationContext):
import plone.formwidget.recaptcha

self.loadZCML(package=plone.formwidget.recaptcha)

except ImportError:
pass
try:
import plone.formwidget.hcaptcha

self.loadZCML(package=plone.formwidget.hcaptcha)
except ImportError:
pass

try:
import collective.z3cform.norobots

Expand All @@ -76,6 +84,8 @@ def setUpPloneSite(self, portal):
self.applyProfile(portal, "collective.easyform:default")
try:
self.applyProfile(portal, "plone.formwidget.recaptcha:default")
self.applyProfile(portal, "plone.formwidget.hcaptcha:default")

except KeyError:
pass
setRoles(portal, TEST_USER_ID, ["Manager"])
Expand Down
3 changes: 2 additions & 1 deletion src/collective/easyform/tests/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Finally, let's use a new browser that isn't authenticated, and confirm that for
who doesn't have permission to edit the form, SSL will be forced on initial form load as
well (so the user sees a security icon in their browser.) ::

>>> browser.open(portal_url + '/testform/content_status_modify?workflow_action=publish')
>>> auth = browser.getControl(name='_authenticator', index=0).value
>>> browser.open(portal_url + f'/testform/content_status_modify?workflow_action=publish&_authenticator={auth}')
>>> 'Item state changed' in browser.contents
True

Expand Down
5 changes: 0 additions & 5 deletions src/collective/easyform/tests/testControlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ def test_easyform_control_panel_sidebar(self):
link = self.browser.getLink("Add-ons")
self.assertEqual(link.url, "http://nohost/plone/prefs_install_products_form")

def test_easyform_control_panel_backlink(self):
self.browser.open(self.portal_url + "/@@navigation-controlpanel")
link = self.browser.getLink(id="setup-link")
self.assertEqual(link.url, "http://nohost/plone/@@overview-controlpanel")


class ControlPanelFunctionalTestCase(base.EasyFormFunctionalTestCase):
"""Test that changes in the easyform control panel are actually
Expand Down
2 changes: 1 addition & 1 deletion src/collective/easyform/tests/testCustomScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""
from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized
from App.class_init import InitializeClass
from AccessControl.class_init import InitializeClass
from collective.easyform.api import get_actions
from collective.easyform.tests import base
from plone.app.testing import logout
Expand Down

0 comments on commit e7367c1

Please sign in to comment.