Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure tests work with restapi installed #195

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog

.. towncrier release notes start


4.1.6 (2020-11-17)
------------------

Expand Down
1 change: 1 addition & 0 deletions news/195.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix test for restapi compatibility
1 change: 1 addition & 0 deletions src/plone/app/theming/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<include package="plone.resourceeditor" />
<include package="plone.transformchain" />
<include package="plone.app.registry" />
<include package="plone.restapi" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some doubt about this line.
Is this change important only for the tests?
In that case I would handle that in the test layer.

And probably add plone.restapi as an extra requirement in the setup.py for the [test] feature.

<include package="diazo" file="diazo-debug.zcml" />

<include package=".browser" />
Expand Down
4 changes: 4 additions & 0 deletions src/plone/app/theming/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from plone.app.testing.layers import FunctionalTesting
from plone.app.testing.layers import IntegrationTesting
from zope.configuration import xmlconfig
from plone.testing import z2


class Theming(PloneSandboxLayer):
Expand All @@ -18,6 +19,7 @@ def setUpZope(self, app, configurationContext):
plone.app.theming.tests,
context=configurationContext
)
z2.installProduct(app, "plone.restapi")

# Run the startup hook
from plone.app.theming.plugins.hooks import onStartup
Expand All @@ -26,6 +28,8 @@ def setUpZope(self, app, configurationContext):
def setUpPloneSite(self, portal):
# install into the Plone site
applyProfile(portal, 'plone.app.theming:default')
#if portal.portal_setup.profileExists('plone.restapi:default'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a leftover?

applyProfile(portal, 'plone.restapi:default')


THEMING_FIXTURE = Theming()
Expand Down
1 change: 1 addition & 0 deletions src/plone/app/theming/tests/test_controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def test_upload_theme_file_nodata(self):
self.portal.absolute_url() + '/portal_resources/themeFileUpload',
'',
)
# There is a bug in restapi that causes 404 instead - https://github.com/plone/plone.rest/issues/59
self.assertIn('Status: 200', str(self.browser.headers))
self.assertIn(
'{"failure": "error"}',
Expand Down