Commit 450e9ff0 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add three tests to check isIndexable=0 behaviour.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29316 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3f529516
......@@ -1055,6 +1055,52 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEquals(1, len(self.getPortal().portal_catalog(
translated_portal_type='Person', title='translate_table_test')))
def test_NonIndexable(self):
"""check if a document is not indexed where we set isIndexable=0 in the same transaction of newContent().
"""
person = self.portal.person_module.newContent(portal_type='Person')
person.isIndexable = 0
transaction.commit()
self.tic()
self.assertFalse(person.isIndexable)
self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid())))
def test_NonIndexable2(self):
"""check if a document is not indexed where we call edit() and set isIndexable=0 after it is already indexed.
"""
person = self.portal.person_module.newContent(portal_type='Person')
transaction.commit()
self.tic()
self.assertTrue(person.isIndexable)
self.assertEquals(1, len(self.portal.portal_catalog(uid=person.getUid())))
# edit() will register a reindex activity because isIndexable is
# not yet False when edit() is called.
person.edit()
person.isIndexable = 0
transaction.commit()
self.tic()
self.assertFalse(person.isIndexable)
self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid())))
def test_NonIndexable3(self):
"""check if a document is not indexed where we set isIndexable=0 and call edit() after it is already indexed.
"""
person = self.portal.person_module.newContent(portal_type='Person')
transaction.commit()
self.tic()
self.assertTrue(person.isIndexable)
self.assertEquals(1, len(self.portal.portal_catalog(uid=person.getUid())))
# edit() will not register a reindex activity because isIndexable
# is already False when edit() is called.
person.isIndexable = 0
person.edit()
transaction.commit()
self.tic()
self.assertFalse(person.isIndexable)
self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid())))
class TestERP5PropertyManager(unittest.TestCase):
"""Tests for ERP5PropertyManager.
"""
......
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