Commit 3700e8e1 authored by Jérome Perrin's avatar Jérome Perrin

fixup! core: index component reference & text content in full text

adjust tests now that the test component itself is found by catalog.
parent 791f2fc3
......@@ -795,13 +795,15 @@ class TestDocument(TestDocumentMixin):
title='Super nova organisation')
self.tic()
test_document_set = {document_1, document_2, document_3, person, web_page, organisation}
def getAdvancedSearchTextResultList(searchable_text, portal_type=None,src__=0):
kw = {'full_text': searchable_text}
if portal_type is not None:
kw['portal_type'] = portal_type
if src__==1:
print portal.portal_catalog(src__=src__,**kw)
return [x.getObject() for x in portal.portal_catalog(**kw)]
result_list = [x.getObject() for x in portal.portal_catalog(**kw)]
return [x for x in result_list if x in test_document_set]
# full text search
self.assertSameSet([document_1], \
......
......@@ -1408,7 +1408,13 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
@changeSkin('Hal')
def test_getHateoas_query_param(self):
fake_request = do_fake_request("GET")
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas(REQUEST=fake_request, mode="search", query="ANIMPOSSIBLECOUSCOUSVALUEFOOTOFINDINDATA")
# we want a query that will never match any document, but if we have it as a string literal in
# the test, because the test code is also a document, it would be returned by the query, so we
# build a query a bit dynamically
query = "ANIMPOSSIBLECOUSCOUSVALUE" + "FOOTOFINDINDATA"
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas(REQUEST=fake_request, mode="search", query=query)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
......@@ -1418,7 +1424,7 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_debug'], "search")
self.assertEqual(result_dict['_limit'], 10)
self.assertEqual(result_dict['_query'], "ANIMPOSSIBLECOUSCOUSVALUEFOOTOFINDINDATA")
self.assertEqual(result_dict['_query'], query)
self.assertEqual(result_dict['_local_roles'], None)
self.assertEqual(result_dict['_select_list'], [])
......
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