Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testGroupsTool.TestGroupWorkspacesFolder Class Reference
Inheritance diagram for CMFPlone.tests.testGroupsTool.TestGroupWorkspacesFolder:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testGroupsTool.TestGroupWorkspacesFolder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testGetGroupWorkspacesFolder
def testCreateGrouparea
def testNotCreateGrouparea
def testCreateGroupareaCreatesGroupWorkspacesFolder
def testCreateGroupareaIndexesGroupWorkspacesFolder
def testAddGroupCreatesGrouparea
def testGetGroupareaFolder
def testGetGroupareaURL
def testGetGroupareaFolderPermission
def testAddGroup
def testAddGroupWithWorkspace
def testRemoveGroups
def testRemoveGroupsWithWorkspace
def testRemoveGroupsKeepingWorkspaces
def beforeTearDown
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 membership
 acl_users
 groups

Detailed Description

Definition at line 157 of file testGroupsTool.py.


Member Function Documentation

Definition at line 159 of file testGroupsTool.py.

00159 
00160     def afterSetUp(self):
00161         self.membership = self.portal.portal_membership
00162         self.acl_users = self.portal.acl_users
00163         self.groups = self.portal.portal_groups
00164         self.groups.groupWorkspacesCreationFlag = 0
00165         self._trap_warning_output()
00166 
00167         if 'auto_group' in self.acl_users.objectIds():
00168             self.acl_users.manage_delObjects(['auto_group'])
00169         # Note that this is not a proper portal type (anymore) but we don't care
00170         self.portal.manage_addPortalFolder(self.groups.getGroupWorkspacesFolderId())
00171 
00172         # Nuke Administators and Reviewers groups added in 2.1a2 migrations
00173         # (and any other migrated-in groups) to avoid test confusion
00174         self.groups.removeGroups(self.groups.listGroupIds())

Definition at line 277 of file testGroupsTool.py.

00277 
00278     def beforeTearDown(self):
00279         self._free_warning_output()
00280 

Here is the call graph for this function:

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 243 of file testGroupsTool.py.

00243 
00244     def testAddGroup(self):
00245         self.groups.addGroup('foo', [], [])
00246         self.assertEqual(self.groups.listGroupIds(), ['foo'])
00247         # No group workspace should have been created
00248         self.failIf(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Definition at line 213 of file testGroupsTool.py.

00213 
00214     def testAddGroupCreatesGrouparea(self):
00215         self.groups.toggleGroupWorkspacesCreation()
00216         self.groups.addGroup('foo', [], [])
00217         self.failUnless(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Definition at line 249 of file testGroupsTool.py.

00249 
00250     def testAddGroupWithWorkspace(self):
00251         self.groups.toggleGroupWorkspacesCreation()
00252         self.groups.addGroup('foo', [], [])
00253         self.assertEqual(self.groups.listGroupIds(), ['foo'])
00254         # A group workspace should have been created
00255         self.failUnless(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Definition at line 178 of file testGroupsTool.py.

00178 
00179     def testCreateGrouparea(self):
00180         self.groups.addGroup('foo', [], [])
00181         self.groups.toggleGroupWorkspacesCreation()
00182         # TODO: Requires typestool
00183         self.groups.createGrouparea('foo')
00184         self.failUnless(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Definition at line 191 of file testGroupsTool.py.

00191 
00192     def testCreateGroupareaCreatesGroupWorkspacesFolder(self):
00193         self.groups.addGroup('foo', [], [])
00194         self.groups.toggleGroupWorkspacesCreation()
00195         self.portal._delObject(self.groups.getGroupWorkspacesFolderId())
00196         # TODO: Members cannot create folders in the portal root
00197         self.setRoles(['Manager'])
00198         self.groups.createGrouparea('foo')
00199         self.failUnless(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Here is the call graph for this function:

Definition at line 200 of file testGroupsTool.py.

00200 
00201     def testCreateGroupareaIndexesGroupWorkspacesFolder(self):
00202         self.groups.addGroup('foo', [], [])
00203         self.groups.toggleGroupWorkspacesCreation()
00204         self.portal._delObject(self.groups.getGroupWorkspacesFolderId())
00205         # XXX: Members cannot create folders in the portal root
00206         self.setRoles(['Manager'])
00207         self.groups.createGrouparea('foo')
00208         cat_results = self.portal.portal_catalog(getId =
00209                                      self.groups.getGroupWorkspacesFolderId())
00210         self.assertEqual(len(cat_results), 1)
00211         self.assertEqual(cat_results[0].getObject(),
00212                                        self.groups.getGroupWorkspacesFolder())

Here is the call graph for this function:

Definition at line 218 of file testGroupsTool.py.

00218 
00219     def testGetGroupareaFolder(self):
00220         self.groups.toggleGroupWorkspacesCreation()
00221         self.groups.addGroup('foo', [], [])
00222         self.failIfEqual(self.groups.getGroupareaFolder('foo'), None)

Definition at line 228 of file testGroupsTool.py.

00228 
00229     def testGetGroupareaFolderPermission(self):
00230         self.groups.toggleGroupWorkspacesCreation()
00231         self.groups.addGroup('foo', [], [])
00232         self.acl_users.userSetGroups(default_user, groupnames=['foo'])
00233         user = self.acl_users.getUser(default_user)
00234         self.failUnless(user.has_permission('View Groups', self.groups.getGroupWorkspacesFolder()))

Definition at line 223 of file testGroupsTool.py.

00223 
00224     def testGetGroupareaURL(self):
00225         self.groups.toggleGroupWorkspacesCreation()
00226         self.groups.addGroup('foo', [], [])
00227         self.failIfEqual(self.groups.getGroupareaURL('foo'), None)

Definition at line 175 of file testGroupsTool.py.

00175 
00176     def testGetGroupWorkspacesFolder(self):
00177         self.failIfEqual(self.groups.getGroupWorkspacesFolder(), None)

Definition at line 185 of file testGroupsTool.py.

00185 
00186     def testNotCreateGrouparea(self):
00187         self.groups.addGroup('foo', [], [])
00188         # Creation flag is False
00189         self.groups.createGrouparea('foo')
00190         self.failIf(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Definition at line 256 of file testGroupsTool.py.

00256 
00257     def testRemoveGroups(self):
00258         self.groups.addGroup('foo', [], [])
00259         self.groups.removeGroups(['foo'])
00260         self.assertEqual(len(self.groups.listGroupIds()), 0)

Definition at line 269 of file testGroupsTool.py.

00269 
00270     def testRemoveGroupsKeepingWorkspaces(self):
00271         self.groups.toggleGroupWorkspacesCreation()
00272         self.groups.addGroup('foo', [], [])
00273         self.groups.removeGroups(['foo'], keep_workspaces=1)
00274         self.assertEqual(len(self.groups.listGroupIds()), 0)
00275         # Group workspace should still be present
00276         self.failUnless(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))

Definition at line 261 of file testGroupsTool.py.

00261 
00262     def testRemoveGroupsWithWorkspace(self):
00263         self.groups.toggleGroupWorkspacesCreation()
00264         self.groups.addGroup('foo', [], [])
00265         self.groups.removeGroups(['foo'])
00266         self.assertEqual(len(self.groups.listGroupIds()), 0)
00267         # Group workspace should have been removed
00268         self.failIf(hasattr(aq_base(self.groups.getGroupWorkspacesFolder()), 'foo'))


Member Data Documentation

Definition at line 161 of file testGroupsTool.py.

Definition at line 162 of file testGroupsTool.py.

Definition at line 160 of file testGroupsTool.py.


The documentation for this class was generated from the following file: