~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/tests/test_archive.py

[r=julian-edwards][bug=812837] Fix a stupid mistake when creating
        PackageCopyJobs inside IArchive.copyPackages(). It was using
        the sourcepackagename.ID instead of the sourcepackagename.name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
from testtools.matchers import (
14
14
    DocTestMatches,
 
15
    Equals,
15
16
    MatchesRegex,
 
17
    MatchesStructure,
16
18
    )
17
19
from testtools.testcase import ExpectedException
18
20
import transaction
2034
2036
        copy_job = job_source.getActiveJobs(target_archive).one()
2035
2037
 
2036
2038
        # Its data should reflect the requested copy.
2037
 
        self.assertEqual(source_name, copy_job.package_name)
2038
 
        self.assertEqual(version, copy_job.package_version)
2039
 
        self.assertEqual(target_archive, copy_job.target_archive)
2040
 
        self.assertEqual(source_archive, copy_job.source_archive)
2041
 
        self.assertEqual(to_series, copy_job.target_distroseries)
2042
 
        self.assertEqual(to_pocket, copy_job.target_pocket)
2043
 
        self.assertFalse(copy_job.include_binaries)
2044
 
        self.assertEquals(PackageCopyPolicy.INSECURE, copy_job.copy_policy)
 
2039
        self.assertThat(copy_job, MatchesStructure(
 
2040
            package_name=Equals(source_name),
 
2041
            package_version=Equals(version),
 
2042
            target_archive=Equals(target_archive),
 
2043
            source_archive=Equals(source_archive),
 
2044
            target_distroseries=Equals(to_series),
 
2045
            target_pocket=Equals(to_pocket),
 
2046
            include_binaries=Equals(False),
 
2047
            copy_policy=Equals(PackageCopyPolicy.INSECURE)))
2045
2048
 
2046
2049
    def test_copyPackage_disallows_non_primary_archive_uploaders(self):
2047
2050
        # If copying to a primary archive and you're not an uploader for
2115
2118
        # There should be one copy job.
2116
2119
        job_source = getUtility(IPlainPackageCopyJobSource)
2117
2120
        copy_job = job_source.getActiveJobs(target_archive).one()
2118
 
        self.assertEqual(target_archive, copy_job.target_archive)
 
2121
        self.assertThat(copy_job, MatchesStructure(
 
2122
            package_name=Equals(source_name),
 
2123
            package_version=Equals(version),
 
2124
            target_archive=Equals(target_archive),
 
2125
            source_archive=Equals(source_archive),
 
2126
            target_distroseries=Equals(to_series),
 
2127
            target_pocket=Equals(to_pocket),
 
2128
            include_binaries=Equals(False),
 
2129
            copy_policy=Equals(PackageCopyPolicy.INSECURE)))
2119
2130
 
2120
2131
    def test_copyPackages_with_multiple_packages(self):
2121
2132
        (source, source_archive, source_name, target_archive, to_pocket,