From 3c7bd2bf7835b1249ccf8c9cb33e0c6e622480f4 Mon Sep 17 00:00:00 2001 From: Philip Bauer Date: Mon, 21 Sep 2015 10:48:56 +0200 Subject: [PATCH] fix at-tests --- CHANGES.rst | 3 ++- .../tests/testCMFPlacefulWorkflow.py | 23 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 164cca6..3467e61 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 1.6.4 (unreleased) ------------------ -- Nothing changed yet. +- Fix test after new default dependecy-strategy for GenericSetup. + [pbauer] 1.6.3 (2015-09-20) diff --git a/Products/CMFPlacefulWorkflow/tests/testCMFPlacefulWorkflow.py b/Products/CMFPlacefulWorkflow/tests/testCMFPlacefulWorkflow.py index d7c06bf..f08688b 100644 --- a/Products/CMFPlacefulWorkflow/tests/testCMFPlacefulWorkflow.py +++ b/Products/CMFPlacefulWorkflow/tests/testCMFPlacefulWorkflow.py @@ -89,11 +89,32 @@ def test_marker_applied_and_unapplied(self): Check that the IPlacefulMarker is applied to the workflow tool by the install, and removed by the uninstall. """ + try: + # GenericSetup 1.7.8 and higher + from Products.GenericSetup.tool import DEPENDENCY_STRATEGY_REAPPLY + DEPENDENCY_STRATEGY_REAPPLY # pyflakes + except ImportError: + DEPENDENCY_STRATEGY_REAPPLY = None + self.failUnless(IPlacefulMarker.providedBy(self.workflow)) self.loginAsPortalOwner() self.qi.uninstallProducts(['CMFPlacefulWorkflow']) self.failIf(IPlacefulMarker.providedBy(self.workflow)) - self.qi.installProduct('CMFPlacefulWorkflow') + + profile_id = 'Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow' + if DEPENDENCY_STRATEGY_REAPPLY is None: + # Older GenericSetup. Reapply is the default. No alternative + # strategy can be given. + self.qi.installProduct('CMFPlacefulWorkflow') + # setup_tool.runAllImportStepsFromProfile('profile-%s' % profile_id) + else: + # Newer GenericSetup. Upgrade is the default. We want to + # reapply. + setup_tool = self.portal.portal_setup + setup_tool.runAllImportStepsFromProfile( + 'profile-%s' % profile_id, + dependency_strategy=DEPENDENCY_STRATEGY_REAPPLY) + self.failUnless(IPlacefulMarker.providedBy(self.workflow)) def test_reinstall(self):