From 609f99c41b2a1fa1dfd3167a22e6ec8542fab949 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 11 Sep 2009 09:24:31 +0000
Subject: [PATCH] Test that values equal to reserved id are authorised for
 properties other than id

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28933 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/tests/testOOoImport.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/product/ERP5OOo/tests/testOOoImport.py b/product/ERP5OOo/tests/testOOoImport.py
index b3213b922c..67956d1b26 100644
--- a/product/ERP5OOo/tests/testOOoImport.py
+++ b/product/ERP5OOo/tests/testOOoImport.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 # -*- coding: utf-8 -*-
 # Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
@@ -931,6 +932,24 @@ class TestOOoImport(ERP5TypeTestCase):
     else:
       self.fail('ValueError not raised')
 
+  def test_Base_getCategoriesSpreadSheetMapping_Id_is_reserved_property_name(self):
+    # tests Base_getCategoriesSpreadSheetMapping reserved property name are only test for path column, not all.
+    import_file = makeFileUpload(
+        'import_region_category_with_reserved_id_in_title.sxc')
+    mapping = self.portal.portal_categories.Base_getCategoriesSpreadSheetMapping(
+             import_file=import_file)
+    self.assertTrue(isinstance(mapping, dict))
+    self.assertEquals(['region'], list(mapping.keys()))
+    region = mapping['region']
+    self.assertTrue(isinstance(region, list))
+    self.assertEquals(7, len(region))
+    # Check that category can have a reserved property as title
+    self.assertEquals(dict(codification='codification',
+                           description='codification',
+                           path='region/antartica',
+                           short_title='codification',
+                           title='codification'),
+                      region[6])
 
 def test_suite():
   suite = unittest.TestSuite()
-- 
2.30.9