Changeset 3602 in products
- Timestamp:
- Oct 24, 2012 3:13:15 PM (12 years ago)
- Location:
- quintagroup.catalogupdater/trunk/quintagroup/catalogupdater
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.catalogupdater/trunk/quintagroup/catalogupdater/exportimport/tests/test_catalogupdate.py
r3142 r3602 37 37 <column value="spam" update="True"/> 38 38 </object> 39 """ % (PLONEFOUR and '<object name="old_plexicon" remove="True"/>' or \39 """ % (PLONEFOUR and '<object name="old_plexicon" remove="True"/>' or 40 40 '<object name="foo_vocabulary" remove="True"/>') 41 41 … … 91 91 message = self.getLastMessage() 92 92 self.assertEqual(message[-1], "foo_catalog:['eggs', 'spam']", 93 "Not updated columns in catalog")93 "Not updated columns in catalog") 94 94 95 95 … … 97 97 return unittest.TestSuite(( 98 98 unittest.makeSuite(CatalogUpdaterXMLAdapterTest), 99 99 )) 100 100 101 101 if __name__ == '__main__': -
quintagroup.catalogupdater/trunk/quintagroup/catalogupdater/tests.py
r3142 r3602 67 67 mydoc = self.catalog.unrestrictedSearchResults(id='my_doc')[0] 68 68 self.assertFalse(mydoc.test_column == 'my_doc', 69 "'test_column' metadata updated in catalog " \70 "before utility call: '%s'" % mydoc.test_column)69 "'test_column' metadata updated in catalog " 70 "before utility call: '%s'" % mydoc.test_column) 71 71 72 72 cu = queryUtility(ICatalogUpdater, name="catalog_updater") … … 75 75 mydoc = self.catalog.unrestrictedSearchResults(id='my_doc')[0] 76 76 self.assertTrue(mydoc.test_column == 'my_doc', 77 "'test_column' metadata has wrong metadata in catalog: " \78 "'%s'" % mydoc.test_column)77 "'test_column' metadata has wrong metadata in catalog:" 78 " '%s'" % mydoc.test_column) 79 79 80 80 def testOnlyPointedColumnUpdate(self): … … 96 96 mydoc = self.catalog.unrestrictedSearchResults(id='my_doc')[0] 97 97 self.assertTrue(mydoc.Title == 'My document', 98 "Other metadata updated: Title='%s'" % mydoc.Title)98 "Other metadata updated: Title='%s'" % mydoc.Title) 99 99 100 100 def testAllRecordsUpdate(self): … … 108 108 num_updated = sum([1 for b in allcat if b.test_column == b.id]) 109 109 110 self.assertTrue(num_updated == num_recs, "Only %d records updated, " \111 "must be - %d" % (num_updated, num_recs))110 self.assertTrue(num_updated == num_recs, "Only %d records updated, " 111 "must be - %d" % (num_updated, num_recs)) 112 112 113 113 def testTransaction(self): … … 133 133 cu.updateMetadata4All(self.catalog, 'test_column') 134 134 135 self.assertTrue(sp_commits == num_subcommits, "Wrong number of " \ 136 "transaction subcommits: actual:%d, must be: %d" % (sp_commits, 137 num_subcommits)) 135 self.assertTrue(sp_commits == num_subcommits, 136 "Wrong number of transaction subcommits: " 137 "actual:%d, must be: %d" % (sp_commits, 138 num_subcommits)) 138 139 139 140 transaction.savepoint = orig_trsp … … 143 144 return unittest.TestSuite([ 144 145 unittest.makeSuite(TestUtility), 145 146 ]) 146 147 147 148 if __name__ == '__main__': -
quintagroup.catalogupdater/trunk/quintagroup/catalogupdater/utility.py
r3142 r3602 41 41 42 42 if not type(cols) in AVAIL_COLTYPES: 43 raise TypeError("'columns' parameter must be one of the " \44 "following types: %s" % AVAIL_COLTYPES)43 raise TypeError("'columns' parameter must be one of the " 44 "following types: %s" % AVAIL_COLTYPES) 45 45 # Normalize columns 46 46 if type(cols) in types.StringTypes: … … 49 49 for col in cols: 50 50 if not col in _cat.schema: 51 raise AttributeError("'%s' - not presented column in " \51 raise AttributeError("'%s' - not presented column in " 52 52 "%s catalog " % (col, cat)) 53 53 … … 93 93 paths = _catalog.paths 94 94 getWrappedObject = (IS_NEW and self.getWrappedObjectNew 95 95 or self.getWrappedObjectOld) 96 96 # For subtransaction support 97 97 threshold = getattr(catalog, 'threshold', 10000)
Note: See TracChangeset
for help on using the changeset viewer.