def testSlotsMigration(self): # leftslots and rightslots have been class variables ones. Make sure # using old instances without these properties doesn't break. # New instances should have the properties new = InstalledProduct('new') self.failUnless(hasattr(new, 'leftslots')) self.failUnless(hasattr(new, 'rightslots')) # Now emulate an old instance old = InstalledProduct('old') del (old.leftslots) del (old.rightslots) # Make sure calling the API will give you no error but silently # add the property left = old.getLeftSlots() self.failUnless(left == []) self.failUnless(old.leftslots == []) right = old.getRightSlots() self.failUnless(right == []) self.failUnless(old.rightslots == []) slots = old.getSlots() self.failUnless(slots == [])
def _instala_pacote(qi, package): if package not in qi.objectIds(): ip = InstalledProduct(package) qi._setObject(package, ip) p = getattr(qi, package) p.update({}, locked=False, hidden=False, **{})
def test_upgrade_2003(self): qi = self.layer['portal'].portal_quickinstaller from Products.CMFQuickInstallerTool.InstalledProduct import InstalledProduct ip = InstalledProduct('foo') ip.utilities = [('zope.intid.interfaces.IIntIds', '')] qi._setObject('foo', ip) from plone.app.dexterity.upgrades.to2003 import fix_installed_products fix_installed_products(self.layer['portal']) self.assertEqual([], ip.utilities)
def notifyInstalled(self, p, locked=True, hidden=False, settings={}, **kw): """Marks a product that has been installed without QuickInstaller as installed """ if p not in self.objectIds(): ip = InstalledProduct(p) self._setObject(p, ip) p = getattr(self, p) p.update(settings, locked=locked, hidden=hidden, **kw)
def test_upgrade_2003(self): from plone.app.dexterity.upgrades.to2003 import fix_installed_products from Products.CMFCore.utils import getToolByName try: from Products.CMFQuickInstallerTool.InstalledProduct import \ InstalledProduct except ImportError: # nothing to test return qi = getToolByName(self.layer['portal'], 'portal_quickinstaller', None) if qi is None: # nothing to test return ip = InstalledProduct('foo') ip.utilities = [('zope.intid.interfaces.IIntIds', '')] qi._setObject('foo', ip) fix_installed_products(self.layer['portal']) self.assertEqual([], ip.utilities)