~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/adapters/tests/test_overrides.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-05-24 11:48:32 UTC
  • mfrom: (13045.15.17 copies-use-overrides)
  • Revision ID: launchpad@pqm.canonical.com-20110524114832-oya6nkj2qd820p4w
[r=julian-edwards,
        wgrant][bug=783249] Add support for generic overrides to the package
        copier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
"""Test generic override policy classes."""
5
5
 
6
6
from testtools.matchers import Equals
 
7
from zope.component import getUtility
7
8
 
8
9
from canonical.database.sqlbase import flush_database_caches
9
10
from canonical.testing.layers import LaunchpadZopelessLayer
14
15
    UnknownOverridePolicy,
15
16
    )
16
17
from lp.soyuz.enums import PackagePublishingStatus
 
18
from lp.soyuz.interfaces.component import IComponentSet
17
19
from lp.testing import (
18
20
    StormStatementRecorder,
19
21
    TestCaseWithFactory,
149
151
        overrides = policy.calculateSourceOverrides(
150
152
            spph.distroseries.main_archive, spph.distroseries, spph.pocket,
151
153
            (spph.sourcepackagerelease.sourcepackagename,))
152
 
        expected = [(spph.sourcepackagerelease.sourcepackagename, 'universe',
 
154
        universe = getUtility(IComponentSet)['universe']
 
155
        expected = [(spph.sourcepackagerelease.sourcepackagename, universe,
153
156
            None)]
154
157
        self.assertEqual(expected, overrides)
155
158
 
163
166
        overrides = policy.calculateBinaryOverrides(
164
167
            distroseries.main_archive, distroseries, bpph.pocket,
165
168
            ((bpph.binarypackagerelease.binarypackagename, None),))
 
169
        universe = getUtility(IComponentSet)['universe']
166
170
        expected = [(bpph.binarypackagerelease.binarypackagename,
167
 
            bpph.distroarchseries, 'universe', None, None)]
 
171
            bpph.distroarchseries, universe, None, None)]
168
172
        self.assertEqual(expected, overrides)
169
173
 
170
174
    def test_ubuntu_override_policy_sources(self):
171
175
        # The Ubuntu policy incorporates both the existing and the unknown
172
176
        # policy.
 
177
        universe = getUtility(IComponentSet)['universe']
173
178
        spns = [self.factory.makeSourcePackageName()]
174
 
        expected = [(spns[0], 'universe', None)]
 
179
        expected = [(spns[0], universe, None)]
175
180
        distroseries = self.factory.makeDistroSeries()
176
181
        pocket = self.factory.getAnyPocket()
177
182
        for i in xrange(8):
183
188
                spph.sourcepackagerelease.sourcepackagename, spph.component,
184
189
                spph.section))
185
190
        spns.append(self.factory.makeSourcePackageName())
186
 
        expected.append((spns[-1], 'universe', None))
 
191
        expected.append((spns[-1], universe, None))
187
192
        policy = UbuntuOverridePolicy()
188
193
        overrides = policy.calculateSourceOverrides(
189
194
            distroseries.main_archive, distroseries, pocket, spns)
193
198
    def test_ubuntu_override_policy_binaries(self):
194
199
        # The Ubuntu policy incorporates both the existing and the unknown
195
200
        # policy.
 
201
        universe = getUtility(IComponentSet)['universe']
196
202
        distroseries = self.factory.makeDistroSeries()
197
203
        pocket = self.factory.getAnyPocket()
198
204
        bpn = self.factory.makeBinaryPackageName()
214
220
            distroarchseries = self.factory.makeDistroArchSeries(
215
221
                distroseries=distroseries)
216
222
            bpns.append((bpn, distroarchseries.architecturetag))
217
 
            expected.append((bpn, distroarchseries, 'universe', None, None))
 
223
            expected.append((bpn, distroarchseries, universe, None, None))
218
224
        distroseries.nominatedarchindep = distroarchseries
219
225
        policy = UbuntuOverridePolicy()
220
226
        overrides = policy.calculateBinaryOverrides(