~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Curtis Hovey
  • Date: 2011-08-18 20:56:37 UTC
  • mto: This revision was merged to the branch mainline in revision 13736.
  • Revision ID: curtis.hovey@canonical.com-20110818205637-ae0pf9aexdea2mlb
Cleaned up doctrings and hushed lint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Helper functions/classes for Soyuz tests."""
16
16
 
17
17
from canonical.config import config
18
18
from canonical.launchpad.database.librarian import LibraryFileAlias
 
19
from canonical.launchpad.ftests import (
 
20
    import_public_test_keys,
 
21
    )
19
22
from canonical.launchpad.testing.fakepackager import FakePackager
20
23
from canonical.testing.layers import LaunchpadZopelessLayer
21
24
from lp.registry.interfaces.distribution import IDistributionSet
22
25
from lp.registry.interfaces.person import IPersonSet
23
26
from lp.registry.interfaces.pocket import PackagePublishingPocket
 
27
from lp.soyuz.interfaces.packagediff import IPackageDiffSet
24
28
from lp.soyuz.enums import PackagePublishingStatus
25
 
from lp.soyuz.interfaces.packagediff import IPackageDiffSet
26
29
from lp.soyuz.model.publishing import (
27
30
    BinaryPackagePublishingHistory,
28
31
    SourcePackagePublishingHistory,
29
32
    )
30
 
from lp.testing.dbuser import dbuser
31
 
from lp.testing.gpgkeys import import_public_test_keys
32
33
from lp.testing.sampledata import (
33
34
    BUILDD_ADMIN_USERNAME,
34
35
    CHROOT_LIBRARYFILEALIAS,
94
95
        for status, archive, pocket in self.sample_publishing_data:
95
96
            pub = SourcePackagePublishingHistory(
96
97
                sourcepackagerelease=sourcepackagerelease,
97
 
                sourcepackagename=sourcepackagerelease.sourcepackagename,
98
98
                distroseries=distroseries,
99
99
                component=sourcepackagerelease.component,
100
100
                section=sourcepackagerelease.section,
118
118
        for status, archive, pocket in self.sample_publishing_data:
119
119
            pub = BinaryPackagePublishingHistory(
120
120
                binarypackagerelease=binarypackagerelease,
121
 
                binarypackagename=binarypackagerelease.binarypackagename,
122
121
                distroarchseries=distroarchseries,
123
122
                component=binarypackagerelease.component,
124
123
                section=binarypackagerelease.section,
154
153
        Store the `FakePackager` object used in the test uploads as `packager`
155
154
        so the tests can reuse it if necessary.
156
155
        """
157
 
        with dbuser(LAUNCHPAD_DBUSER_NAME):
158
 
            fake_chroot = LibraryFileAlias.get(CHROOT_LIBRARYFILEALIAS)
159
 
            ubuntu = getUtility(IDistributionSet).getByName(
160
 
                UBUNTU_DISTRIBUTION_NAME)
161
 
            warty = ubuntu.getSeries(WARTY_DISTROSERIES_NAME)
162
 
            warty[I386_ARCHITECTURE_NAME].addOrUpdateChroot(fake_chroot)
163
 
 
 
156
        self.layer.alterConnection(dbuser=LAUNCHPAD_DBUSER_NAME)
 
157
 
 
158
        fake_chroot = LibraryFileAlias.get(CHROOT_LIBRARYFILEALIAS)
 
159
        ubuntu = getUtility(IDistributionSet).getByName(
 
160
            UBUNTU_DISTRIBUTION_NAME)
 
161
        warty = ubuntu.getSeries(WARTY_DISTROSERIES_NAME)
 
162
        warty[I386_ARCHITECTURE_NAME].addOrUpdateChroot(fake_chroot)
 
163
 
 
164
        self.layer.txn.commit()
 
165
 
 
166
        self.layer.alterConnection(dbuser=self.dbuser)
164
167
        self.packager = self.uploadTestPackages()
165
168
        self.layer.txn.commit()
166
169