示例#1
0
 def testGetUsers(self):
     userids = sortTuple(self.portal.acl_users.pmm.getUserIds())
     correct = sortTuple(
         (IMembraneUserAuth(self.member).getUserId(),
          IMembraneUserAuth(self.member2).getUserId())
     )
     self.failUnlessEqual(userids, correct)
    def testGetGroupIds(self):
        self.addGroup(self.portal)
        groupids = self.portal.pmm.getGroupIds()
        self.failUnlessEqual(groupids, (self.group.getGroupId(),))

        group2 = _createObjectByType('TestGroup', self.portal, 'testgroup2')
        group2.setTitle('Test group 2')
        group2.reindexObject()
        groupids = self.portal.pmm.getGroupIds()
        self.failUnlessEqual(sortTuple(groupids),
                             sortTuple((self.group.getGroupId(),
                                        group2.getGroupId())))
 def testGroupMembership(self):
     group = self.portal.testgroup
     member = group.testuser  # We need acquisition to be correct
     mem_auth = IMembraneUserAuth(member)
     mem_grps = IMembraneUserGroups(member)
     member2 = self.member2
     mem2_auth = IMembraneUserAuth(member2)
     mem2_grps = IMembraneUserGroups(member2)
     self.failUnlessEqual(group.getGroupMembers(),
                          (mem_auth.getUserId(),))
     self.failUnlessEqual(mem_grps.getGroupsForPrincipal(mem_grps),
                          (group.getId(),))
     self.group.setMembers([member2.UID()])
     self.failUnlessEqual(sortTuple(group.getGroupMembers()),
                          sortTuple([mem2_auth.getUserId(),
                                     mem_auth.getUserId()]))
     self.failUnlessEqual(
         mem2_grps.getGroupsForPrincipal(mem2_grps), (group.getId(),))
示例#4
0
 def getUserNames(self):
     usernames = sortTuple(self.portal.pmm.getUserIds())
     self.failUnlessEqual(userids,
                          sortTuple((self.member.getUserName(),
                                     self.member2.getUserName())))