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
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2016-05-26 14:53:06 +0000
+++ lib/lp/soyuz/model/queue.py 2017-06-13 12:46:46 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2016 Canonical Ltd. This software is licensed under the1# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4__metaclass__ = type4__metaclass__ = type
@@ -305,6 +305,12 @@
305 except NotFoundError:305 except NotFoundError:
306 pass306 pass
307307
308 for build in self.builds:
309 try:
310 return build.build.getFileByName(filename)
311 except NotFoundError:
312 pass
313
308 custom = Store.of(self).find(314 custom = Store.of(self).find(
309 PackageUploadCustom,315 PackageUploadCustom,
310 PackageUploadCustom.packageupload == self.id,316 PackageUploadCustom.packageupload == self.id,
311317
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2017-01-14 00:19:57 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2017-06-13 12:46:46 +0000
@@ -374,6 +374,18 @@
374 'Rejected:\nRejected by %s: Because.' % person.displayname,374 'Rejected:\nRejected by %s: Because.' % person.displayname,
375 str(msg))375 str(msg))
376376
377 def test_getFileByName_source(self):
378 self.test_publisher.prepareBreezyAutotest()
379 upload, _ = self.makeSourcePackageUpload()
380 spr = upload.sourcepackagerelease
381 upload.getFileByName("%s_%s.dsc" % (spr.name, spr.version))
382
383 def test_getFileByName_binary(self):
384 self.test_publisher.prepareBreezyAutotest()
385 upload, _ = self.makeBuildPackageUpload()
386 bpr = upload.builds[0].build.binarypackages[0]
387 upload.getFileByName("%s_%s_i386.deb" % (bpr.name, bpr.version))
388
377389
378class TestPackageUploadSecurity(TestCaseWithFactory):390class TestPackageUploadSecurity(TestCaseWithFactory):
379 """Test PackageUpload security."""391 """Test PackageUpload security."""