Commit 7217aef9 authored by Jérome Perrin's avatar Jérome Perrin

update test_ignore_empty_string and test_ignore_empty_string_related_key to use

description instead of title, because title is no longer empty by default.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20187 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 07c65b2e
...@@ -2080,36 +2080,36 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -2080,36 +2080,36 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
def test_ignore_empty_string(self, quiet=quiet, run=run_all_test): def test_ignore_empty_string(self, quiet=quiet, run=run_all_test):
if not run: return if not run: return
# ERP5Catalog ignore empty strings by default # ERP5Catalog ignore empty strings by default
doc_with_title = self._makeOrganisation(title='X') doc_with_description = self._makeOrganisation(description='X')
doc_with_empty_title = self._makeOrganisation(title='') doc_with_empty_description = self._makeOrganisation(description='')
ctool = self.getCatalogTool() ctool = self.getCatalogTool()
def searchResults(**kw): def searchResults(**kw):
kw['portal_type'] = 'Organisation' kw['portal_type'] = 'Organisation'
return set([x.getObject() for x in ctool.searchResults(**kw)]) return set([x.getObject() for x in ctool.searchResults(**kw)])
# title='' is ignored # description='' is ignored
self.assertEquals(set([doc_with_empty_title, doc_with_title]), self.assertEquals(set([doc_with_empty_description, doc_with_description]),
searchResults(title='')) searchResults(description=''))
# unless we exlicitly say we don't want to ignore empty strings # unless we exlicitly say we don't want to ignore empty strings
self.assertEquals(set([doc_with_empty_title]), self.assertEquals(set([doc_with_empty_description]),
searchResults(ignore_empty_string=0, title='')) searchResults(ignore_empty_string=0, description=''))
def test_ignore_empty_string_related_key(self): def test_ignore_empty_string_related_key(self):
# ERP5Catalog ignore empty strings by default, also on related keys # ERP5Catalog ignore empty strings by default, also on related keys
region_with_empty_title = self.portal.portal_categories.region.newContent( region_with_empty_description = self.portal.portal_categories.region.newContent(
portal_type='Category', title='') portal_type='Category', description='')
doc_with_empty_region_title = self._makeOrganisation(title='X', doc_with_empty_region_description = self._makeOrganisation(
region_value=region_with_empty_title) region_value=region_with_empty_description)
doc_without_region = self._makeOrganisation(title='') doc_without_region = self._makeOrganisation()
ctool = self.getCatalogTool() ctool = self.getCatalogTool()
def searchResults(**kw): def searchResults(**kw):
kw['portal_type'] = 'Organisation' kw['portal_type'] = 'Organisation'
return set([x.getObject() for x in ctool.searchResults(**kw)]) return set([x.getObject() for x in ctool.searchResults(**kw)])
self.assertEquals(set([doc_with_empty_region_title, doc_without_region]), self.assertEquals(set([doc_with_empty_region_description, doc_without_region]),
searchResults(region_title='')) searchResults(region_description=''))
self.assertEquals(set([doc_with_empty_region_title]), self.assertEquals(set([doc_with_empty_region_description]),
searchResults(ignore_empty_string=0, region_title='')) searchResults(ignore_empty_string=0, region_description=''))
def test_complex_query(self, quiet=quiet, run=run_all_test): def test_complex_query(self, quiet=quiet, run=run_all_test):
# Make sure that complex query works on real environment. # Make sure that complex query works on real environment.
......
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