Пример #1
0
 def test_project_for(self):
     from collective.teamwork.utils import project_for
     path = 'project1/team1/stuff'
     content = self.portal.unrestrictedTraverse(path)
     project_expected = self.portal['project1']
     assert self.same(project_for(content), project_expected)
     assert self.same(IProjectContext(content), project_expected)
Пример #2
0
    def test_project_for(self):
        from collective.teamwork.utils import project_for

        path = "project1/team1/stuff"
        content = self.portal.unrestrictedTraverse(path)
        project_expected = self.portal["project1"]
        assert self.same(project_for(content), project_expected)
        assert self.same(IProjectContext(content), project_expected)
Пример #3
0
 def test_utility_view(self):
     from collective.teamwork.utils import make_request
     from collective.teamwork.utils import WorkspaceUtilityView
     from collective.teamwork.utils import workspace_for, project_for
     request = make_request()
     path = 'project1/team1/stuff'
     content = self.portal.unrestrictedTraverse(path)
     view = WorkspaceUtilityView(content, request)
     assert isinstance(view(), str)  # calling returns string label
     assert self.same(view.workspace(), workspace_for(content))
     assert self.same(view.workspace(), IWorkspaceContext(content))
     assert self.same(view.project(), project_for(content))
     assert self.same(view.project(), IProjectContext(content))
Пример #4
0
    def test_utility_view(self):
        from collective.teamwork.utils import make_request
        from collective.teamwork.utils import WorkspaceUtilityView
        from collective.teamwork.utils import workspace_for, project_for

        request = make_request()
        path = "project1/team1/stuff"
        content = self.portal.unrestrictedTraverse(path)
        view = WorkspaceUtilityView(content, request)
        assert isinstance(view(), str)  # calling returns string label
        assert self.same(view.workspace(), workspace_for(content))
        assert self.same(view.workspace(), IWorkspaceContext(content))
        assert self.same(view.project(), project_for(content))
        assert self.same(view.project(), IProjectContext(content))