From 644ea989b689d03e44b153bfbc67a6895e9d4b0a Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Thu, 25 Jan 2018 15:56:48 +0900
Subject: [PATCH] testRelationField: Test actual indexation, not only activity
 presence.

This avoids relying on implementation details by only relying on regular
API. This test should now be more robust in face of implementation changes.
---
 .../portal_components/test.erp5.testRelationField.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_ui_test/TestTemplateItem/portal_components/test.erp5.testRelationField.py b/bt5/erp5_ui_test/TestTemplateItem/portal_components/test.erp5.testRelationField.py
index 64e820596c..d1b4e6f305 100644
--- a/bt5/erp5_ui_test/TestTemplateItem/portal_components/test.erp5.testRelationField.py
+++ b/bt5/erp5_ui_test/TestTemplateItem/portal_components/test.erp5.testRelationField.py
@@ -57,8 +57,12 @@ class TestMultiRelationField(ERP5TypeTestCase):
                  ['Category'], [('Category', 'Category')], 'title', '',
                  [([category.getUid()], category.getUid(), category.getId(),
                    None, 'subfield_field_my_foo_category_title_item')], '')
-    self.assertFalse(foo_object.hasActivity(method_id="recursiveImmediateReindexObject"))
+    foo_path = foo_object.getPath()
+    foo_uid = foo_object.getUid()
+    self.assertEqual([x.path for x in self.portal.portal_catalog(uid=foo_uid)], [foo_path])
+    foo_object.unindexObject()
+    self.tic()
+    self.assertEqual([x.path for x in self.portal.portal_catalog(uid=foo_uid)], [])
     editor.edit(foo_object)
-    self.commit()
-    self.assertTrue(foo_object.hasActivity(method_id="recursiveImmediateReindexObject"))
-
+    self.tic()
+    self.assertEqual([x.path for x in self.portal.portal_catalog(uid=foo_uid)], [foo_path])
-- 
2.30.9