← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/destroy-some-sampledata-constants into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/destroy-some-sampledata-constants into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/destroy-some-sampledata-constants/+merge/177977

Destroy a bunch of sampledata constants that are either unused or I have forced to be by destroying lp.soyuz.tests.ppas.
-- 
https://code.launchpad.net/~stevenk/launchpad/destroy-some-sampledata-constants/+merge/177977
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/destroy-some-sampledata-constants into lp:launchpad.
=== modified file 'lib/lp/soyuz/doc/distribution.txt'
--- lib/lp/soyuz/doc/distribution.txt	2013-05-09 08:53:01 +0000
+++ lib/lp/soyuz/doc/distribution.txt	2013-08-01 00:35:39 +0000
@@ -12,18 +12,6 @@
     >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
     >>> debian = getUtility(IDistributionSet).getByName('debian')
 
-(Create some data that is depended upon by later tests. It was part of a
-test "narrative" that was converted to unit tests.... for obvious reasons.)
-
-    >>> from lp.soyuz.tests.ppa import publishToPPA
-    >>> publishToPPA(
-    ...     person_name='cprov',
-    ...     sourcepackage_name='at', sourcepackage_version='0.00',
-    ...     binarypackage_version='3.14156',
-    ...     distribution_name='ubuntutest',
-    ...     distroseries_name='hoary-test',
-    ...     publishing_status=PackagePublishingStatus.PUBLISHED)
-
 
 Handling Personal Package Archives
 ----------------------------------
@@ -68,7 +56,7 @@
 There is only one 'active' PPA:
 
     >>> cprov.archive.getPublishedSources().count()
-    4
+    3
 
     >>> mark.archive.getPublishedSources().count()
     1
@@ -256,7 +244,10 @@
 state. In order to test this behaviour we will copy some binaries within
 Celso's PPA.
 
-    >>> cprov_bin = cprov.archive.getAllPublishedBinaries()[0]
+    >>> cprov_bin = factory.makeBinaryPackagePublishingHistory(
+    ...     archive=cprov.archive, status=PackagePublishingStatus.PUBLISHED)
+    >>> spr = cprov_bin.binarypackagerelease.build.source_package_release
+    >>> spr.publishings[0].setPublished()
     >>> pending_binaries = cprov_bin.copyTo(
     ...     warty, pocket_release, cprov.archive)
 

=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt	2013-05-09 08:53:01 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-packages.txt	2013-08-01 00:35:39 +0000
@@ -40,7 +40,6 @@
     >>> print anon_browser.url
     http://launchpad.dev/~cprov/+archive/ppa/+builds
 
-
 The rest of the builds page functionality is tested generically at
 in xx-builds-pages.txt.
 
@@ -352,9 +351,17 @@
 by name16 (Foo Bar) who is a member - the signer is presented as the uploader
 in the list.
 
-    >>> from lp.soyuz.tests.ppa import publishToTeamPPA
+    >>> from lp.registry.interfaces.sourcepackage import SourcePackageFileType
+    >>> from lp.testing.sampledata import UBUNTU_UPLOAD_TEAM_NAME
     >>> login(ANONYMOUS)
-    >>> publishToTeamPPA(team_name="ubuntu-team")
+    >>> team = getUtility(IPersonSet).getByName(UBUNTU_UPLOAD_TEAM_NAME)
+    >>> key = factory.makeGPGKey(team.teamowner)
+    >>> pub = factory.makeSourcePackagePublishingHistory(
+    ...     archive=team.archive, dscsigningkey=key)
+    >>> lfa = factory.makeLibraryFileAlias(filename='foo.orig.tar.gz')
+    >>> ign = factory.makeSourcePackageReleaseFile(
+    ...     sourcepackagerelease=pub.sourcepackagerelease, library_file=lfa,
+    ...     filetype=SourcePackageFileType.ORIG_TARBALL)
     >>> logout()
     >>> transaction.commit()
 
@@ -367,7 +374,7 @@
 
     >>> print_archive_package_rows(foo_browser.contents)
     Source              Uploader ... Status   Series  Section  Build Status
-    mozilla-firefox...  name16       Pending  Hoary   Base
+    unique-from...      mark         Pending  Distroseries... Section...
 
 Links from files go to their on-archive locations:
 
@@ -376,13 +383,13 @@
     >>> expander_url = foo_browser.getLink(id=expander_id).url
     >>> anon_browser.open(expander_url)
     >>> print anon_browser.getLink("orig").url
-    http://.../firefox_0.9.2.orig.tar.gz
+    http://.../+files/foo.orig.tar.gz
 
 The uploader name is linkified to that user's home page:
 
-    >>> foo_browser.getLink(url="~name16").click()
+    >>> foo_browser.getLink(url="~mark").click()
     >>> foo_browser.url
-    'http://launchpad.dev/~name16'
+    'http://launchpad.dev/~mark'
 
 
 PPA Build Status column

=== modified file 'lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt'
--- lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt	2013-05-09 08:53:01 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt	2013-08-01 00:35:39 +0000
@@ -188,7 +188,7 @@
 
     >>> from zope.component import getUtility
 
-    >>> from lp.services.database.sqlbase import flush_database_updates
+    >>> import transaction
     >>> from lp.registry.interfaces.distribution import IDistributionSet
 
     >>> login(ANONYMOUS)
@@ -196,7 +196,7 @@
     >>> for archive in ubuntu.getAllPPAs():
     ...     archive.updateArchiveCache()
     >>> logout()
-    >>> flush_database_updates()
+    >>> transaction.commit()
 
 In the three sample data PPAs, only one matches the search string "Celso".
 
@@ -225,14 +225,18 @@
 
 Let's start by adding an extra package to Celso's archive:
 
-    >>> import transaction
-    >>> from lp.soyuz.tests.ppa import publishToPPA
+    >>> from lp.registry.interfaces.person import IPersonSet
+    >>> def publishToPPA(person_name, distroseries_name, name, version):
+    ...     person = getUtility(IPersonSet).getByName(person_name)
+    ...     distroseries = person.archive.distribution[distroseries_name]
+    ...     ign = factory.makeSourcePackagePublishingHistory(
+    ...         distroseries=distroseries, archive=person.archive,
+    ...         sourcepackagename=name, version=version)
 
     >>> login(ANONYMOUS)
     >>> publishToPPA("cprov", "warty", "commercialpackage", "1.0-1")
     >>> logout()
     >>> transaction.commit()
-    >>> flush_database_updates()
 
 And now on to the page itself. In the table rows, the PPA
 'displayname' is a link to its corresponding page:

=== removed file 'lib/lp/soyuz/tests/ppa.py'
--- lib/lp/soyuz/tests/ppa.py	2011-12-30 06:14:56 +0000
+++ lib/lp/soyuz/tests/ppa.py	1970-01-01 00:00:00 +0000
@@ -1,132 +0,0 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Helper functions/classes to be used when testing Personal Package Archives.
-"""
-
-__metaclass__ = type
-
-from zope.component import getUtility
-
-from lp.registry.interfaces.distribution import IDistributionSet
-from lp.registry.interfaces.person import IPersonSet
-from lp.registry.interfaces.pocket import PackagePublishingPocket
-from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
-from lp.services.database.constants import UTC_NOW
-from lp.soyuz.enums import (
-    PackagePublishingPriority,
-    PackagePublishingStatus,
-    )
-from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
-from lp.soyuz.interfaces.component import IComponentSet
-from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
-from lp.soyuz.model.publishing import (
-    BinaryPackagePublishingHistory,
-    SourcePackagePublishingHistory,
-    )
-from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
-from lp.testing.sampledata import (
-    HOARY_DISTROSERIES_NAME,
-    I386_ARCHITECTURE_NAME,
-    MAIN_COMPONENT_NAME,
-    UBUNTU_DEVELOPER_ADMIN_NAME,
-    UBUNTU_UPLOAD_TEAM_NAME,
-    WARTY_ONLY_SOURCEPACKAGENAME,
-    WARTY_ONLY_SOURCEPACKAGEVERSION,
-    )
-
-
-def publishToTeamPPA(team_name=None, distroseries_name=None,
-                     sourcepackage_name=None, sourcepackage_version=None,
-                     team_member_name=None, distribution_name=None,
-                     binarypackage_version=None, publishing_status=None,
-                     arch=None):
-    """Publish a signed package in a team PPA.
-
-    It defaults to publishing mozilla-firefox 0.9 signed by name16 in
-    the ubuntu-team PPA for the 'hoary' distroseries.
-
-    The team PPA must already be created.
-    """
-    if team_name is None:
-        team_name = UBUNTU_UPLOAD_TEAM_NAME
-    if team_member_name is None:
-        team_member_name = UBUNTU_DEVELOPER_ADMIN_NAME
-    team = getUtility(IPersonSet).getByName(team_name)
-    _publishToPPA(
-        team.archive, team_member_name, distroseries_name,
-        sourcepackage_name, sourcepackage_version, distribution_name,
-        binarypackage_version, publishing_status, arch)
-
-
-def publishToPPA(person_name, distroseries_name=None, sourcepackage_name=None,
-                 sourcepackage_version=None, distribution_name=None,
-                 binarypackage_version=None, publishing_status=None,
-                 arch=None):
-    person = getUtility(IPersonSet).getByName(person_name)
-    _publishToPPA(person.archive, person_name, distroseries_name,
-                  sourcepackage_name, sourcepackage_version,
-                  distribution_name, binarypackage_version, publishing_status,
-                  arch)
-
-
-def _publishToPPA(archive, person_name, distroseries_name, sourcepackage_name,
-                  sourcepackage_version, distribution_name,
-                  binarypackage_version, publishing_status, arch):
-    if distribution_name is None:
-        distribution = archive.distribution
-    else:
-        distribution = getUtility(IDistributionSet)[distribution_name]
-    if distroseries_name is None:
-        distroseries_name = HOARY_DISTROSERIES_NAME
-    if sourcepackage_name is None:
-        sourcepackage_name = WARTY_ONLY_SOURCEPACKAGENAME
-    if sourcepackage_version is None:
-        sourcepackage_version = WARTY_ONLY_SOURCEPACKAGEVERSION
-    if publishing_status is None:
-        publishing_status = PackagePublishingStatus.PENDING
-    if arch is None:
-        arch = I386_ARCHITECTURE_NAME
-
-    sourcepackagename = getUtility(ISourcePackageNameSet)[sourcepackage_name]
-    distroseries = distribution[distroseries_name]
-    sourcepackagerelease = SourcePackageRelease.selectOneBy(
-            sourcepackagenameID=sourcepackagename.id,
-            version=sourcepackage_version)
-
-    person = getUtility(IPersonSet).getByName(person_name)
-    if person.gpg_keys:
-        # XXX: kiko 2007-10-25: oy, what a hack. I need to test with cprov
-        # and he doesn't have a signing key in the database
-        sourcepackagerelease.dscsigningkey = person.gpg_keys[0]
-    main_component = getUtility(IComponentSet)[MAIN_COMPONENT_NAME]
-    SourcePackagePublishingHistory(
-        distroseries=distroseries,
-        sourcepackagerelease=sourcepackagerelease,
-        sourcepackagename=sourcepackagename,
-        component=main_component,
-        section=sourcepackagerelease.section,
-        status=publishing_status,
-        datecreated=UTC_NOW,
-        pocket=PackagePublishingPocket.RELEASE,
-        archive=archive)
-
-    # Only publish binaries if the callsite specified a version.
-    if binarypackage_version:
-        binarypackagename = getUtility(
-            IBinaryPackageNameSet)[sourcepackage_name]
-        binarypackagerelease = BinaryPackageRelease.selectOneBy(
-            binarypackagenameID=binarypackagename.id,
-            version=binarypackage_version)
-        distroarchseries = distroseries[arch]
-        BinaryPackagePublishingHistory(
-            binarypackagerelease=binarypackagerelease,
-            binarypackagename=binarypackagename,
-            distroarchseries=distroarchseries,
-            component=main_component,
-            section=sourcepackagerelease.section,
-            priority=PackagePublishingPriority.STANDARD,
-            status=publishing_status,
-            datecreated=UTC_NOW,
-            pocket=PackagePublishingPocket.RELEASE,
-            archive=archive)

=== modified file 'lib/lp/testing/sampledata.py'
--- lib/lp/testing/sampledata.py	2012-08-21 14:36:44 +0000
+++ lib/lp/testing/sampledata.py	2013-08-01 00:35:39 +0000
@@ -12,23 +12,12 @@
     'ADMIN_EMAIL',
     'BOB_THE_BUILDER_NAME',
     'BUILDD_ADMIN_USERNAME',
-    'CHROOT_LIBRARYFILEALIAS',
-    'FROG_THE_BUILDER_NAME',
-    'HOARY_DISTROSERIES_NAME',
     'I386_ARCHITECTURE_NAME',
     'LAUNCHPAD_ADMIN',
-    'LAUNCHPAD_DBUSER_NAME',
-    'MAIN_COMPONENT_NAME',
     'NO_PRIVILEGE_EMAIL',
-    'SAMPLE_PERSON_EMAIL',
-    'UBUNTU_DEVELOPER_ADMIN_NAME',
     'UBUNTU_DISTRIBUTION_NAME',
     'UBUNTU_UPLOAD_TEAM_NAME',
     'USER_EMAIL',
-    'WARTY_DISTROSERIES_NAME',
-    'WARTY_ONLY_SOURCEPACKAGENAME',
-    'WARTY_ONLY_SOURCEPACKAGEVERSION',
-    'WARTY_UPDATES_SUITE_NAME',
     ]
 
 # Please use names that reveal intent, rather than being purely
@@ -43,28 +32,14 @@
 BUILDD_ADMIN_USERNAME = 'cprov'
 # A couple of builders.
 BOB_THE_BUILDER_NAME = 'bob'
-FROG_THE_BUILDER_NAME = 'frog'
-# The LibraryFileAlias of a chroot for attaching to a DistroArchSeries
-CHROOT_LIBRARYFILEALIAS = 1
-HOARY_DISTROSERIES_NAME = 'hoary'
 I386_ARCHITECTURE_NAME = 'i386'
 LAUNCHPAD_ADMIN = 'admin@xxxxxxxxxxxxx'
-LAUNCHPAD_DBUSER_NAME = 'launchpad'
-MAIN_COMPONENT_NAME = 'main'
 
 NO_PRIVILEGE_EMAIL = 'no-priv@xxxxxxxxxxxxx'
 USER_EMAIL = 'test@xxxxxxxxxxxxx'
 VCS_IMPORTS_MEMBER_EMAIL = 'david.allouche@xxxxxxxxxxxxx'
-SAMPLE_PERSON_EMAIL = USER_EMAIL
 # A user that is an admin of ubuntu-team, which has upload rights
 # to Ubuntu.
-UBUNTU_DEVELOPER_ADMIN_NAME = 'name16'
 UBUNTU_DISTRIBUTION_NAME = 'ubuntu'
 # A team that has upload rights to Ubuntu
 UBUNTU_UPLOAD_TEAM_NAME = 'ubuntu-team'
-WARTY_DISTROSERIES_NAME = 'warty'
-# A source package name and version for a package only published in
-# warty
-WARTY_ONLY_SOURCEPACKAGENAME = 'mozilla-firefox'
-WARTY_ONLY_SOURCEPACKAGEVERSION = '0.9'
-WARTY_UPDATES_SUITE_NAME = WARTY_DISTROSERIES_NAME + '-updates'