Skip to content

Commit

Permalink
fix tests and deprecation-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer authored and thet committed Mar 23, 2022
1 parent 4dc69d1 commit 53f53b7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions plone/app/dexterity/behaviors/tests/test_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from plone.app.dexterity.testing import DEXTERITY_FUNCTIONAL_TESTING
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.testing import z2
from plone.testing.zope import Browser

import transaction
import unittest
Expand All @@ -21,7 +21,7 @@ def setUp(self):
transaction.commit()

# prepare browser
self.browser = z2.Browser(self.layer['app'])
self.browser = Browser(self.layer['app'])
self.browser.addHeader(
'Authorization',
'Basic {0}:{1}'.format(SITE_OWNER_NAME, SITE_OWNER_PASSWORD, )
Expand Down
4 changes: 2 additions & 2 deletions plone/app/dexterity/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import PloneSandboxLayer
from plone.testing import z2
from plone.testing.zope import WSGI_SERVER_FIXTURE


class DexterityFixture(PloneSandboxLayer):
Expand All @@ -29,6 +29,6 @@ def setUpPloneSite(self, portal):
name='dexterity:Functional'
)
DEXTERITY_ACCEPTANCE_TESTING = FunctionalTesting(
bases=(DEXTERITY_FIXTURE, z2.ZSERVER_FIXTURE),
bases=(DEXTERITY_FIXTURE, WSGI_SERVER_FIXTURE),
name='dexterity:Acceptance'
)
2 changes: 1 addition & 1 deletion plone/app/dexterity/tests/discussion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Set up a test browser::
>>> from plone.app.testing import TEST_USER_ID, TEST_USER_NAME, TEST_USER_PASSWORD, setRoles
>>> setRoles(portal, TEST_USER_ID, ['Manager'])
>>> import transaction; transaction.commit()
>>> from plone.testing.z2 import Browser
>>> from plone.testing.zope import Browser
>>> browser = Browser(layer['app'])
>>> browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD,))

Expand Down
16 changes: 7 additions & 9 deletions plone/app/dexterity/tests/editing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To demonstrate this, we'll need a logged in test browser::
>>> portal = layer['portal']
>>> setRoles(portal, TEST_USER_ID, ['Manager'])
>>> import transaction; transaction.commit()
>>> from plone.testing.z2 import Browser
>>> from plone.testing.zope import Browser
>>> browser = Browser(layer['app'])
>>> browser.handleErrors = False
>>> browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD,))
Expand Down Expand Up @@ -155,11 +155,8 @@ still test the Zope side.

Get some tools::

>>> try:
... from html import escape
... except ImportError:
... from cgi import escape
>>> from six.moves.urllib.parse import quote_plus
>>> from html import escape
>>> from urllib.parse import quote_plus

We should be able to navigate to the modeleditor view by clicking a
button on the field list form::
Expand All @@ -173,15 +170,16 @@ Go there and find the XML model source in a textarea, ready to be edited
(with JavaScript enabled, this should show pat-code-editor instead of the textarea)::

>>> browser.open('http://nohost/plone/dexterity-types/plonista/@@modeleditor')
>>> '<textarea...name="source">' in browser.contents
>>> '<textarea name="source"' in browser.contents
True

>>> '&lt;schema&gt;' in browser.contents
>>> '&amp;lt;schema&amp;gt;' in browser.contents
True

>>> model_source = portal.portal_types.plonista.model_source
>>> escaped_model_source = escape(model_source, quote=False)
>>> escaped_model_source in browser.contents
>>> again_escaped_model_source = escape(escaped_model_source, quote=False)
>>> again_escaped_model_source in browser.contents
True

There should be an authenticator in the `save` form::
Expand Down
2 changes: 1 addition & 1 deletion plone/app/dexterity/tests/test_constrains.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.app.testing import TEST_USER_ID
from plone.dexterity.fti import DexterityFTI
from plone.testing.z2 import Browser
from plone.testing.zope import Browser
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.interfaces.constrains import ISelectableConstrainTypes
from zope.interface.exceptions import Invalid
Expand Down

0 comments on commit 53f53b7

Please sign in to comment.