Esempio n. 1
0
    def test_add_workspace_scenarios(self):
        """
        Check configuration if a scenario for policies is given on create
        """
        self.login_as_portal_owner()

        request = self.layer['request'].clone()
        request.form['workspace-type'] = 'secret'
        request.form['title'] = 'scenario-1'
        add_form = AddWorkspace(self.workspace_container, request)
        add_form()
        workspace = getattr(self.workspace_container, 'scenario-1')
        self.assertEqual(workspace.external_visibility, 'secret')
        self.assertEqual(workspace.join_policy, 'admin')
        self.assertEqual(workspace.participant_policy, 'producers')

        request = self.layer['request'].clone()
        request.form['workspace-type'] = 'private'
        request.form['title'] = 'scenario-2'
        add_form = AddWorkspace(self.workspace_container, request)
        add_form()
        workspace = getattr(self.workspace_container, 'scenario-2')
        self.assertEqual(workspace.external_visibility, 'private')
        self.assertEqual(workspace.join_policy, 'team')
        self.assertEqual(workspace.participant_policy, 'moderators')

        request = self.layer['request'].clone()
        request.form['workspace-type'] = 'open'
        request.form['title'] = 'scenario-3'
        add_form = AddWorkspace(self.workspace_container, request)
        add_form()
        workspace = getattr(self.workspace_container, 'scenario-3')
        self.assertEqual(workspace.external_visibility, 'open')
        self.assertEqual(workspace.join_policy, 'self')
        self.assertEqual(workspace.participant_policy, 'publishers')
Esempio n. 2
0
 def test_add_template_via_view(self):
     request = self.layer['request'].clone()
     request.form['workspace-type'] = 'private'
     request.form['title'] = 'my template'
     at = AddWorkspace(self.templates_container, request)
     at()
     self.assertIn('my-template', self.templates_container.objectIds())
     request = self.layer['request'].clone()
     aw = AddWorkspace(self.workspace_container, request)
     self.assertIn('my-template', aw.all_templates_dict)
Esempio n. 3
0
 def test_AddWorkspaceView(self):
     self.login('johndoe')
     request = self.layer['request'].clone()
     request.form['workspace-type'] = 'private'
     request.form['title'] = 'my workspace'
     aw = AddWorkspace(self.workspace_container, request)
     aw()
     self.assertIn('my-workspace', self.workspace_container.objectIds())
 def test_create_workspace_open(self):
     """
     Test creation of a workspace
     """
     # open system. Workspaces folder is open for authenticated
     self.login('noaddrights')
     request = self.layer['request'].clone()
     request.form['workspace-type'] = 'private'
     request.form['title'] = 'everybody can add'
     ac = AddWorkspace(self.open_workspaces, request)
     ac()
     self.assertIn('everybody-can-add',
                   self.open_workspaces.objectIds())
 def test_create_workspace_restricted_nocaccess(self):
     """
     Test creation of a workspace
     """
     self.assertNotIn(
         'Contributor',
         api.user.get_roles(username='******',
                            obj=self.restricted_workspaces)
     )
     self.login('noaddrights')
     request = self.layer['request'].clone()
     request.form['workspace-type'] = 'private'
     request.form['title'] = 'not anyone is permitted'
     ac = AddWorkspace(self.restricted_workspaces, request)
     with self.assertRaises(Unauthorized):
         ac()
     self.logout()
    def test_create_workspace_restricted_contributor(self):
        """
        Test creation of a workspace
        """
        self.assertIn(
            'Contributor',
            api.user.get_roles(username='******',
                               obj=self.restricted_workspaces)
        )
        self.login('hasaddrights')
        request = self.layer['request'].clone()
        request.form['workspace-type'] = 'private'
        request.form['title'] = 'can-add-when-contributor'
        ac = AddWorkspace(self.restricted_workspaces, request)
        ac()
        self.assertIn('can-add-when-contributor',
                      self.restricted_workspaces.objectIds())

        self.logout()
Esempio n. 7
0
 def test_template_nonmember_cannot_see_template_in_menu(self):
     self.login('maryjane')
     request = self.layer['request'].clone()
     aw = AddWorkspace(self.templates_container, request)
     self.assertNotIn('example-template', aw.all_templates_dict)