Commit 0956a984 authored by Nicolas Delaby's avatar Nicolas Delaby

Create document with help of portal_contribution.

pass credential arguments in publish method, otherwise user is Anonymous


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44612 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d17eb18d
...@@ -1085,8 +1085,11 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -1085,8 +1085,11 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
def __init__(self, filename): def __init__(self, filename):
self.filename = os.path.basename(filename) self.filename = os.path.basename(filename)
file.__init__(self, filename) file.__init__(self, filename)
f = self.portal.newContent(portal_type='File', id='f') file_document = self.portal.portal_contributions.newContent(
f._edit(content_type='text/plain', file=DummyFile(__file__)) portal_type='File',
file=DummyFile(__file__),
content_type='text/plain')
# login as a member # login as a member
uf = self.portal.acl_users uf = self.portal.acl_users
uf._doAddUser('member_user', 'secret', ['Member'], []) uf._doAddUser('member_user', 'secret', ['Member'], [])
...@@ -1094,8 +1097,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -1094,8 +1097,10 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
newSecurityManager(None, user) newSecurityManager(None, user)
# if it didn't raise Unauthorized, Ok # if it didn't raise Unauthorized, Ok
response = self.publish('%s/Base_download' % f.getPath()) basic = '%s:' % self.username
self.assertEquals(file(__file__).read(), response.body) response = self.publish('%s/Base_download' % file_document.getPath(),
basic=basic)
self.assertEquals(file_document.getData(), response.body)
self.assertEquals('text/plain', self.assertEquals('text/plain',
response.getHeader('content-type').split(';')[0]) response.getHeader('content-type').split(';')[0])
self.assertEquals('attachment; filename="%s"' % os.path.basename(__file__), self.assertEquals('attachment; filename="%s"' % os.path.basename(__file__),
......
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