[Erp5-report] r35173 nicolas - /erp5/trunk/products/ERP5/tests/testERP5Web.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue May 11 15:58:49 CEST 2010


Author: nicolas
Date: Tue May 11 15:58:44 2010
New Revision: 35173

URL: http://svn.erp5.org?rev=35173&view=rev
Log:
use ERP5TypeTestCase.publish method everywhere.
use class variable for credentials of publish method.

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=35173&r1=35172&r2=35173&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] Tue May 11 15:58:44 2010
@@ -51,6 +51,7 @@
   manager_password = 'zope'
   website_id = 'test'
 
+  credential = '%s:%s' % (manager_username, manager_password)
   def getTitle(self):
     return "ERP5Web"
 
@@ -957,14 +958,12 @@
 
     # Through the web_site.
     path = website.absolute_url_path() + '/NXD-Document.Cache'
-    response = self.publish(path, '%s:%s' % (self.manager_username,
-                                                        self.manager_password))
+    response = self.publish(path, self.credential)
     self.assertNotEquals(response.getBody().find(content), -1)
 
     # Through a web_section.
     path = web_section.absolute_url_path() + '/NXD-Document.Cache'
-    response = self.publish(path, '%s:%s' % (self.manager_username,
-                                                        self.manager_password))
+    response = self.publish(path, self.credential)
     self.assertNotEquals(response.getBody().find(content), -1)
 
     # modified the web_page content
@@ -976,13 +975,13 @@
     # check the cache doesn't send again the old content
     # Through the web_site.
     path = website.absolute_url_path() + '/NXD-Document.Cache'
-    self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST,
-      RESPONSE=request.RESPONSE).find(new_content), -1)
+    response = self.publish(path, self.credential)
+    self.assertNotEquals(response.getBody().find(new_content), -1)
 
     # Through a web_section.
     path = web_section.absolute_url_path() + '/NXD-Document.Cache'
-    self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST,
-      RESPONSE=request.RESPONSE).find(new_content), -1)
+    response = self.publish(path, self.credential)
+    self.assertNotEquals(response.getBody().find(new_content), -1)
 
 
   def test_13a_DocumentMovedCache(self, quiet=quiet, run=run_all_test):
@@ -1059,13 +1058,11 @@
 
     # Through the web_site.
     path = website.absolute_url_path() + '/NXD-Document.Cache'
-    response = self.publish(path, '%s:%s' % (self.manager_username,
-                                                        self.manager_password))
+    response = self.publish(path, self.credential)
     self.assertNotEquals(response.getBody().find(content), -1)
     # Through a web_section.
     path = web_section.absolute_url_path() + '/NXD-Document.Cache'
-    response = self.publish(path, '%s:%s' % (self.manager_username,
-                                                        self.manager_password))
+    response = self.publish(path, self.credential)
     self.assertNotEquals(response.getBody().find(content), -1)
 
     # Modify the web_page content
@@ -1096,16 +1093,14 @@
     web_document = web_section.restrictedTraverse('NXD-Document.Cache')
     self.assertEquals(web_document.asText().strip(), 'modified text')
     path = web_section.absolute_url_path() + '/NXD-Document.Cache'
-    response = self.publish(path, '%s:%s' % (self.manager_username,
-                                                        self.manager_password))
+    response = self.publish(path, self.credential)
     self.assertNotEquals(response.getBody().find(new_content), -1)
 
     # Through a web_site.
     web_document = website.restrictedTraverse('NXD-Document.Cache')
     self.assertEquals(web_document.asText().strip(), 'modified text')
     path = website.absolute_url_path() + '/NXD-Document.Cache'
-    response = self.publish(path, '%s:%s' % (self.manager_username,
-                                                        self.manager_password))
+    response = self.publish(path, self.credential)
     self.assertNotEquals(response.getBody().find(new_content), -1)
 
 




More information about the Erp5-report mailing list