From 6fa04ed156a82394bd20648b070d1f9e0dce0653 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 24 Dec 2010 12:57:32 +0000
Subject: [PATCH] It is obsolete to consider that DMS will be in inconsistent
 state If 2 documents exists with same reference, version, language but
 different portal_types as long as only one is published in same time.

The user has to take a decision regarding which document to display.
Thats's why the test check that document stays in 'draft' state.
Otherwise side effects might happens on published document like
a Web Page is replaced by File (which display nothing) automatically.




git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41751 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/tests/testDms.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py
index 21853aafe1..2dfaca193d 100644
--- a/product/ERP5OOo/tests/testDms.py
+++ b/product/ERP5OOo/tests/testDms.py
@@ -2131,16 +2131,19 @@ return 1
     portal = self.portal
     # contribute a document, then make it not editable and check we can not contribute to it
     upload_file = makeFileUpload('TEST-en-002.doc')
-    kw = dict(file=upload_file, \
-               synchronous_metadata_discovery=True)
+    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
+    self.stepTic()
+    # passing another portal type allows to create a
+    # new document, but in draft state.
+    # Then User takes a decision to choose which document to publish
     kw['portal_type'] = "Spreadsheet"
-    self.assertRaises(ValueError, self.portal.Base_contribute, **kw)
+    new_document = self.portal.Base_contribute(**kw)
+    self.assertEquals(new_document.getValidationState(), 'draft')
 
     # make it read only
     document.manage_permission(Permissions.ModifyPortalContent, [])
+    new_document.manage_permission(Permissions.ModifyPortalContent, [])
     self.stepTic()
     kw.pop('portal_type')
     self.assertRaises(Unauthorized, self.portal.Base_contribute, **kw)
-- 
2.30.9