def test_sharing_view_filters_groups(self):
     self.login_as_portal_owner()
     view = SharingView(self.workspace, self.request)
     ids = [group['id'] for group in view.role_settings()]
     self.assertNotIn('AuthenticatedUsers', ids)
     uid = self.workspace.UID()
     self.assertEqual(filter(lambda x: x.endswith(uid), ids), [])
Exemple #2
0
 def test_sharing_view_filters_groups(self):
     self.login_as_portal_owner()
     view = SharingView(self.workspace, self.request)
     ids = [group['id'] for group in view.role_settings()]
     self.assertNotIn('AuthenticatedUsers', ids)
     uid = self.workspace.UID()
     self.assertEqual(filter(lambda x: x.endswith(uid), ids), [])
    def test_acquired_roles_from_policy_settings(self):
        self.login_as_portal_owner()
        policy = "moderators"
        self.workspace.participant_policy = policy
        ws = IWorkspace(self.workspace)
        ws.add_to_team(user=self.user.getUserName())
        roles = ws.available_groups.get(policy.title())
        self.request.form = {'form.button.Search': 'Search',
                             'search_term': 'demo'}
        view = SharingView(self.workspace, self.request)
        results = view.user_search_results()

        self.assertEqual(len(results), 1)
        self.assertTrue(
            all([results[0]["roles"][role] == "acquired" for role in roles]),
            "Acquired roles were not set correctly")
Exemple #4
0
 def test_member_is_not_added_if_user_is_not_a_member(self):
     self.login_as_portal_owner()
     self.request.form = {
         'form.button.Search': 'Search',
         'search_term': 'demo'
     }
     view = SharingView(self.workspace, self.request)
     self.assertNotIn('%s [member]' % (self.user.getUserName(), ), view())
Exemple #5
0
    def test_acquired_roles_from_policy_settings(self):
        self.login_as_portal_owner()
        policy = "moderators"
        self.workspace.participant_policy = policy
        ws = IWorkspace(self.workspace)
        ws.add_to_team(user=self.user.getUserName())
        roles = ws.available_groups.get(policy.title())
        self.request.form = {
            'form.button.Search': 'Search',
            'search_term': 'demo'
        }
        view = SharingView(self.workspace, self.request)
        results = view.user_search_results()

        self.assertEqual(len(results), 1)
        self.assertTrue(
            all([results[0]["roles"][role] == "acquired" for role in roles]),
            "Acquired roles were not set correctly")
Exemple #6
0
 def test_member_is_added_to_user_title_if_user_is_a_member(self):
     self.login_as_portal_owner()
     IWorkspace(self.workspace).add_to_team(user=self.user.getId())
     self.request.form = {
         'form.button.Search': 'Search',
         'search_term': 'demo'
     }
     view = SharingView(self.workspace, self.request)
     self.assertIn('%s [member]' % (self.user.getId(), ), view())
Exemple #7
0
 def test_administrator_is_added_to_administrator(self):
     """ Test that [administrator] is added to the workspace
     administrator """
     self.login_as_portal_owner()
     IWorkspace(self.workspace).add_to_team(user=self.user.getId(),
                                            groups=set(["Admins"]))
     self.request.form = {
         'form.button.Search': 'Search',
         'search_term': 'demo'
     }
     view = SharingView(self.workspace, self.request)
     self.assertIn('%s [administrator]' % (self.user.getId(), ), view())
     self.assertNotIn("%s [member]" % (self.user.getId(), ), view())
 def test_inherit_view_is_not_shown(self):
     self.login_as_portal_owner()
     view = SharingView(self.workspace, self.request)
     self.assertFalse(view.can_edit_inherit())
Exemple #9
0
 def test_inherit_view_is_not_shown(self):
     self.login_as_portal_owner()
     view = SharingView(self.workspace, self.request)
     self.assertFalse(view.can_edit_inherit())