[Erp5-report] r41442 nicolas.dumazet - /erp5/trunk/products/ERP5/tests/testERP5Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Dec 15 09:34:37 CET 2010


Author: nicolas.dumazet
Date: Wed Dec 15 09:34:36 2010
New Revision: 41442

URL: http://svn.erp5.org?rev=41442&view=rev
Log:
fix test_ERP5Site_checkDataWithScript: use a method preserving id with spaces

Modified:
    erp5/trunk/products/ERP5/tests/testERP5Base.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Base.py?rev=41442&r1=41441&r2=41442&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Base.py [utf8] Wed Dec 15 09:34:36 2010
@@ -1366,9 +1366,15 @@ class TestERP5Base(ERP5TypeTestCase):
     self.assertEquals(DateTime().day(), assignment.getStopDate().day())
 
   def test_ERP5Site_checkDataWithScript(self):
+    # note the '/'.join(obj.getPhysicalPath()) idiom:
+
+    # it's basically a obj.absolute_url(relative=1) without escaping:
+    #  - getRelativeUrl() is not enough as it does not return a full
+    #    path for portal_categories.action_type for instance
+    #  - absolute_url escapes 'Foo Tool' into 'Foo%20Tool'
     test = 'test_ERP5Site_checkDataWithScript'
     createZODBPythonScript(self.getSkinsTool().custom, test, '',
-                           'return context.absolute_url(relative=1),')
+                           'return "/".join(context.getPhysicalPath()),')
 
     organisation = self.getOrganisationModule() \
                        .newContent(portal_type='Organisation')
@@ -1388,7 +1394,7 @@ class TestERP5Base(ERP5TypeTestCase):
 
     self.assertEquals(len(relative_url_list), len(set(relative_url_list)))
     for obj in organisation, person, person.getDefaultEmailValue():
-      self.assertTrue(obj.absolute_url(relative=1) in relative_url_list)
+      self.assertTrue('/'.join(obj.getPhysicalPath()) in relative_url_list)
     for relative_url in relative_url_list:
       self.assertTrue('/' in relative_url)
       self.assertNotEquals(None, self.portal.unrestrictedTraverse(relative_url))



More information about the Erp5-report mailing list