~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/tests/test_copypackage.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-19 00:39:30 UTC
  • mfrom: (13726 devel)
  • mto: This revision was merged to the branch mainline in revision 13941.
  • Revision ID: jelmer@canonical.com-20110819003930-b6g3xt83zzas8b3q
MergeĀ lp:launchpad.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
    )
90
90
from lp.testing.mail_helpers import pop_notifications
91
91
from lp.testing.matchers import HasQueryCount
92
 
from lp.testing.sampledata import ADMIN_EMAIL
93
92
 
94
93
 
95
94
class ReUploadFileTestCase(TestCaseWithFactory):
1403
1402
            [source], target_archive, dsp.derived_series, source.pocket,
1404
1403
            check_permissions=False, overrides=[override])
1405
1404
 
1406
 
        matcher = MatchesStructure(
1407
 
            component=Equals(override.component),
1408
 
            section=Equals(override.section))
 
1405
        matcher = MatchesStructure.byEquality(
 
1406
            component=override.component,
 
1407
            section=override.section)
1409
1408
        self.assertThat(copied_source, matcher)
1410
1409
 
1411
1410
    def test_copy_ppa_generates_notification(self):
1443
1442
        nobby = self.createNobby(('i386', 'hppa'))
1444
1443
        getUtility(ISourcePackageFormatSelectionSet).add(
1445
1444
            nobby, SourcePackageFormat.FORMAT_1_0)
1446
 
        admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
1447
1445
        nobby.changeslist = 'nobby-changes@example.com'
1448
1446
        [copied_source] = do_copy(
1449
1447
            [source], archive, nobby, source.pocket, False,
1666
1664
            'foocomm', '0.9', component='multiverse',
1667
1665
            archive=self.copy_archive,
1668
1666
            status=PackagePublishingStatus.PUBLISHED)
1669
 
        ancestor_bins = self.test_publisher.getPubBinaries(
 
1667
        self.test_publisher.getPubBinaries(
1670
1668
            binaryname='foo-bin', archive=self.copy_archive,
1671
1669
            status=PackagePublishingStatus.PUBLISHED, pub_source=ancestor)
1672
1670
        self.layer.txn.commit()
1991
1989
            pocket=PackagePublishingPocket.RELEASE,
1992
1990
            status=PackagePublishingStatus.PUBLISHED)
1993
1991
 
1994
 
        noise_source = test_publisher.getPubSource(
 
1992
        test_publisher.getPubSource(
1995
1993
            sourcename='firefox-3.0', version='1.2',
1996
1994
            archive=ubuntu.main_archive, distroseries=hoary,
1997
1995
            pocket=PackagePublishingPocket.UPDATES,
2149
2147
        ppa_source = test_publisher.getPubSource(
2150
2148
            archive=cprov.archive, version='1.0', distroseries=hoary,
2151
2149
            status=PackagePublishingStatus.PUBLISHED)
2152
 
        ppa_binaries = test_publisher.getPubBinaries(
 
2150
        test_publisher.getPubBinaries(
2153
2151
            pub_source=ppa_source, distroseries=hoary,
2154
2152
            status=PackagePublishingStatus.PUBLISHED)
2155
2153
        # Commit to ensure librarian files are written.
2190
2188
            sourcename='boing', version='1.0',
2191
2189
            archive=cprov.archive, distroseries=hoary,
2192
2190
            status=PackagePublishingStatus.PENDING)
2193
 
        ppa_binaries = test_publisher.getPubBinaries(
 
2191
        test_publisher.getPubBinaries(
2194
2192
            pub_source=ppa_source, distroseries=hoary,
2195
2193
            status=PackagePublishingStatus.PENDING)
2196
2194
        # Commit to ensure librarian files are written.
2244
2242
            sourcename='boing', version='1.0', distroseries=warty,
2245
2243
            architecturehintlist=architecturehintlist,
2246
2244
            status=PackagePublishingStatus.PUBLISHED)
2247
 
        ppa_binaries = test_publisher.getPubBinaries(
 
2245
        test_publisher.getPubBinaries(
2248
2246
            pub_source=ppa_source, distroseries=warty,
2249
2247
            status=PackagePublishingStatus.PUBLISHED)
2250
2248
        # Commit to ensure librarian files are written.
2268
2266
        # end up in the new architecture.
2269
2267
        amd64_family = ProcessorFamily.selectOneBy(name='amd64')
2270
2268
        hoary = ubuntu.getSeries('hoary')
2271
 
        hoary_amd64 = hoary.newArch('amd64', amd64_family, True, hoary.owner)
 
2269
        hoary.newArch('amd64', amd64_family, True, hoary.owner)
2272
2270
 
2273
2271
        # Copy the source and binaries from warty to hoary.
2274
2272
        copy_helper = self.getCopier(
2826
2824
        ancestry_source = test_publisher.getPubSource(
2827
2825
            version='1.0', distroseries=warty,
2828
2826
            status=PackagePublishingStatus.PUBLISHED)
2829
 
        ancestry_binaries = test_publisher.getPubBinaries(
 
2827
        test_publisher.getPubBinaries(
2830
2828
            pub_source=ancestry_source, distroseries=warty,
2831
2829
            status=PackagePublishingStatus.SUPERSEDED)
2832
2830
 
2939
2937
                status=PackagePublishingStatus.PUBLISHED)
2940
2938
            source.sourcepackagerelease.changelog_entry = (
2941
2939
                "Required for close_bugs_for_sourcepublication")
2942
 
            binaries = test_publisher.getPubBinaries(
 
2940
            test_publisher.getPubBinaries(
2943
2941
                pub_source=source, distroseries=warty, archive=archive,
2944
2942
                pocket=pocket, status=PackagePublishingStatus.PUBLISHED)
2945
2943
            self.layer.txn.commit()
2963
2961
 
2964
2962
        # Create a dummy first package version so we can file bugs on it.
2965
2963
        dummy_changesfile = "Format: 1.7\n"
2966
 
        proposed_source = create_source(
 
2964
        create_source(
2967
2965
            '666', warty.main_archive, PackagePublishingPocket.PROPOSED,
2968
2966
            dummy_changesfile)
2969
2967
 
2970
2968
        # Copies to -updates close bugs when they exist.
2971
2969
        updates_bug_id = create_bug('bug in -proposed')
2972
2970
        closing_bug_changesfile = changes_template % updates_bug_id
2973
 
        proposed_source = create_source(
 
2971
        create_source(
2974
2972
            '667', warty.main_archive, PackagePublishingPocket.PROPOSED,
2975
2973
            closing_bug_changesfile)
2976
2974
 
2990
2988
        # Copies to the development distroseries close bugs.
2991
2989
        dev_bug_id = create_bug('bug in development')
2992
2990
        closing_bug_changesfile = changes_template % dev_bug_id
2993
 
        dev_source = create_source(
 
2991
        create_source(
2994
2992
            '668', warty.main_archive, PackagePublishingPocket.UPDATES,
2995
2993
            closing_bug_changesfile)
2996
2994
 
3010
3008
        # Copies to -proposed do not close bugs
3011
3009
        ppa_bug_id = create_bug('bug in PPA')
3012
3010
        closing_bug_changesfile = changes_template % ppa_bug_id
3013
 
        ppa_source = create_source(
 
3011
        create_source(
3014
3012
            '669', cprov.archive, PackagePublishingPocket.RELEASE,
3015
3013
            closing_bug_changesfile)
3016
3014
 
3030
3028
        # Copies to PPA do not close bugs.
3031
3029
        proposed_bug_id = create_bug('bug in PPA')
3032
3030
        closing_bug_changesfile = changes_template % proposed_bug_id
3033
 
        release_source = create_source(
 
3031
        create_source(
3034
3032
            '670', warty.main_archive, PackagePublishingPocket.RELEASE,
3035
3033
            closing_bug_changesfile)
3036
3034
 
3056
3054
        test_publisher = self.getTestPublisher(warty)
3057
3055
        test_publisher.addFakeChroots(warty)
3058
3056
 
3059
 
        orig_tarball = 'test-source_1.0.orig.tar.gz'
3060
3057
        proposed_source = test_publisher.getPubSource(
3061
3058
            sourcename='test-source', version='1.0-2',
3062
3059
            distroseries=warty, archive=warty.main_archive,
3063
3060
            pocket=PackagePublishingPocket.PROPOSED,
3064
3061
            status=PackagePublishingStatus.PUBLISHED,
3065
3062
            section='net')
3066
 
        updates_source = test_publisher.getPubSource(
 
3063
        test_publisher.getPubSource(
3067
3064
            sourcename='test-source', version='1.0-1',
3068
3065
            distroseries=warty, archive=warty.main_archive,
3069
3066
            pocket=PackagePublishingPocket.UPDATES,