From 978725cd4325abf793bd5a468f2cdb99a704cd0c Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Mon, 31 May 2010 11:42:33 +0000 Subject: [PATCH] Test metadata discovery from user_login. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35782 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5OOo/tests/testIngestion.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/product/ERP5OOo/tests/testIngestion.py b/product/ERP5OOo/tests/testIngestion.py index b5666a8f19..222442ca19 100644 --- a/product/ERP5OOo/tests/testIngestion.py +++ b/product/ERP5OOo/tests/testIngestion.py @@ -1454,9 +1454,31 @@ class TestIngestion(ERP5TypeTestCase): 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() """ -- 2.30.9