[Erp5-report] r35782 ivan - /erp5/trunk/products/ERP5OOo/tests/testIngestion.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 31 13:42:34 CEST 2010


Author: ivan
Date: Mon May 31 13:42:33 2010
New Revision: 35782

URL: http://svn.erp5.org?rev=35782&view=rev
Log:
Test metadata discovery from user_login.

Modified:
    erp5/trunk/products/ERP5OOo/tests/testIngestion.py

Modified: erp5/trunk/products/ERP5OOo/tests/testIngestion.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testIngestion.py?rev=35782&r1=35781&r2=35782&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] Mon May 31 13:42:33 2010
@@ -1454,9 +1454,31 @@
     self.stepTic()
     self.assertEquals(document.getSourceReference(), my_filename)
 
+  def test_16_TestMetadataDiscoveryFromUserLogin(self):
+    """
+      Test that  user_login is used to discover meta data (group, function, etc.. from Assignment)
+    """
+    portal = self.portal
+    contribution_tool = getToolByName(portal, 'portal_contributions')
+    # create an user to simulate upload from him
+    user = self.createUser(reference='contributor1')
+    assignment = self.createUserAssignment(user, \
+                                           dict(group='anybody',
+                                                function='function/musician/wind/saxophone',
+                                                site='site/arctic/spitsbergen'))
+    portal.document_module.manage_setLocalRoles('contributor1', ['Assignor',])
+    self.stepTic()
+    file_object = makeFileUpload('TEST-en-002.doc')
+    document = contribution_tool.newContent(file=file_object)
+    document.discoverMetadata(document.getSourceReference(), 'contributor1') 
+    self.stepTic()
+    self.assertEquals(document.getSourceReference(), 'TEST-en-002.doc')
+    self.assertEquals('function/musician/wind/saxophone', document.getFunction())
+    self.assertEquals('anybody', document.getGroup())
+    self.assertEquals('site/arctic/spitsbergen', document.getSite())
+
 # Missing tests
 """
-    property_dict = context.getPropertyDictFromUserLogin()
     property_dict = context.getPropertyDictFromInput()
 """
 




More information about the Erp5-report mailing list