-
Notifications
You must be signed in to change notification settings - Fork 54
Refactor test fixture to load Dexterity content types when available #799
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ | |
| from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE | ||
| from plone.app.testing import FunctionalTesting | ||
| from plone.app.testing import IntegrationTesting | ||
| from plone.app.testing import PLONE_FIXTURE | ||
| from plone.app.testing import PloneSandboxLayer | ||
| from plone.testing import z2 | ||
|
|
||
|
|
@@ -29,10 +28,11 @@ | |
| try: | ||
| pkg_resources.get_distribution('plone.app.contenttypes') | ||
| except pkg_resources.DistributionNotFound: | ||
| from plone.app.testing import PLONE_FIXTURE | ||
| DEXTERITY_ONLY = False | ||
| else: | ||
| # this environment variable is set in .travis.yml test matrix | ||
| DEXTERITY_ONLY = os.environ.get('DEXTERITY_ONLY') is not None | ||
| from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE as PLONE_FIXTURE | ||
| DEXTERITY_ONLY = True | ||
|
|
||
|
|
||
| # XXX: PFG tile is deprecated and will be removed in collective.cover 3 | ||
|
|
@@ -119,7 +119,7 @@ def generate_jpeg(width, height): | |
|
|
||
| # FIXME: workaround for https://github.com/plone/plone.app.testing/issues/39 | ||
| # Products.TinyMCE is used only in Plone 4 | ||
| if not IS_PLONE_5: | ||
| if not DEXTERITY_ONLY: | ||
| autoform = ('plone.autoform', {'loadZCML': True}) | ||
| tinymce = ('Products.TinyMCE', {'loadZCML': True}) | ||
| products = list(PLONE_FIXTURE.products) | ||
|
|
@@ -132,19 +132,11 @@ class Fixture(PloneSandboxLayer): | |
| defaultBases = (PLONE_FIXTURE,) | ||
|
|
||
| def setUpZope(self, app, configurationContext): | ||
| if IS_PLONE_5: | ||
| import plone.app.contenttypes | ||
| self.loadZCML(package=plone.app.contenttypes) | ||
| else: | ||
| if not IS_PLONE_5: | ||
| # needed by plone.app.linkintegrity under Plone 4.x | ||
| import plone.app.referenceablebehavior | ||
| self.loadZCML(package=plone.app.referenceablebehavior) | ||
|
|
||
| if DEXTERITY_ONLY: | ||
| import plone.app.contenttypes | ||
| self.loadZCML(package=plone.app.contenttypes) | ||
| z2.installProduct(app, 'Products.DateRecurringIndex') | ||
|
|
||
| if HAS_PFG: | ||
| import Products.PloneFormGen | ||
| self.loadZCML(package=Products.PloneFormGen) | ||
|
|
@@ -161,12 +153,6 @@ def setUpZope(self, app, configurationContext): | |
| manage_addVirtualHostMonster(app, 'virtual_hosting') | ||
|
|
||
| def setUpPloneSite(self, portal): | ||
| if IS_PLONE_5: | ||
| self.applyProfile(portal, 'plone.app.contenttypes:default') | ||
| else: | ||
| if DEXTERITY_ONLY: | ||
| self.applyProfile(portal, 'plone.app.contenttypes:default') | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You aren't applying the profile of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't need to; it's already applied above: - # this environment variable is set in .travis.yml test matrix
- DEXTERITY_ONLY = os.environ.get('DEXTERITY_ONLY') is not None
+ from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE as PLONE_FIXTURE
+ DEXTERITY_ONLY = True
``
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! But it's changing the portal's default workflow to simple_publication_workflow, which is causing permission errors. However, when we create a portal the workflow is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the problem may be in the tests or in the view permissions. |
||
| if HAS_PFG: | ||
| self.applyProfile(portal, 'Products.PloneFormGen:default') | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| [buildout] | ||
| test-eggs = | ||
| plone.app.contenttypes | ||
| plone.app.referenceablebehavior | ||
| Products.PloneFormGen | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workaround must be present in all test of Plone 4. Not only in those that don't have dexterity.
But I still think than plone/plone.app.testing#39 should be fixed. Please do a PR there to see what happens.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: this test don't have dexterity. So the workaround must be present in all test of Plone 4.