Commit 5e4b5f19 authored by Jérome Perrin's avatar Jérome Perrin

test that template document are not indexable, especially if you create more

than one template from the same document


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24864 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e4dc454
......@@ -138,6 +138,43 @@ class TestTemplate(ERP5TypeTestCase):
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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment