~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2010-08-17 19:20:23 UTC
  • mfrom: (11326.1.11 dont-show-obsolete-junk)
  • Revision ID: launchpad@pqm.canonical.com-20100817192023-92utk3wwg89buejb
[r=bac][ui=none][bug=582618,
        616845] Fixes the related-projects for a team so that only active
        projects &c are shown. Incidentally fixes the branding issues
        with how those projects are shown (i.e. branding wasn't shown before).

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    )
45
45
from lp.testing.matchers import HasQueryCount
46
46
from lp.testing.views import create_initialized_view
 
47
from lp.testing import celebrity_logged_in
47
48
from lp.testing._webservice import QueryCollector
48
49
from lp.registry.interfaces.person import PrivatePersonLinkageError
49
50
from canonical.testing.layers import DatabaseFunctionalLayer, reconnect_stores
71
72
 
72
73
    layer = DatabaseFunctionalLayer
73
74
 
 
75
    def test_getOwnedOrDrivenPillars(self):
 
76
        user = self.factory.makePerson()
 
77
        active_project = self.factory.makeProject(owner=user)
 
78
        inactive_project = self.factory.makeProject(owner=user)
 
79
        with celebrity_logged_in('admin'):
 
80
            inactive_project.active = False
 
81
        expected_pillars = [active_project.name]
 
82
        received_pillars = [pillar.name for pillar in
 
83
            user.getOwnedOrDrivenPillars()]
 
84
        self.assertEqual(expected_pillars, received_pillars)
 
85
 
 
86
 
 
87
class TestPersonStates(TestCaseWithFactory):
 
88
 
 
89
    layer = DatabaseFunctionalLayer
 
90
 
74
91
    def setUp(self):
75
92
        TestCaseWithFactory.setUp(self, 'foo.bar@canonical.com')
76
93
        person_set = getUtility(IPersonSet)
201
218
    def test_person_snapshot(self):
202
219
        omitted = (
203
220
            'activemembers', 'adminmembers', 'allmembers',
204
 
            'all_members_prepopulated',  'approvedmembers',
 
221
            'all_members_prepopulated', 'approvedmembers',
205
222
            'deactivatedmembers', 'expiredmembers', 'inactivemembers',
206
223
            'invited_members', 'member_memberships', 'pendingmembers',
207
224
            'proposedmembers', 'unmapped_participants',
583
600
        self.addCleanup(collector.unregister)
584
601
        url = "/~%s/participants" % team.name
585
602
        logout()
586
 
        response = webservice.get(url, headers={'User-Agent':'AnonNeedsThis'})
 
603
        response = webservice.get(url,
 
604
            headers={'User-Agent': 'AnonNeedsThis'})
587
605
        self.assertEqual(response.status, 200,
588
606
            "Got %d for url %r with response %r" % (
589
607
            response.status, url, response.body))