Commit c36b33f6 authored by Nicolas Delaby's avatar Nicolas Delaby

Do not use request.traverse method because it logout the user.

Use PortalTestCase.publish method instead.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35015 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7a96a61b
...@@ -957,13 +957,15 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -957,13 +957,15 @@ 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'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, '%s:%s' % (self.manager_username,
RESPONSE=request.RESPONSE).find(content), -1) self.manager_password))
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'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, '%s:%s' % (self.manager_username,
RESPONSE=request.RESPONSE).find(content), -1) self.manager_password))
self.assertNotEquals(response.getBody().find(content), -1)
# modified the web_page content # modified the web_page content
document.edit(text_content=new_content) document.edit(text_content=new_content)
...@@ -1045,7 +1047,7 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1045,7 +1047,7 @@ Hé Hé Hé!""", page.asText().strip())
web_section = website.newContent(portal_type=web_section_portal_type) web_section = website.newContent(portal_type=web_section_portal_type)
content = '<p>initial text</p>' content = '<p>initial text</p>'
new_content = '<p>modified text<p>' new_content = '<p>modified text</p>'
document = portal.web_page_module.newContent(portal_type='Web Page', document = portal.web_page_module.newContent(portal_type='Web Page',
id='document_cache', id='document_cache',
reference='NXD-Document.Cache', reference='NXD-Document.Cache',
...@@ -1057,13 +1059,14 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1057,13 +1059,14 @@ 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'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, '%s:%s' % (self.manager_username,
RESPONSE=request.RESPONSE).find(content), -1) self.manager_password))
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'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, '%s:%s' % (self.manager_username,
RESPONSE=request.RESPONSE).find(content), -1) self.manager_password))
self.assertNotEquals(response.getBody().find(content), -1)
# Modify the web_page content # Modify the web_page content
# Use unrestrictedTraverse (XXX-JPS reason unknown) # Use unrestrictedTraverse (XXX-JPS reason unknown)
...@@ -1093,15 +1096,17 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1093,15 +1096,17 @@ 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'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, '%s:%s' % (self.manager_username,
RESPONSE=request.RESPONSE).find(new_content), -1) self.manager_password))
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'
self.assertNotEquals(request.traverse(path)(REQUEST=request.REQUEST, response = self.publish(path, '%s:%s' % (self.manager_username,
RESPONSE=request.RESPONSE).find(new_content), -1) self.manager_password))
self.assertNotEquals(response.getBody().find(new_content), -1)
def test_14_AccessWebSiteForWithDifferentUserPreferences(self): def test_14_AccessWebSiteForWithDifferentUserPreferences(self):
......
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