[Erp5-report] r34311 lucas - /erp5/trunk/products/ERP5/tests/testERP5Web.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Apr 7 09:53:33 CEST 2010


Author: lucas
Date: Wed Apr  7 09:53:30 2010
New Revision: 34311

URL: http://svn.erp5.org?rev=34311&view=rev
Log:
Added a test to prove the bad behavior of getDocumentValueList for Anonymous user when you have a Predicate defined.

Modified:
    erp5/trunk/products/ERP5/tests/testERP5Web.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Web.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Web.py?rev=34311&r1=34310&r2=34311&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] Wed Apr  7 09:53:30 2010
@@ -1220,6 +1220,7 @@
     modification_date = rfc1123_date(document.getModificationDate())
     self.assertEqual(modification_date, last_modified_header)
 
+
 class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
   """
   Test for erp5_web with simple security.
@@ -1229,7 +1230,15 @@
 
   def getBusinessTemplateList(self):
     return ('erp5_base',
+            'erp5_trade',
+            'erp5_project',
+            'erp5_ingestion_mysql_innodb_catalog',
+            'erp5_ingestion',
             'erp5_web',
+            'erp5_dms',
+            'erp5_knowledge_pad',
+            'erp5_km',
+            'erp5_rss_style',
             )
 
   def getTitle(self):
@@ -1708,6 +1717,59 @@
     except Unauthorized:
       self.fail("A webmaster should be able to rename a Category.")
 
+  def test_getDocumentValueList_AnonymousUser(self):
+    """
+      For a given Web Site with Predicates:
+      - membership_criterion_base_category: follow_up
+      - membership_criterion_document_list: follow_up/project/object_id
+      
+      When you access website/WebSection_viewContentListAsRSS:
+      - with super user you get the correct result
+      - with anonymous user you do not get the correct result
+
+      In this case, both Web Pages are returned for Anonymous user and this
+      it not the expected behavior.
+
+      Note: The ListBox into WebSection_viewContentListAsRSS has
+            getDocumentValueList defined as ListMethod.
+    """
+    project = self.portal.project_module.newContent(portal_type='Project')
+    project.validate()
+    self.stepTic()
+                                                    
+    website = self.portal.web_site_module.newContent(portal_type='Web Site',
+                                                     id='site')
+    website.setMembershipCriterionBaseCategory('follow_up')
+    website.setMembershipCriterionDocumentList(['follow_up/%s' %
+                                                  project.getRelativeUrl()])
+    self.stepTic()
+
+    web_page_module = self.portal.web_page_module
+    web_page_follow_up = web_page_module.newContent(portal_type="Web Page",
+                                      follow_up=project.getRelativeUrl(),
+                                      id='test_web_page_with_follow_up',
+                                      reference='NXD-Document.Follow.Up.Test',
+                                      version='001',
+                                      language='en',
+                                      text_content='test content')
+    web_page_follow_up.publish()
+    self.stepTic()
+    
+    web_page_no_follow_up = web_page_module.newContent(portal_type="Web Page",
+                                      id='test_web_page_no_follow_up',
+                                      reference='NXD-Document.No.Follow.Up.Test',
+                                      version='001',
+                                      language='en',
+                                      text_content='test content')
+    web_page_no_follow_up.publish()
+    self.stepTic()
+
+    self.assertEquals(1, len(website.WebSection_getDocumentValueList()))
+
+    self.logout()
+    self.assertEquals(1, len(website.WebSection_getDocumentValueList()))
+
+
 class TestERP5WebCategoryPublicationWorkflow(ERP5TypeTestCase):
   """Tests possible transitions for category_publication_workflow"""
   def getBusinessTemplateList(self):




More information about the Erp5-report mailing list