[Erp5-report] r24905 - in /erp5/trunk/products/ERP5OOo/tests: ./ test_document/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Dec 16 14:31:53 CET 2008


Author: jerome
Date: Tue Dec 16 14:31:52 2008
New Revision: 24905

URL: http://svn.erp5.org?rev=24905&view=rev
Log:
test that the script to import categories from a spreadsheet does not silently
ignore duplicate IDs

Added:
    erp5/trunk/products/ERP5OOo/tests/test_document/import_region_category_duplicate_ids_same_level.sxc   (with props)
Modified:
    erp5/trunk/products/ERP5OOo/tests/testOOoImport.py

Modified: erp5/trunk/products/ERP5OOo/tests/testOOoImport.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testOOoImport.py?rev=24905&r1=24904&r2=24905&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testOOoImport.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testOOoImport.py [utf8] Tue Dec 16 14:31:52 2008
@@ -304,6 +304,20 @@
     self.assertEquals(['france'], list(region.europe.france.europe.objectIds()))
     self.assertEquals([], list(region.europe.france.europe.france.objectIds()))
 
+  def test_CategoryTool_importCategoryFile_DuplicateIdsAtSameLevel(self):
+    # tests CategoryTool_importCategoryFile when a document contain same
+    # categories ID at the same level, in that case, a ValueError is raised
+    import_file = makeFileUpload(
+        'import_region_category_duplicate_ids_same_level.sxc')
+    try:
+      self.portal.portal_categories.CategoryTool_importCategoryFile(
+             import_file=import_file)
+    except ValueError, error:
+      # 'france' is the duplicate ID in this spreadsheet
+      self.assertTrue('france' in str(error), str(error))
+    else:
+      self.fail('ValueError not raised')
+
   # simple OOoParser tests
   def test_getSpreadSheetMapping(self):
     parser = OOoParser()

Added: erp5/trunk/products/ERP5OOo/tests/test_document/import_region_category_duplicate_ids_same_level.sxc
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/test_document/import_region_category_duplicate_ids_same_level.sxc?rev=24905&view=auto
==============================================================================
Binary file - no diff available.

Propchange: erp5/trunk/products/ERP5OOo/tests/test_document/import_region_category_duplicate_ids_same_level.sxc
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream




More information about the Erp5-report mailing list