def test_with_members(self): self.expect(self.gtool.getGroupMembers(ANY)).result( ['fullname', 'no_fullname', 'admin']) # No member, just id self.expect(self.mtool.getMemberById('admin')).result(None) #We need to return something here, because otherwise this would be handled as broken user. self.expect(self.mtool.getMemberInfo(ANY)).result('Lorem') # Member with fullname self.expect( self.mtool.getMemberById('fullname')).result(self.member_1) # Member without fullname self.expect(self.mtool.getMemberById( 'no_fullname')).result(self.member_2) self.replay() gm = GroupMembership(self.context, self.request) result = gm.get_users('group_id') # Sorted list with userids self.assertEquals(result, ['fullname', 'no_fullname', 'admin'])
def test_no_members(self): self.expect(self.gtool.getGroupMembers(ANY)).result([]) self.replay() gm = GroupMembership(self.context, self.request) result = gm.get_users('no_group') # No users self.assertEquals(result, [])