Merge lp:~cjwatson/launchpad/pu-getFileByName-binary into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18404
Proposed branch: lp:~cjwatson/launchpad/pu-getFileByName-binary
Merge into: lp:launchpad
Diff against target: 45 lines (+19/-1)
2 files modified
lib/lp/soyuz/model/queue.py (+7/-1)
lib/lp/soyuz/tests/test_packageupload.py (+12/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/pu-getFileByName-binary
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+325564@code.launchpad.net

Commit message

Implement proxying of PackageUpload binary files via the webapp, since DistroSeries:+queue now assumes that that works.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/queue.py'
2--- lib/lp/soyuz/model/queue.py 2016-05-26 14:53:06 +0000
3+++ lib/lp/soyuz/model/queue.py 2017-06-13 12:46:46 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
6+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 __metaclass__ = type
10@@ -305,6 +305,12 @@
11 except NotFoundError:
12 pass
13
14+ for build in self.builds:
15+ try:
16+ return build.build.getFileByName(filename)
17+ except NotFoundError:
18+ pass
19+
20 custom = Store.of(self).find(
21 PackageUploadCustom,
22 PackageUploadCustom.packageupload == self.id,
23
24=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
25--- lib/lp/soyuz/tests/test_packageupload.py 2017-01-14 00:19:57 +0000
26+++ lib/lp/soyuz/tests/test_packageupload.py 2017-06-13 12:46:46 +0000
27@@ -374,6 +374,18 @@
28 'Rejected:\nRejected by %s: Because.' % person.displayname,
29 str(msg))
30
31+ def test_getFileByName_source(self):
32+ self.test_publisher.prepareBreezyAutotest()
33+ upload, _ = self.makeSourcePackageUpload()
34+ spr = upload.sourcepackagerelease
35+ upload.getFileByName("%s_%s.dsc" % (spr.name, spr.version))
36+
37+ def test_getFileByName_binary(self):
38+ self.test_publisher.prepareBreezyAutotest()
39+ upload, _ = self.makeBuildPackageUpload()
40+ bpr = upload.builds[0].build.binarypackages[0]
41+ upload.getFileByName("%s_%s_i386.deb" % (bpr.name, bpr.version))
42+
43
44 class TestPackageUploadSecurity(TestCaseWithFactory):
45 """Test PackageUpload security."""