Changeset 2390 in products


Ignore:
Timestamp:
May 26, 2010 5:38:36 PM (9 years ago)
Author:
mylan
Message:

#205: Fix bug with upgrading only root level objects

Location:
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testUpgrade.py

    r2384 r2390  
    5151        # Prepare testing data 
    5252        catalog = self.portal.portal_catalog 
    53         doc = _createObjectByType('Document', self.portal, id='test_doc') 
    54         ICanonicalPath(doc).canonical_path = "/my_test_doc" 
     53        # Create container folder, update its canonical path 
     54        folder = _createObjectByType('Folder', self.portal, id='test_folder') 
     55        fldr_cpath = "/my_test_home_folder" 
     56        fldr_clink = self.portal.absolute_url() + fldr_cpath 
     57        ICanonicalPath(folder).canonical_path = fldr_cpath 
     58        # Create inner document, update its canonical_path 
     59        doc = _createObjectByType('Document', folder, id='test_doc') 
     60        doc_cpath = "/test_folder/my_test_doc" 
     61        doc_clink = self.portal.absolute_url() + doc_cpath 
     62        ICanonicalPath(doc).canonical_path = doc_cpath 
     63        # Add canonical_path column in catalog 
    5564        if not "canonical_path" in catalog._catalog.names: 
    5665            catalog.addColumn("canonical_path") 
     
    6271        self.assertEqual("canonical_link" in catalog._catalog.names, True) 
    6372        self.assertEqual("canonical_path" in catalog._catalog.names, False) 
    64         # canonical_link property refactored from canonical_path one for the object 
    65         migrated_link = self.portal.absolute_url() + '/my_test_doc' 
    66         self.assertNotEqual(ICanonicalPath(doc).canonical_path, "/my_test_doc") 
    67         self.assertEqual(ICanonicalLink(doc).canonical_link, migrated_link) 
     73        # canonical_link property refactored from canonical_path one for inner doc 
     74        self.assertNotEqual(ICanonicalPath(doc).canonical_path, doc_cpath) 
     75        self.assertEqual(ICanonicalLink(doc).canonical_link, doc_clink) 
     76        # canonical_link property refactored from canonical_path one for home folder 
     77        self.assertNotEqual(ICanonicalPath(folder).canonical_path, fldr_cpath) 
     78        self.assertEqual(ICanonicalLink(folder).canonical_link, fldr_clink) 
    6879        # canonical_link brain must contains updated canonical_link data 
    6980        brain = catalog(id="test_doc")[0] 
    70         self.assertEqual(brain.canonical_link, migrated_link) 
     81        self.assertEqual(brain.canonical_link, doc_clink) 
     82        brain = catalog(id="test_folder")[0] 
     83        self.assertEqual(brain.canonical_link, fldr_clink) 
    7184 
    7285    def testUpgradeCallOnReinstall(self): 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/upgrades.py

    r2386 r2390  
    2323                            portal, 
    2424                            obj_metatypes=','.join(obj_metatypes), 
    25                             apply_func=renameProperty 
     25                            apply_func=renameProperty, 
     26                            search_sub=1, 
    2627                            ) 
    2728    print convertor.getLogs() 
Note: See TracChangeset for help on using the changeset viewer.