~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-13 12:25:30 UTC
  • mfrom: (13402.2.1 bug-808651)
  • Revision ID: launchpad@pqm.canonical.com-20110713122530-2bifdjc4wvcyog6b
[r=henninge][bug=808651][no-qa] Test IPackageUploadSet.getAll
 ordering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
from zope.security.proxy import removeSecurityProxy
13
13
 
14
14
from canonical.config import config
 
15
from canonical.launchpad.interfaces.lpstorm import IStore
15
16
from canonical.testing.layers import LaunchpadZopelessLayer
16
17
from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
17
18
from lp.archiveuploader.tests import datadir
815
816
            [upload],
816
817
            upload_set.getAll(
817
818
                distroseries, name=spn.name, version=upload.displayversion))
 
819
 
 
820
    def test_getAll_orders_in_reverse_historical_order(self):
 
821
        # The results from getAll are returned in order of creation,
 
822
        # newest to oldest, regardless of upload type.
 
823
        series = self.factory.makeDistroSeries()
 
824
        store = IStore(series)
 
825
        ordered_uploads = []
 
826
        ordered_uploads.append(self.factory.makeCopyJobPackageUpload(series))
 
827
        store.flush()
 
828
        ordered_uploads.append(self.factory.makeBuildPackageUpload(series))
 
829
        store.flush()
 
830
        ordered_uploads.append(self.factory.makeSourcePackageUpload(series))
 
831
        store.flush()
 
832
        ordered_uploads.append(self.factory.makeCustomPackageUpload(series))
 
833
        store.flush()
 
834
        ordered_uploads.append(self.factory.makeCopyJobPackageUpload(series))
 
835
        store.flush()
 
836
        ordered_uploads.append(self.factory.makeSourcePackageUpload(series))
 
837
        store.flush()
 
838
        self.assertEqual(
 
839
            list(reversed(ordered_uploads)),
 
840
            list(getUtility(IPackageUploadSet).getAll(series)))