[Erp5-report] r32477 ivan - /erp5/trunk/products/ERP5OOo/tests/testDms.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Feb 12 09:12:29 CET 2010
Author: ivan
Date: Fri Feb 12 09:12:27 2010
New Revision: 32477
URL: http://svn.erp5.org?rev=32477&view=rev
Log:
Test if current authenticated user is added to contributor list of document (only if authenticated user is an ERP5 Person object)
Modified:
erp5/trunk/products/ERP5OOo/tests/testDms.py
Modified: erp5/trunk/products/ERP5OOo/tests/testDms.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testDms.py?rev=32477&r1=32476&r2=32477&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Fri Feb 12 09:12:27 2010
@@ -963,6 +963,45 @@
self.assertEquals(builder.extract('Pictures/%s.jpeg' % image_count),
converted_image, failure_message)
+ def test_addContributorToDocument(self):
+ """
+ Test if current authenticated user is added to contributor list of document
+ (only if authenticated user is an ERP5 Person object)
+ """
+ portal = self.portal
+ document_module = portal.document_module
+
+ # create Person objects and add preudo local security
+ person1 = self.createUser(reference='user1')
+ document_module.manage_setLocalRoles('user1', ['Assignor',])
+ person2 = self.createUser(reference='user2')
+ document_module.manage_setLocalRoles('user2', ['Assignor',])
+ self.stepTic()
+
+ # login as first one
+ ERP5TypeTestCase.login(self, 'user1')
+ doc = document_module.newContent(portal_type='File',
+ title='Test1')
+ self.stepTic()
+ self.login()
+ self.assertSameSet([person1],
+ doc.getContributorValueList())
+
+ # login as second one
+ ERP5TypeTestCase.login(self, 'user2')
+ doc.edit(title='Test2')
+ self.stepTic()
+ self.login()
+ self.assertSameSet([person1, person2],
+ doc.getContributorValueList())
+
+ # editing with non ERP5 Person object, nothing added to contributor
+ self.login()
+ doc.edit(title='Test3')
+ self.stepTic()
+ self.assertSameSet([person1, person2],
+ doc.getContributorValueList())
+
class TestDocumentWithSecurity(ERP5TypeTestCase):
username = 'yusei'
More information about the Erp5-report
mailing list