[Erp5-report] r38775 ivan - /erp5/trunk/products/ERP5OOo/tests/testDms.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 30 08:53:17 CEST 2010


Author: ivan
Date: Thu Sep 30 08:53:16 2010
New Revision: 38775

URL: http://svn.erp5.org?rev=38775&view=rev
Log:
Test various cases of contributing to an existing document (explicit change of portal_type, change of read only document).

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=38775&r1=38774&r2=38775&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Thu Sep 30 08:53:16 2010
@@ -71,6 +71,7 @@ from threading import Thread
 import httplib
 import urllib
 from AccessControl import Unauthorized
+from Products.ERP5Type import Permissions
 
 QUIET = 0
 
@@ -2124,7 +2125,6 @@ return 1
     self.assertSameSet([x.getObject() for x in document1.Document_getOtherVersionDocumentList()], \
                         [web_page1])
 
-
   def test_Base_getWorkflowEventInfoList(self):
     """
       Test getting history of an object.
@@ -2145,6 +2145,31 @@ return 1
     self.assertEquals(event_list[-1].action, 'Share Document')
     self.assertEquals(event_list[-2].action, 'Reject Document')
     self.assertEquals(event_list[-3].action, 'Publish Document')
+    
+  def test_ContributeToExistingDocument(self):
+    """
+      Test various cases of contributing to an existing document
+    """
+    request = get_request()
+    portal = self.portal
+    # contribute a document, then make it not editable and check we can not contribute to it
+    filename = 'TEST-en-002.doc'
+    file = makeFileUpload(filename)
+    upload_file = makeFileUpload('TEST-en-002.doc')
+    kw = dict(file=upload_file, \
+               synchronous_metadata_discovery=True)
+    document = self.portal.Base_contribute(**kw)
+    self.stepTic()    
+    # passing another portal type should raise an exception
+    kw['portal_type'] = "Spreadsheet"
+    self.assertRaises(ValueError, self.portal.Base_contribute, **kw)
+                                           
+    # make it read only
+    document.manage_permission(Permissions.ModifyPortalContent, [])
+    self.stepTic()
+    kw.pop('portal_type')
+    self.assertRaises(Unauthorized, self.portal.Base_contribute, **kw)
+                                  
 
 class TestDocumentWithSecurity(TestDocumentMixin):
 




More information about the Erp5-report mailing list