~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/tests/test_person.py

  • Committer: Curtis Hovey
  • Date: 2012-01-06 01:03:46 UTC
  • mto: This revision was merged to the branch mainline in revision 14651.
  • Revision ID: curtis.hovey@canonical.com-20120106010346-moe23t29oj0x1bo0
Use _teamPrivacyQuery to filter out non-visible teams.

Show diffs side-by-side

added added

removed removed

Lines of Context:
808
808
        result = self.person_set.latest_teams()
809
809
        self.assertEqual(teams[0:5], list(result))
810
810
 
 
811
    def test_latest_teams_private(self):
 
812
        # Private teams are only included in the latest teams if the
 
813
        # user can view the team.
 
814
        teams = []
 
815
        for num in xrange(1, 7):
 
816
            teams.append(self.factory.makeTeam(name='team-%s' % num))
 
817
        owner = self.factory.makePerson()
 
818
        teams.append(
 
819
            self.factory.makeTeam(
 
820
                name='private-team', owner=owner,
 
821
                visibility=PersonVisibility.PRIVATE))
 
822
        teams.reverse()
 
823
        login_person(owner)
 
824
        result = self.person_set.latest_teams()
 
825
        self.assertEqual(teams[0:5], list(result))
 
826
        login_person(self.factory.makePerson())
 
827
        result = self.person_set.latest_teams()
 
828
        self.assertEqual(teams[1:6], list(result))
 
829
 
811
830
    def test_latest_teams_limit(self):
812
831
        # The limit controls the number of latest teams returned.
813
832
        teams = []