~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-05 15:13:36 UTC
  • mfrom: (14099.1.9 dsp-vocab-ui)
  • Revision ID: launchpad@pqm.canonical.com-20111005151336-ugusa8kmp5piup6q
[r=stevenk][bug=867718, 826516] Speed up the DSP vocab,
 support official package branches, add ranking, and cleanup the picker UI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        dsp = naked_distribution.getSourcePackage(name='pmount')
43
43
        self.assertEqual(None, dsp.summary)
44
44
 
 
45
    def test_binary_names_built(self):
 
46
        # The list contains the names of the built binaries.
 
47
        bpph = self.factory.makeBinaryPackagePublishingHistory()
 
48
        distribution = bpph.distroarchseries.distroseries.distribution
 
49
        spn = bpph.binarypackagerelease.build.source_package_release.name
 
50
        dsp = distribution.getSourcePackage(spn)
 
51
        self.assertEqual([bpph.binarypackagerelease.name], dsp.binary_names)
 
52
 
 
53
    def test_binary_names_unbuilt(self):
 
54
        # The list is empty where there are no built binaries.
 
55
        dsp = self.factory.makeDistributionSourcePackage(with_db=True)
 
56
        self.assertEqual([], dsp.binary_names)
 
57
 
45
58
    def test_ensure_spph_creates_a_dsp_in_db(self):
46
59
        # The DSP.ensure() class method creates a persistent instance
47
60
        # if one does not exist.
115
128
        dsp = sp.distribution_sourcepackage
116
129
        self.assertTrue(dsp.delete())
117
130
 
 
131
    def test_is_official_with_db_true(self):
 
132
        # A DSP is official when it is represented in the database.
 
133
        dsp = self.factory.makeDistributionSourcePackage(with_db=True)
 
134
        self.assertTrue(dsp.is_official)
 
135
 
 
136
    def test_is_official_without_db_false(self):
 
137
        # A DSP is not official if it is virtual.
 
138
        dsp = self.factory.makeDistributionSourcePackage(with_db=False)
 
139
        self.assertFalse(dsp.is_official)
 
140
 
118
141
 
119
142
class TestDistributionSourcePackageFindRelatedArchives(TestCaseWithFactory):
120
143