Commit 9b3d766b authored by Nicolas Delaby's avatar Nicolas Delaby

use ERP5TypeTestCase.publish method everywhere.

use class variable for credentials of publish method.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35173 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 56522060
...@@ -51,6 +51,7 @@ class TestERP5Web(ERP5TypeTestCase): ...@@ -51,6 +51,7 @@ class TestERP5Web(ERP5TypeTestCase):
manager_password = 'zope' manager_password = 'zope'
website_id = 'test' website_id = 'test'
credential = '%s:%s' % (manager_username, manager_password)
def getTitle(self): def getTitle(self):
return "ERP5Web" return "ERP5Web"
...@@ -957,14 +958,12 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -957,14 +958,12 @@ Hé Hé Hé!""", page.asText().strip())
# Through the web_site. # Through the web_site.
path = website.absolute_url_path() + '/NXD-Document.Cache' path = website.absolute_url_path() + '/NXD-Document.Cache'
response = self.publish(path, '%s:%s' % (self.manager_username, response = self.publish(path, self.credential)
self.manager_password))
self.assertNotEquals(response.getBody().find(content), -1) self.assertNotEquals(response.getBody().find(content), -1)
# Through a web_section. # Through a web_section.
path = web_section.absolute_url_path() + '/NXD-Document.Cache' path = web_section.absolute_url_path() + '/NXD-Document.Cache'
response = self.publish(path, '%s:%s' % (self.manager_username, response = self.publish(path, self.credential)
self.manager_password))
self.assertNotEquals(response.getBody().find(content), -1) self.assertNotEquals(response.getBody().find(content), -1)
# modified the web_page content # modified the web_page content
...@@ -976,13 +975,13 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -976,13 +975,13 @@ Hé Hé Hé!""", page.asText().strip())
# check the cache doesn't send again the old content # check the cache doesn't send again the old content
# Through the web_site. # Through the web_site.
path = website.absolute_url_path() + '/NXD-Document.Cache' path = website.absolute_url_path() + '/NXD-Document.Cache'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, self.credential)
RESPONSE=request.RESPONSE).find(new_content), -1) self.assertNotEquals(response.getBody().find(new_content), -1)
# Through a web_section. # Through a web_section.
path = web_section.absolute_url_path() + '/NXD-Document.Cache' path = web_section.absolute_url_path() + '/NXD-Document.Cache'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, self.credential)
RESPONSE=request.RESPONSE).find(new_content), -1) self.assertNotEquals(response.getBody().find(new_content), -1)
def test_13a_DocumentMovedCache(self, quiet=quiet, run=run_all_test): def test_13a_DocumentMovedCache(self, quiet=quiet, run=run_all_test):
...@@ -1059,13 +1058,11 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1059,13 +1058,11 @@ Hé Hé Hé!""", page.asText().strip())
# Through the web_site. # Through the web_site.
path = website.absolute_url_path() + '/NXD-Document.Cache' path = website.absolute_url_path() + '/NXD-Document.Cache'
response = self.publish(path, '%s:%s' % (self.manager_username, response = self.publish(path, self.credential)
self.manager_password))
self.assertNotEquals(response.getBody().find(content), -1) self.assertNotEquals(response.getBody().find(content), -1)
# Through a web_section. # Through a web_section.
path = web_section.absolute_url_path() + '/NXD-Document.Cache' path = web_section.absolute_url_path() + '/NXD-Document.Cache'
response = self.publish(path, '%s:%s' % (self.manager_username, response = self.publish(path, self.credential)
self.manager_password))
self.assertNotEquals(response.getBody().find(content), -1) self.assertNotEquals(response.getBody().find(content), -1)
# Modify the web_page content # Modify the web_page content
...@@ -1096,16 +1093,14 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1096,16 +1093,14 @@ Hé Hé Hé!""", page.asText().strip())
web_document = web_section.restrictedTraverse('NXD-Document.Cache') web_document = web_section.restrictedTraverse('NXD-Document.Cache')
self.assertEquals(web_document.asText().strip(), 'modified text') self.assertEquals(web_document.asText().strip(), 'modified text')
path = web_section.absolute_url_path() + '/NXD-Document.Cache' path = web_section.absolute_url_path() + '/NXD-Document.Cache'
response = self.publish(path, '%s:%s' % (self.manager_username, response = self.publish(path, self.credential)
self.manager_password))
self.assertNotEquals(response.getBody().find(new_content), -1) self.assertNotEquals(response.getBody().find(new_content), -1)
# Through a web_site. # Through a web_site.
web_document = website.restrictedTraverse('NXD-Document.Cache') web_document = website.restrictedTraverse('NXD-Document.Cache')
self.assertEquals(web_document.asText().strip(), 'modified text') self.assertEquals(web_document.asText().strip(), 'modified text')
path = website.absolute_url_path() + '/NXD-Document.Cache' path = website.absolute_url_path() + '/NXD-Document.Cache'
response = self.publish(path, '%s:%s' % (self.manager_username, response = self.publish(path, self.credential)
self.manager_password))
self.assertNotEquals(response.getBody().find(new_content), -1) self.assertNotEquals(response.getBody().find(new_content), -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment