~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/database/tests/test_bulk.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-05-23 01:01:39 UTC
  • mfrom: (13092.1.2 bug-784988)
  • Revision ID: launchpad@pqm.canonical.com-20110523010139-fvdcbaq4xjynqnm6
[r=bac][bug=784988] bulk load data for temp-sprint-export and add
        bulk.load_referencing

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    )
22
22
from canonical.testing.layers import DatabaseFunctionalLayer
23
23
from lp.bugs.model.bug import BugAffectsPerson
 
24
from lp.code.model.branchsubscription import BranchSubscription
24
25
from lp.registry.model.person import Person
25
26
from lp.services.database import bulk
26
27
from lp.soyuz.model.component import Component
202
203
        self.assertEqual(expected,
203
204
            set(bulk.load_related(Person, owning_objects, ['ownerID'])))
204
205
 
205
 
 
 
206
    def test_load_referencing(self):
 
207
        owned_objects = [
 
208
            self.factory.makeBranch(),
 
209
            self.factory.makeBranch(),
 
210
            ]
 
211
        expected = set(list(owned_objects[0].subscriptions) + 
 
212
            list(owned_objects[1].subscriptions))
 
213
        self.assertNotEqual(0, len(expected))
 
214
        self.assertEqual(expected,
 
215
            set(bulk.load_referencing(BranchSubscription, owned_objects,
 
216
                ['branchID'])))