Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
GroupUserFolder.tests.testPloneInterface.TestPloneInterface Class Reference

List of all members.

Public Member Functions

def afterSetUp
def testUserCreation
def testGroupCreation
def testUserToGroup
def testUserToGroupRoles
def testUserToGroupRolesBug
def testUserToGroupRemoving

Public Attributes

 qi
 mt
 gt
 acl_users

Detailed Description

Definition at line 99 of file testPloneInterface.py.


Member Function Documentation

Definition at line 101 of file testPloneInterface.py.

00101 
00102     def afterSetUp(self,):
00103         self.loginPortalOwner()
00104         self.qi = self.portal.portal_quickinstaller
00105         self.qi.installProduct('GroupUserFolder')
00106         self.mt = self.portal.portal_membership
00107         self.gt = self.portal.portal_groups
00108         self.acl_users = self.portal.acl_users

Here is the call graph for this function:

test group creation with plone

Definition at line 118 of file testPloneInterface.py.

00118 
00119     def testGroupCreation(self,):
00120         """
00121         test group creation with plone
00122         """
00123         # Group without roles
00124         self.gt.addGroup("group1", roles = ['Member',], )
00125         self.failUnless("group_group1" in self.acl_users.getGroupNames())
00126         self.failUnless("Member" in self.acl_users.getGroup("group_group1").getRoles())
00127 
00128         # Group with valid roles
00129         self.portal._addRole('SampleRole')
00130         self.gt.addGroup("group2", roles = ['SampleRole',], )
00131         self.failUnless("SampleRole" in self.acl_users.getGroup("group_group2").getRoles())
00132         self.failUnless("Member" not in self.acl_users.getGroup("group_group2").getRoles())

test user creation with plone

Definition at line 109 of file testPloneInterface.py.

00109 
00110     def testUserCreation(self,):
00111         """
00112         test user creation with plone
00113         """
00114         # Create a non-group-related user
00115         self.mt.addMember("member1", "secret", ['Member',], None)
00116         self.failUnless("member1" in self.acl_users.getUserNames())
00117         self.failUnless("Member" in self.acl_users.getUser("member1").getRoles())

test user and group interaction with Plone API

Definition at line 133 of file testPloneInterface.py.

00133 
00134     def testUserToGroup(self,):
00135         """
00136         test user and group interaction with Plone API
00137         """
00138         # Add a user and a group with valid roles
00139         self.portal._addRole('SampleRole')
00140         self.gt.addGroup("group2", roles = ['SampleRole',], )
00141         self.mt.addMember("member1", "secret", ['Member',], None)
00142 
00143         # test group affectation
00144         group = self.gt.getGroupById("group2")
00145         group.addMember("member1")
00146         Log(LOG_DEBUG, group.getGroupMemberIds())
00147         self.failUnless("member1" in group.getGroupMemberIds())

Here is the call graph for this function:

Definition at line 181 of file testPloneInterface.py.

00181 
00182     def testUserToGroupRemoving(self,):
00183         # Add a user and a group with valid roles
00184         self.portal._addRole('SampleRole')
00185         self.gt.addGroup("group2", roles = ['SampleRole',], )
00186         self.mt.addMember("member1", "secret", ['Member',], None)
00187         group = self.gt.getGroupById("group2")
00188         group.addMember("member1")
00189 
00190         # Remove user from the group and check if everything still works
00191         group.removeMember("member1")
00192         self.failUnless("member1" not in group.getGroupMembers())
00193         self.failUnless("SampleRole" not in self.acl_users.getUser("member1").getRoles())
00194         self.failUnless("Member" in self.acl_users.getUser("member1").getRoles())
00195 

Definition at line 148 of file testPloneInterface.py.

00148 
00149     def testUserToGroupRoles(self,):
00150         # Add a user and a group with valid roles
00151         self.portal._addRole('SampleRole')
00152         self.gt.addGroup("group2", roles = ['SampleRole',], )
00153         self.mt.addMember("member1", "secret", ['Member',], None)
00154         group = self.gt.getGroupById("group2")
00155         group.addMember("member1")
00156 
00157         # test roles
00158         self.failUnless("SampleRole" in self.acl_users.getUser("member1").getRoles())
00159         self.failUnless("Member" in self.acl_users.getUser("member1").getRoles())
00160 
00161         # Ensure that "group-acquired" role is not affected to the user directly
00162         self.failUnless("SampleRole" not in self.acl_users.getUser("member1").getUserRoles())
00163 

Definition at line 164 of file testPloneInterface.py.

00164 
00165     def testUserToGroupRolesBug(self,):
00166         # Try to reproduce a bug happening when you affect twice the same user
00167         # to the same group: in this case, the user will get group's role affected
00168         # to him directly... which should not happend.
00169         # Add a user and a group with valid roles
00170         self.portal._addRole('SampleRole')
00171         self.gt.addGroup("group2", roles = ['SampleRole',], )
00172         self.mt.addMember("member1", "secret", ['Member',], None)
00173         group = self.gt.getGroupById("group2")
00174         group.addMember("member1")
00175 
00176         # Do it once again
00177         group.addMember("member1")
00178 
00179         # Ensure that "group-acquired" role is not affected to the user directly
00180         self.failIf("SampleRole" in self.acl_users.getUser("member1").getUserRoles())


Member Data Documentation

Definition at line 107 of file testPloneInterface.py.

Definition at line 106 of file testPloneInterface.py.

Definition at line 105 of file testPloneInterface.py.

Definition at line 103 of file testPloneInterface.py.


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