Commit 978725cd authored by Ivan Tyagov's avatar Ivan Tyagov

Test metadata discovery from user_login.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35782 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 310378d1
......@@ -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()
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment