[Product-Developers] functional testing: not authorized problem
Maarten Nieber
maarten at usecm.com
Thu Nov 10 11:45:33 UTC 2011
I solved the problem, it was related to the workflow for my entity type. In case
anyone needs it, Im pasting the fixed code below
def test_getFilesInfo(self):
portal = self.layer['portal']
setRoles(portal, TEST_USER_ID, ('Manager',))
portal.invokeFactory('abb.types.strategycontainer', 'strategyContainer',
title=u"Strategy Container") # abb.types.abb
strategyContainer = portal['strategyContainer']
strategyContainer.invokeFactory('abb.types.strategy', 'strategy',
title=u"Strategy")
strategy = strategyContainer['strategy']
portal_workflow = getToolByName(portal, 'portal_workflow')
# i replaced the real action with a 'make_visible' action.
# You should just paste the appropriate workflow action here that
# makes the document visible to other people
portal_workflow.doActionFor(strategy, "make_visible")
import transaction; transaction.commit()
app = self.layer['app']
browser = Browser(app)
browser.handleErrors = False
browser.open(portal.absolute_url())
browser.getLink('Log in').click()
browser.getControl(name='__ac_name').value = TEST_USER_ID
browser.getControl(name='__ac_password').value = default_password
browser.getControl('Log in').click()
self.assertTrue("You are now logged in" in browser.contents)
browser.open(strategy.absolute_url())
More information about the Product-Developers
mailing list