Test portlets
=============

Currently there is one Project, but we do not have any tasks assigned
to us there.  Since there is only one project, we simply show that one
and do not bother with filtering.

    >>> from Products.eXtremeManagement.tests.base import reset_request
    >>> from urllib import unquote
    >>> def physicalPathFromURL(self, URL):
    ...     # Simplified version of ZPublisher.HTTPRequest.py
    ...     path = filter(None, URL.split( '/'))
    ...     if URL.find( '://') >= 0:
    ...         path = path[2:]
    ...     return map(unquote, path)
    >>> from zope.publisher.browser import TestRequest
    >>> TestRequest.physicalPathFromURL = physicalPathFromURL
    >>> catalog = self.portal.portal_catalog
    >>> len(catalog(portal_type='Project'))
    1
    >>> len(catalog(portal_type='Task'))
    1
    >>> from Products.eXtremeManagement.browser.projects import MyProjects
    >>> myprojects = MyProjects(self.portal, TestRequest())
    >>> myprojects.projectlist
    [<Products.ZCatalog.Catalog.mybrains object at ...>]

We add another Project so we have to do some filtering.  But we are
still assigned to a task in that project, so the project still shows.

    >>> self.setRoles(['Manager'])
    >>> dummy = self.portal.invokeFactory('Project', 'my-project')
    >>> self.setRoles(['Employee'])
    >>> myprojects = MyProjects(self.portal, TestRequest())
    >>> myprojects.projectlist
    [<Products.ZCatalog.Catalog.mybrains object at ...>]


Now we remove ourselves from the assignees of that task which means we
no longer see a project.

    >>> from Products.PloneTestCase.setup import default_user
    >>> task = self.portal.project.iteration.story.task
    >>> task.setAssignees(('employee', ))
    >>> task.reindexObject()
    >>> reset_request(task)
    >>> myprojects = MyProjects(self.portal, TestRequest())
    >>> myprojects.projectlist
    []
