From a2bda9112907dfcbee720ca6de7e31012118252d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 3 Oct 2008 14:39:43 +0000
Subject: [PATCH] tests that portal_catalog supports query passed as dict in
 the REQUEST, in this case it is not a dict, but a
 ZPublisher.HTTPRequest.record instance (which behaves like a dict)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24005 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Catalog/tests/testERP5Catalog.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py
index ecc3716251..2b66df5800 100644
--- a/product/ERP5Catalog/tests/testERP5Catalog.py
+++ b/product/ERP5Catalog/tests/testERP5Catalog.py
@@ -1151,6 +1151,24 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
                 portal_type='Organisation',
                 title={'query': ('B', 'C'), 'range': 'minngt'})])
 
+  def test_QueryDictFromRequest(self):
+    """use a dict from REQUEST as a keyword parameter.
+    """
+    org_a = self._makeOrganisation(title='A')
+    org_b = self._makeOrganisation(title='B')
+    org_c = self._makeOrganisation(title='C')
+    
+    query_dict = {'query': ('B', 'C'), 'range': 'minngt'}
+    from ZPublisher.HTTPRequest import record
+    query_record = record()
+    for k, v in query_dict.items():
+      setattr(query_record, k, v)
+
+    self.assertEquals(set([org_b.getPath(), org_c.getPath()]),
+        set([x.path for x in self.getCatalogTool()(
+                portal_type='Organisation',
+                title=query_record)]))
+
   def test_39_DeferredConnection(self, quiet=quiet, run=run_all_test):
     """ERP5Catalog uses a deferred connection for full text indexing.
     """
-- 
2.30.9