def test_includes_global_roles(self): setRoles(self.portal, TEST_USER_ID, ['Manager', 'Contributor']) self.assertEquals(['Authenticated', 'user:AuthenticatedUsers', 'user:test_user_1_', 'Manager', 'Anonymous', 'Contributor'], get_roles_and_users())
def test_anonymous_users_get_anonymous_role_only(self): logout() self.assertEquals(['Anonymous'], get_roles_and_users())
def test_always_includes_anonymous(self): john = create(Builder('user')) login(self.portal, john.getId()) self.assertIn('Anonymous', get_roles_and_users())
def test_always_includes_authenticated(self): john = create(Builder('user')) login(self.portal, john.getId()) self.assertIn('Authenticated', get_roles_and_users())
def test_includes_group_ids(self): john = create(Builder('user')) create(Builder('group').titled('Does').with_members(john)) login(self.portal, john.getId()) self.assertIn('user:does', get_roles_and_users())
def test_includes_userid(self): john = create(Builder('user')) login(self.portal, john.getId()) self.assertIn('user:john.doe', get_roles_and_users())
def make_allowed_roles_and_users_query(index=u'allowed_roles_and_users'): return reduce(Or, map(partial(Eq, index), get_roles_and_users()))