Commit b35ee2f8 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_core_test: Actually check catalog content when testing indexation.

Checking activity presence/absence is not enough: it risks both false
negatives and false positives. Instead, manually poison the catalog's
content and check which value we retrieve after executing spawned
activities (if any).
parent ed2f2376
Pipeline #19779 failed with stage
in 0 seconds
......@@ -441,13 +441,30 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
checkRelationUnset(self)
# Test _setRegion doesn't reindex the object.
person_object._setRegion(category_id)
def getTitleFromCatalog():
row, = self.portal.portal_catalog(
select_list=['title'],
uid=person_object.getUid(),
)
return row.title
modified_title = getTitleFromCatalog() + '_not_reindexed'
catalog_connection = self.getSQLConnection()()
catalog_connection.query(
'UPDATE catalog SET title=%s WHERE uid=%i' % (
catalog_connection.string_literal(modified_title),
person_object.getUid(),
),
)
self.commit()
self.assertFalse(person_object.hasActivity())
# sanity check
self.assertEqual(getTitleFromCatalog(), modified_title)
person_object._setRegion(category_id)
self.tic()
self.assertEqual(getTitleFromCatalog(), modified_title)
person_object.setRegion(None)
self.commit()
self.assertTrue(person_object.hasActivity())
self.tic()
self.assertNotEqual(getTitleFromCatalog(), modified_title)
# category tool, base categories, properties
# are likely to be handled specifically for accessor generation,
......
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