Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testGetGroup
def testGetTool
def testGetGroupMembers
def testGroupMembersAreWrapped
def testAddMember
def testRemoveMember
def testSetGroupProperties
def testSetMemberProperties
def testGetProperty
def testGetGroupName
def testGetGroupId
def testGetRoles
def testGetRolesInContext
def testGetDomains
def testHasRole
def beforeTearDown
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 membership
 memberdata
 acl_users
 groups
 groupdata

Detailed Description

Definition at line 41 of file testGroupDataTool.py.


Member Function Documentation

Definition at line 43 of file testGroupDataTool.py.

00043 
00044     def afterSetUp(self):
00045         self.membership = self.portal.portal_membership
00046         self.memberdata = self.portal.portal_memberdata
00047         self.acl_users = self.portal.acl_users
00048         self.groups = self.portal.portal_groups
00049         self.groupdata = self.portal.portal_groupdata
00050         self.groups.groupWorkspacesCreationFlag = 0
00051         self.groups.addGroup('foo')
00052         if 'auto_group' in self.acl_users.objectIds():
00053             self.acl_users.manage_delObjects(['auto_group'])
00054         # MUST reset _v_ attributes!
00055         self.memberdata._v_temps = None
00056         self.groupdata._v_temps = None
00057         self._trap_warning_output()

Definition at line 157 of file testGroupDataTool.py.

00157 
00158     def beforeTearDown(self):
00159         self._free_warning_output()
00160 

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 81 of file testGroupDataTool.py.

00081 
00082     def testAddMember(self):
00083         self.setPermissions([Permissions.manage_users])
00084         g = self.groups.getGroupById('foo')
00085         g.addMember(default_user)
00086         self.assertEqual(g.getGroupMembers()[0].getId(), default_user)

Here is the call graph for this function:

Definition at line 147 of file testGroupDataTool.py.

00147 
00148     def testGetDomains(self):
00149         g = self.groups.getGroupById('foo')
00150         self.assertEqual(g.getDomains(), ())

Definition at line 58 of file testGroupDataTool.py.

00058 
00059     def testGetGroup(self):
00060         g = self.groups.getGroupById('foo')
00061         self.assertEqual(g.__class__.__name__, 'GroupData')
00062         g = g.getGroup()
00063         self.assertEqual(g.__class__.__name__, 'PloneGroup')

Definition at line 124 of file testGroupDataTool.py.

00124 
00125     def testGetGroupId(self):
00126         g = self.groups.getGroupById('foo')
00127         # This changed in GRUF3
00128         #self.assertEqual(g.getGroupId(), 'foo')
00129         self.assertEqual(g.getGroupId(), 'foo')

Definition at line 68 of file testGroupDataTool.py.

00068 
00069     def testGetGroupMembers(self):
00070         g = self.groups.getGroupById('foo')
00071         self.acl_users.userSetGroups(default_user, groupnames=['foo'])
00072         self.assertEqual(g.getGroupMembers()[0].getId(), default_user)

Definition at line 120 of file testGroupDataTool.py.

00120 
00121     def testGetGroupName(self):
00122         g = self.groups.getGroupById('foo')
00123         self.assertEqual(g.getGroupName(), 'foo')

Definition at line 114 of file testGroupDataTool.py.

00114 
00115     def testGetProperty(self):
00116         g = self.groups.getGroupById('foo')
00117         g.setGroupProperties({'email': 'foo@bar.com'})
00118         self.assertEqual(g.getProperty('email'), 'foo@bar.com')
00119         self.assertEqual(g.getProperty('id'), 'foo')

Definition at line 130 of file testGroupDataTool.py.

00130 
00131     def testGetRoles(self):
00132         g = self.groups.getGroupById('foo')
00133         self.assertEqual(tuple(g.getRoles()), ('Authenticated',))
00134         self.groups.editGroup(g.getId(), roles=['Member'])
00135         g = self.groups.getGroupById('foo')
00136         self.assertEqual(sortTuple(tuple(g.getRoles())), ('Authenticated', 'Member'))

Here is the call graph for this function:

Definition at line 137 of file testGroupDataTool.py.

00137 
00138     def testGetRolesInContext(self):
00139         g = self.groups.getGroupById('foo')
00140         self.acl_users.userSetGroups(default_user, groupnames=['foo'])
00141         user = self.acl_users.getUser(default_user)
00142         self.assertEqual(user.getRolesInContext(self.folder).sort(),
00143                         ['Member', 'Authenticated', 'Owner'].sort())
00144         self.folder.manage_setLocalRoles(g.getId(), ['NewRole'])
00145         self.assertEqual(user.getRolesInContext(self.folder).sort(), 
00146                         ['Member', 'Authenticated', 'Owner', 'NewRole'].sort())

Here is the call graph for this function:

Definition at line 64 of file testGroupDataTool.py.

00064 
00065     def testGetTool(self):
00066         g = self.groups.getGroupById('foo')
00067         self.assertEqual(g.getTool().getId(), 'portal_groupdata')

Definition at line 73 of file testGroupDataTool.py.

00073 
00074     def testGroupMembersAreWrapped(self):
00075         g = self.groups.getGroupById('foo')
00076         self.acl_users.userSetGroups(default_user, groupnames=['foo'])
00077         ms = g.getGroupMembers()
00078         self.assertEqual(ms[0].__class__.__name__, 'MemberData')
00079         self.assertEqual(ms[0].aq_parent.__class__.__name__, 'PloneUser')
00080         self.assertEqual(ms[0].aq_parent.aq_parent.__class__.__name__, 'PluggableAuthService')

Definition at line 151 of file testGroupDataTool.py.

00151 
00152     def testHasRole(self):
00153         g = self.groups.getGroupById('foo')
00154         self.groups.editGroup(g.getId(), roles=['Member'])
00155         g = self.groups.getGroupById('foo')
00156         self.failUnless(g.has_role('Member'))

Definition at line 87 of file testGroupDataTool.py.

00087 
00088     def testRemoveMember(self):
00089         self.setPermissions([Permissions.manage_users])
00090         g = self.groups.getGroupById('foo')
00091         g.addMember(default_user)
00092         g.removeMember(default_user)
00093         self.assertEqual(len(g.getGroupMembers()), 0)

Here is the call graph for this function:

Definition at line 101 of file testGroupDataTool.py.

00101 
00102     def testSetGroupProperties(self):
00103         g = self.groups.getGroupById('foo')
00104         g.setGroupProperties({'email': 'foo@bar.com'})
00105         gd = self.groups.getGroupById('foo')
00106         self.assertEqual(gd.getProperty('email'), 'foo@bar.com')

Definition at line 107 of file testGroupDataTool.py.

00107 
00108     def testSetMemberProperties(self):
00109         # For reference
00110         m = self.membership.getMemberById(default_user)
00111         m.setMemberProperties({'email': 'foo@bar.com'})
00112         md = self.membership.getMemberById(default_user)
00113         self.assertEqual(md.getProperty('email'), 'foo@bar.com')


Member Data Documentation

Definition at line 46 of file testGroupDataTool.py.

Definition at line 48 of file testGroupDataTool.py.

Definition at line 47 of file testGroupDataTool.py.

Definition at line 45 of file testGroupDataTool.py.

Definition at line 44 of file testGroupDataTool.py.


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