From 4bad05275b24b0f2706c115b5c5b73c221e01d69 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Tue, 17 Jun 2008 10:53:13 +0000
Subject: [PATCH] Test fallback search for a Web Section. Only documents in
 english should be returned.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21642 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testERP5Web.py | 11 +++++++++--
 product/ERP5/tests/testGadgets.py |  8 --------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py
index 3485642441..20f1b8d2bd 100644
--- a/product/ERP5/tests/testERP5Web.py
+++ b/product/ERP5/tests/testERP5Web.py
@@ -430,8 +430,8 @@ class TestERP5Web(ERP5TypeTestCase, ZopeTestCase.Functional):
     web_page_en.publish()
     get_transaction().commit()
     self.tic()
-    self.assertEquals(1,  len(websection.getDocumentValueList()))
-    self.assertEquals(web_page_en,  websection.getDocumentValueList()[0].getObject())
+    self.assertEquals(1,  len(websection.getDocumentValueList(anguage='en')))
+    self.assertEquals(web_page_en,  websection.getDocumentValueList(anguage='en')[0].getObject())
     
     # create pages belonging to this publication_section 'documentation' but for 'bg' language
     web_page_bg = portal.web_page_module.newContent(portal_type = 'Web Page', 
@@ -448,6 +448,13 @@ class TestERP5Web(ERP5TypeTestCase, ZopeTestCase.Functional):
     get_transaction().commit()
     self.tic()
     self.assertEquals(0,  len(websection.getDocumentValueList(language='bg')))
+    
+    # publish page and search without a language (by default system should return 'en' docs only)
+    web_page_bg.publish()
+    get_transaction().commit()
+    self.tic()
+    self.assertEquals(1,  len(websection.getDocumentValueList()))
+    self.assertEquals(web_page_en,  websection.getDocumentValueList()[0].getObject())
 
   def test_09_DefaultDocumentForWebSection(self, quiet=quiet, run=run_all_test):
     """ Testetting default document for a Web Section. Test  use case like workflow state of document.
diff --git a/product/ERP5/tests/testGadgets.py b/product/ERP5/tests/testGadgets.py
index e267d0855a..be8113d221 100644
--- a/product/ERP5/tests/testGadgets.py
+++ b/product/ERP5/tests/testGadgets.py
@@ -177,14 +177,6 @@ class TestGadgets(ERP5TypeTestCase):
     self.assertEqual(base_websection_pad.getObject(),
                      current_websection_pad.getObject())
     
-    
-                                                      
-                                                                 
-    
-
-    
-   
-    
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestGadgets))
-- 
2.30.9