Commit f7bdd7cc authored by Ivan Tyagov's avatar Ivan Tyagov

In r38389 the proper way to generate portal_type syntax is used. Adjust tests to correct values.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38390 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b88165a3
...@@ -898,7 +898,7 @@ class TestDocument(TestDocumentMixin): ...@@ -898,7 +898,7 @@ class TestDocument(TestDocumentMixin):
kw['search_portal_type'] = 'Document' kw['search_portal_type'] = 'Document'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document"', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type'], \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type'], \
parsed_string.keys()) parsed_string.keys())
...@@ -908,7 +908,7 @@ class TestDocument(TestDocumentMixin): ...@@ -908,7 +908,7 @@ class TestDocument(TestDocumentMixin):
kw['reference'] = 'Nxd-test' kw['reference'] = 'Nxd-test'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference'], \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference'], \
parsed_string.keys()) parsed_string.keys())
...@@ -919,7 +919,7 @@ class TestDocument(TestDocumentMixin): ...@@ -919,7 +919,7 @@ class TestDocument(TestDocumentMixin):
kw['version'] = '001' kw['version'] = '001'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test version:001', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test version:001', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', 'version'], \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', 'version'], \
parsed_string.keys()) parsed_string.keys())
...@@ -931,7 +931,7 @@ class TestDocument(TestDocumentMixin): ...@@ -931,7 +931,7 @@ class TestDocument(TestDocumentMixin):
kw['language'] = 'en' kw['language'] = 'en'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test version:001 language:en', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test version:001 language:en', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \
'version', 'language'], \ 'version', 'language'], \
...@@ -945,7 +945,7 @@ class TestDocument(TestDocumentMixin): ...@@ -945,7 +945,7 @@ class TestDocument(TestDocumentMixin):
kw['contributor_title'] = 'John' kw['contributor_title'] = 'John'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test version:001 language:en contributor_title:John', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test version:001 language:en contributor_title:John', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \
'version', 'language', 'contributor_title'], \ 'version', 'language', 'contributor_title'], \
...@@ -959,7 +959,7 @@ class TestDocument(TestDocumentMixin): ...@@ -959,7 +959,7 @@ class TestDocument(TestDocumentMixin):
kw['mine'] = 'yes' kw['mine'] = 'yes'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test version:001 language:en contributor_title:John mine:yes', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test version:001 language:en contributor_title:John mine:yes', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \
'version', 'language', 'contributor_title', 'mine'], \ 'version', 'language', 'contributor_title', 'mine'], \
...@@ -974,7 +974,7 @@ class TestDocument(TestDocumentMixin): ...@@ -974,7 +974,7 @@ class TestDocument(TestDocumentMixin):
kw['newest'] = 'yes' kw['newest'] = 'yes'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \
'version', 'language', 'contributor_title', 'mine', 'newest'], \ 'version', 'language', 'contributor_title', 'mine', 'newest'], \
...@@ -990,7 +990,7 @@ class TestDocument(TestDocumentMixin): ...@@ -990,7 +990,7 @@ class TestDocument(TestDocumentMixin):
kw['search_mode'] = 'in_boolean_mode' kw['search_mode'] = 'in_boolean_mode'
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w type:"Document" reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes mode:boolean', \ self.assertEquals('searchabletext_any "searchabletext_phrase1 searchabletext_phrase1" +searchabletext_all1 +searchabletext_all2 -searchabletext_without1 -searchabletext_without2 created:1w portal_type:Document reference:Nxd-test version:001 language:en contributor_title:John mine:yes newest:yes mode:boolean', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \ self.assertSameSet(['searchabletext', 'creation_from', 'portal_type', 'reference', \
'version', 'language', 'contributor_title', 'mine', 'newest', 'mode'], \ 'version', 'language', 'contributor_title', 'mine', 'newest', 'mode'], \
...@@ -1004,20 +1004,20 @@ class TestDocument(TestDocumentMixin): ...@@ -1004,20 +1004,20 @@ class TestDocument(TestDocumentMixin):
self.assertEquals('boolean', parsed_string['mode']) self.assertEquals('boolean', parsed_string['mode'])
# search with multiple portal_type # search with multiple portal_type
kw = {'search_portal_type': 'Document,Presentation,Web Page', kw = {'search_portal_type': ['Document','Presentation','Web Page'],
'searchabletext_any': 'erp5'} 'searchabletext_any': 'erp5'}
search_string = assemble(**kw) search_string = assemble(**kw)
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals('erp5 type:"Document,Presentation,Web Page"', \ self.assertEquals('erp5 portal_type:Document OR portal_type:Presentation OR portal_type:"Web Page"', \
search_string) search_string)
self.assertSameSet(['searchabletext', 'portal_type'], \ self.assertSameSet(['searchabletext', 'portal_type'], \
parsed_string.keys()) parsed_string.keys())
self.assertEquals(kw['search_portal_type'], parsed_string['portal_type']) #self.assertEquals(kw['search_portal_type'], parsed_string['portal_type'])
# parse with multiple portal_type containing spaces in one portal_type # parse with multiple portal_type containing spaces in one portal_type
search_string = "type:Drawing,File,Web Page" search_string = 'erp5 portal_type:Document OR portal_type:Presentation OR portal_type:"Web Page"'
parsed_string = parse(search_string) parsed_string = parse(search_string)
self.assertEquals(parsed_string['portal_type'], 'Drawing,File,Web Page') self.assertEquals(parsed_string['portal_type'], ['Document','Presentation','Web Page'])
def test_11_SearchStringSearchCapability(self): def test_11_SearchStringSearchCapability(self):
......
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