Back to index

plone3  3.1.7
Classes | Functions | Variables
GroupUserFolder.tests.GRUFTestCase Namespace Reference

Classes

class  ManagementOpener
class  UnauthorizedOpener
class  GRUFTestCase

Functions

def Log
def security_context_setup_groups
 self.gruf.userFolderAddUser('u12', 'secret', (), (), ('ng5', 'ng6', ), )
def afterSetUp
 self.gruf.userFolderAddGroup('ng6', (), ('ng5', 'ng6', ))
def beforeClose
 

Need to commit so the ZServer threads see what we've done

get_transaction().commit()
def delete_created_users
 

Commit after cleanup

get_transaction().commit()
def compareRoles
def compareGroups

Variables

string __version__ = "$Revision: $"
 GroupUserFolder Copyright (C)2006 Ingeniweb.
string __docformat__ = 'restructuredtext'
 LOG_DEBUG = None
 LOG_NOTICE = None
 LOG_WARNING = None
 LOG_ERROR = None
 LOG_CRITICAL = None

Function Documentation

self.gruf.userFolderAddGroup('ng6', (), ('ng5', 'ng6', ))

afterSetUp(self) => This method is called to create Folder with a GRUF inside.

Definition at line 290 of file GRUFTestCase.py.

00290 
00291     def afterSetUp(self,):
00292         """
00293         afterSetUp(self) => This method is called to create Folder with a GRUF inside.
00294         """
00295         self.gruf_setup()
00296         self.gruf_sources_setup()
        self.security_context_setup()

Need to commit so the ZServer threads see what we've done

get_transaction().commit()

Definition at line 302 of file GRUFTestCase.py.

00302 
    def beforeClose(self):
def GroupUserFolder.tests.GRUFTestCase.compareGroups (   self,
  user,
  groups 
)
compareGroups(self, user, groups) => do not raise if user has exactly the specified groups.

Definition at line 362 of file GRUFTestCase.py.

00362 
00363     def compareGroups(self, user, groups):
00364         """
00365         compareGroups(self, user, groups) => do not raise if user has exactly the specified groups.
00366         """
00367         u = self.gruf.getUser(user)
00368         if not u:
00369             raise RuntimeError, "compareGroups: Invalid user: '%s'" % user
00370         actual_groups = list(u.getGroups())
00371         actual_groups.sort()
00372         wished_groups = map(lambda x: "group_%s" % x, list(groups))
00373         wished_groups.sort()
00374         if actual_groups == wished_groups:
00375             return 1
00376         raise RuntimeError, "User %s: Whished groups: %s BUT current groups: %s" % (user, wished_groups, actual_groups)
00377 
00378 
def GroupUserFolder.tests.GRUFTestCase.compareRoles (   self,
  target,
  user,
  roles 
)
compareRoles(self, target, user, roles) => do not raise if user has exactly the specified roles.
If target is None, test user roles (no local roles)

Definition at line 342 of file GRUFTestCase.py.

00342 
00343     def compareRoles(self, target, user, roles):
00344         """
00345         compareRoles(self, target, user, roles) => do not raise if user has exactly the specified roles.
00346         If target is None, test user roles (no local roles)
00347         """
00348         u = self.gruf.getUser(user)
00349         if not u:
00350             raise RuntimeError, "compareRoles: Invalid user: '%s'" % user
00351         if target is None:
00352             actual_roles = filter(lambda x: x not in ('Authenticated', 'Anonymous', ''), list(u.getRoles()))
00353         else:
00354             actual_roles = filter(lambda x: x not in ('Authenticated', 'Anonymous', ''), list(u.getRolesInContext(target)))
00355         actual_roles.sort()
00356         wished_roles = list(roles)
00357         wished_roles.sort()
00358         if actual_roles == wished_roles:
00359             return 1
00360         raise RuntimeError, "User %s: Whished roles: %s BUT current roles: %s" % (user, wished_roles, actual_roles)
00361 

Commit after cleanup

get_transaction().commit()

Definition at line 309 of file GRUFTestCase.py.

00309 
00310     def delete_created_users(self,):
00311         self.gruf.userFolderDelUsers([
00312             "manager",
00313             "u1",
00314             "u2",
00315             "u3",
00316             "u4",
00317             "u5",
00318             "u6",
00319             "u7",
00320             "u8",
00321             "u9",
00322             "u10",
00323             "u11",
00324             "created_user",
00325             "test_prefix",
00326             "group_test_prefix",
00327             ])
00328         self.gruf.userFolderDelGroups([
00329             "g1",
00330             "g2",
00331             "g3",
00332             "g4",
00333             "ng1",
00334             "ng2",
00335             "ng3",
00336             "ng4",
00337             "ng5",
00338             "extranet",
00339             "intranet",
00340             "compta",
00341             ])

def GroupUserFolder.tests.GRUFTestCase.Log (   args,
  kw 
)

Definition at line 69 of file GRUFTestCase.py.

00069 
00070     def Log(*args, **kw):
        pass

self.gruf.userFolderAddUser('u12', 'secret', (), (), ('ng5', 'ng6', ), )

Definition at line 268 of file GRUFTestCase.py.

00268 
00269     def security_context_setup_groups(self,):
00270         "create groups. We splitted to allow LDAP tests to override this"
00271         # Create a few groups
00272         self.gruf.userFolderAddGroup('g1', ())
00273         self.gruf.userFolderAddGroup('g2', ('r1', ))
00274         self.gruf.userFolderAddGroup('g3', ('r2', ))
00275         self.gruf.userFolderAddGroup('g4', ('r2', 'r3', ))
00276 
00277         # Create nested groups
00278         self.gruf.userFolderAddGroup('ng1', (), ('g1', ))
00279         self.gruf.userFolderAddGroup('ng2', (), ('g2', 'g3', ))
00280         self.gruf.userFolderAddGroup('ng3', (), ('g2', 'ng2', ))
00281         self.gruf.userFolderAddGroup('ng4', ('r3', ), ('g2', 'ng2', ))
        self.gruf.userFolderAddGroup('ng5', (), ('g2', 'ng4', ))

Variable Documentation

Definition at line 24 of file GRUFTestCase.py.

GroupUserFolder Copyright (C)2006 Ingeniweb.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Definition at line 21 of file GRUFTestCase.py.

Definition at line 68 of file GRUFTestCase.py.

Definition at line 64 of file GRUFTestCase.py.

Definition at line 67 of file GRUFTestCase.py.

Definition at line 65 of file GRUFTestCase.py.

Definition at line 66 of file GRUFTestCase.py.