[Erp5-report] r24864 - /erp5/trunk/products/ERP5/tests/testTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 11 15:19:04 CET 2008


Author: jerome
Date: Thu Dec 11 15:19:02 2008
New Revision: 24864

URL: http://svn.erp5.org?rev=24864&view=rev
Log:
test that template document are not indexable, especially if you create more
than one template from the same document

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

Modified: erp5/trunk/products/ERP5/tests/testTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testTemplate.py?rev=24864&r1=24863&r2=24864&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testTemplate.py [utf8] Thu Dec 11 15:19:02 2008
@@ -138,6 +138,43 @@
     self.assertEqual(len(preference.objectIds()), 1)
 
 
+  def test_TemplateNotIndexable(self):
+    # template documents are not indexable
+    self.login('yusei')
+    preference = self.portal.portal_preferences.newContent(portal_type='Preference')
+    preference.priority = Priority.USER
+    preference.enable()
+
+    get_transaction().commit()
+    self.tic()
+
+    document = self.portal.foo_module.newContent(portal_type='Foo')
+    document.edit(title='My Foo 1')
+    document.newContent(portal_type='Foo Line')
+
+    get_transaction().commit()
+    self.tic()
+
+    document.Base_makeTemplateFromDocument(form_id=None)
+    get_transaction().commit()
+    self.tic()
+    self.assertTrue(document.isIndexable)
+    self.assertEqual(len(preference.objectIds()), 1)
+    for template in preference.objectValues():
+      self.assertFalse(template.isIndexable)
+
+    # and this is still true if you create two templates from the same document
+    # #929
+    document.Base_makeTemplateFromDocument(form_id=None)
+    get_transaction().commit()
+    self.tic()
+
+    self.assertTrue(document.isIndexable)
+    self.assertEqual(len(preference.objectIds()), 2)
+    for template in preference.objectValues():
+      self.assertFalse(template.isIndexable)
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestTemplate))




More information about the Erp5-report mailing list