Commit 43825707 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a test for catalog's behaviour regarding "extra" spaces in string parameters.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20543 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 550437c9
...@@ -2608,6 +2608,28 @@ VALUES ...@@ -2608,6 +2608,28 @@ VALUES
self.assertEquals(1, len(folder.portal_catalog(portal_type=portal_type, self.assertEquals(1, len(folder.portal_catalog(portal_type=portal_type,
title='foo_org%ion_1'))) title='foo_org%ion_1')))
def test_SearchedStringIsNotStripped(self, quiet=quiet, run=run_all_test):
"""
Check that extra spaces in lookup values are preserved
"""
if not run:
return
portal_type = 'Organisation'
folder = self.getOrganisationModule()
first_doc = folder.newContent(portal_type=portal_type, reference="foo")
second_doc = folder.newContent(portal_type=portal_type, reference=" foo")
get_transaction().commit()
self.tic()
def compareSet(reference, document_list):
result = folder.portal_catalog(portal_type=portal_type,
reference=reference)
self.assertSameSet(document_list, [x.getObject() for x in result])
compareSet('foo', [first_doc])
compareSet(' foo', [second_doc])
compareSet('foo ', [])
compareSet(' foo ', [])
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Catalog)) suite.addTest(unittest.makeSuite(TestERP5Catalog))
......
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