From 306565a6856800da11df13e86dc7b708fee98579 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 17 Nov 2006 15:37:36 +0000
Subject: [PATCH] add a test for search and sort on a date column
 (delivery.start_date) extends FooModule_createObjects to set a start date on
 created foos

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11357 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../testSearchAndSortOnDateColumn.xml         | 216 ++++++++++++++++++
 .../erp5_ui_test/FooModule_createObjects.xml  |  16 +-
 bt5/erp5_ui_test/bt/revision                  |   2 +-
 3 files changed, 228 insertions(+), 6 deletions(-)
 create mode 100644 bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSearchAndSortOnDateColumn.xml

diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSearchAndSortOnDateColumn.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSearchAndSortOnDateColumn.xml
new file mode 100644
index 0000000000..d4e098e041
--- /dev/null
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSearchAndSortOnDateColumn.xml
@@ -0,0 +1,216 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PageTemplates.ZopePageTemplate</string>
+          <string>ZopePageTemplate</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
+      xmlns:metal="http://xml.zope.org/namespaces/metal">\n
+<head>\n
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
+<title>Test Search and Sort on a Date Column</title>\n
+</head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="3">Test Search and Sort on a Date Column</td></tr>\n
+</thead><tbody>\n
+<tal:block metal:use-macro="here/ListBoxZuite_CommonTemplate/macros/init" />\n
+<tr>\n
+\t<td>open</td>\n
+\t<td>${base_url}/foo_module/FooModule_createObjects?set_dates:int=1&amp;start:int=1&amp;num:int=3</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>assertTextPresent</td>\n
+\t<td>Created Successfully.</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>open</td>\n
+\t<td>${base_url}/foo_module/ListBoxZuite_waitForActivities</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>assertTextPresent</td>\n
+\t<td>Done.</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>open</td>\n
+\t<td>${base_url}/foo_module/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_search_columns=delivery.start_date%0Aid&amp;field_columns=delivery.start_date%0Aid&amp;field_sort_columns=delivery.start_date%0Aid</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>assertTextPresent</td>\n
+\t<td>Set Successfully.</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>open</td>\n
+\t<td>${base_url}/foo_module/view</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyEditable</td>\n
+\t<td>//tr[@id="listbox_search_line"]/td[2]//input</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyValue</td>\n
+\t<td>//tr[@id="listbox_search_line"]/td[2]//input</td>\n
+\t<td></td>\n
+</tr>\n
+<!-- Search -->\n
+<tr>\n
+\t<td>type</td>\n
+\t<td>//tr[@id="listbox_search_line"]/td[2]//input</td>\n
+\t<td>2001/01/01</td>\n
+</tr>\n
+<tr>\n
+\t<td>clickAndWait</td>\n
+\t<td>Base_doSelect:method</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyValue</td>\n
+\t<td>//tr[@id="listbox_search_line"]/td[2]//input</td>\n
+\t<td>2001/01/01</td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>id=listbox_record_number</td>\n
+\t<td>1 record(s)</td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_0"]/td[2]</td>\n
+\t<td>2001/01/01</td>\n
+</tr>\n
+\n
+<!-- Sort -->\n
+<tr>\n
+\t<td>clickAndWait</td>\n
+\t<td>Folder_show:method</td>\n
+\t<td></td>\n
+</tr>\n
+<!-- ASC -->\n
+<tr>\n
+\t<td>clickAndWait</td>\n
+\t<td>//tr[@id="listbox_label_line"]/td[2]/a</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_0"]/td[2]</td>\n
+\t<td>2001/01/01</td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_1"]/td[2]</td>\n
+\t<td>2002/02/02</td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_2"]/td[2]</td>\n
+\t<td>2003/03/03</td>\n
+</tr>\n
+<!-- DESC -->\n
+<tr>\n
+\t<td>clickAndWait</td>\n
+\t<td>//tr[@id="listbox_label_line"]/td[2]/a</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_0"]/td[2]</td>\n
+\t<td>2003/03/03</td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_1"]/td[2]</td>\n
+\t<td>2002/02/02</td>\n
+</tr>\n
+<tr>\n
+\t<td>verifyText</td>\n
+\t<td>//tr[@id="listbox_data_line_2"]/td[2]</td>\n
+\t<td>2001/01/01</td>\n
+</tr>\n
+\n
+</tbody></table>\n
+</body>\n
+</html>\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/html</string> </value>
+        </item>
+        <item>
+            <key> <string>expand</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>testSearchAndSortOnDateColumn</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_createObjects.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_createObjects.xml
index aa358889d1..6d7ae2c462 100644
--- a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_createObjects.xml
+++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_createObjects.xml
@@ -68,14 +68,16 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>folder = context.foo_module\n
+            <value> <string>from DateTime import DateTime\n
+folder = context.foo_module\n
 category_list = (\'a\', \'b\', \'a/a1\', \'a/a2\')\n
 \n
 for i in range(start, start + num):\n
   category = category_list[i % len(category_list)]\n
-  folder.newContent(id = str(i), title = \'Title %d\' % i, quantity = 10.0 - float(i),\n
+  foo = folder.newContent(id = str(i), title = \'Title %d\' % i, quantity = 10.0 - float(i),\n
                     foo_category = category)\n
-\n
+  if set_dates:\n
+    foo.setStartDate(DateTime(i, i, i))\n
 return \'Created Successfully.\'\n
 </string> </value>
         </item>
@@ -99,7 +101,7 @@ return \'Created Successfully.\'\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>start=0, num=10</string> </value>
+            <value> <string>start=0, num=10, set_dates=0</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -119,7 +121,7 @@ return \'Created Successfully.\'\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>2</int> </value>
+                        <value> <int>3</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -127,6 +129,8 @@ return \'Created Successfully.\'\n
                           <tuple>
                             <string>start</string>
                             <string>num</string>
+                            <string>set_dates</string>
+                            <string>DateTime</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>folder</string>
@@ -139,6 +143,7 @@ return \'Created Successfully.\'\n
                             <string>category</string>
                             <string>str</string>
                             <string>float</string>
+                            <string>foo</string>
                           </tuple>
                         </value>
                     </item>
@@ -153,6 +158,7 @@ return \'Created Successfully.\'\n
               <tuple>
                 <int>0</int>
                 <int>10</int>
+                <int>0</int>
               </tuple>
             </value>
         </item>
diff --git a/bt5/erp5_ui_test/bt/revision b/bt5/erp5_ui_test/bt/revision
index b9c6c007cc..dd1ec209f3 100644
--- a/bt5/erp5_ui_test/bt/revision
+++ b/bt5/erp5_ui_test/bt/revision
@@ -1 +1 @@
-131
\ No newline at end of file
+132
\ No newline at end of file
-- 
2.30.9