Commit 3ac3d77e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

check 'html preview of an OOo document with images' with /acl_users user too,...

check 'html preview of an OOo document with images' with /acl_users user too, that will fail for now.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38517 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 242e90ee
...@@ -569,6 +569,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -569,6 +569,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
portal = self.portal portal = self.portal
request = portal.REQUEST request = portal.REQUEST
request['PARENTS'] = [self.app] request['PARENTS'] = [self.app]
self.getPortalObject().aq_parent.acl_users._doAddUser(
'zope_user', '', ['Manager',], [])
website = self.setupWebSite() website = self.setupWebSite()
web_section_portal_type = 'Web Section' web_section_portal_type = 'Web Section'
web_section = website.newContent(portal_type=web_section_portal_type) web_section = website.newContent(portal_type=web_section_portal_type)
...@@ -581,26 +583,27 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -581,26 +583,27 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
file=upload_file) file=upload_file)
transaction.commit() transaction.commit()
self.tic() self.tic()
credential = 'ERP5TypeTestCase:' credential_list = ['ERP5TypeTestCase:', 'zope_user:']
# first, preview the draft in its physical location (in document module) for credential in credential_list:
response = self.publish('%s/asEntireHTML' % document.absolute_url_path(), # first, preview the draft in its physical location (in document module)
credential) response = self.publish('%s/asEntireHTML' % document.absolute_url_path(),
self.assertEquals(response.getHeader('content-type'), 'text/html') credential)
html = response.getBody() self.assertEquals(response.getHeader('content-type'), 'text/html')
self.assertTrue('<img' in html, html) html = response.getBody()
self.assertTrue('<img' in html, html)
# find the img src
img_list = etree.HTML(html).findall('.//img') # find the img src
self.assertEquals(1, len(img_list)) img_list = etree.HTML(html).findall('.//img')
src = img_list[0].get('src') self.assertEquals(1, len(img_list))
src = img_list[0].get('src')
# and make another query for this img
response = self.publish('%s/%s' % ( document.absolute_url_path(), src), # and make another query for this img
credential) response = self.publish('%s/%s' % ( document.absolute_url_path(), src),
self.assertEquals(response.getHeader('content-type'), 'image/png') credential)
png = response.getBody() self.assertEquals(response.getHeader('content-type'), 'image/png')
self.assertTrue(png.startswith('\x89PNG')) png = response.getBody()
self.assertTrue(png.startswith('\x89PNG'))
# then publish the document and access it anonymously by reference through # then publish the document and access it anonymously by reference through
# the web site # the web site
......
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