Merge ~cjwatson/launchpad:export-move-package into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: bac94633a8d29a0fde87df7d52b79fb21473fcce
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:export-move-package
Merge into: launchpad:master
Diff against target: 62 lines (+33/-0)
2 files modified
lib/lp/soyuz/browser/tests/test_archive_webservice.py (+27/-0)
lib/lp/soyuz/interfaces/archive.py (+6/-0)
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+389259@code.launchpad.net

Commit message

Declare "move" parameter to Archive.copyPackage

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/soyuz/browser/tests/test_archive_webservice.py b/lib/lp/soyuz/browser/tests/test_archive_webservice.py
2index b9ad921..1ce3759 100644
3--- a/lib/lp/soyuz/browser/tests/test_archive_webservice.py
4+++ b/lib/lp/soyuz/browser/tests/test_archive_webservice.py
5@@ -627,6 +627,32 @@ class TestCopyPackage(TestCaseWithFactory):
6 job_source = getUtility(IPlainPackageCopyJobSource)
7 copy_job = job_source.getActiveJobs(target_archive).one()
8 self.assertEqual(target_archive, copy_job.target_archive)
9+ self.assertFalse(copy_job.move)
10+
11+ def test_copyPackage_move(self):
12+ (source, source_archive, source_name, target_archive, to_pocket,
13+ to_series, uploader, _, version) = self.setup_data()
14+ with person_logged_in(source_archive.owner):
15+ source_archive.newComponentUploader(uploader, "main")
16+
17+ target_archive_url = api_url(target_archive)
18+ source_archive_url = api_url(source_archive)
19+ ws = webservice_for_person(
20+ uploader, permission=OAuthPermission.WRITE_PUBLIC,
21+ default_api_version="devel")
22+
23+ response = ws.named_post(
24+ target_archive_url, "copyPackage",
25+ source_name=source_name, version=version,
26+ from_archive=source_archive_url, to_pocket=to_pocket.name,
27+ to_series=to_series.name, include_binaries=False, move=True)
28+ self.assertEqual(200, response.status)
29+
30+ login(ANONYMOUS)
31+ job_source = getUtility(IPlainPackageCopyJobSource)
32+ copy_job = job_source.getActiveJobs(target_archive).one()
33+ self.assertEqual(target_archive, copy_job.target_archive)
34+ self.assertTrue(copy_job.move)
35
36 def test_copyPackages(self):
37 """Basic smoke test"""
38@@ -654,6 +680,7 @@ class TestCopyPackage(TestCaseWithFactory):
39 job_source = getUtility(IPlainPackageCopyJobSource)
40 copy_job = job_source.getActiveJobs(target_archive).one()
41 self.assertEqual(target_archive, copy_job.target_archive)
42+ self.assertFalse(copy_job.move)
43
44
45 class TestGetPublishedBinaries(TestCaseWithFactory):
46diff --git a/lib/lp/soyuz/interfaces/archive.py b/lib/lp/soyuz/interfaces/archive.py
47index 2aae255..e3f8462 100644
48--- a/lib/lp/soyuz/interfaces/archive.py
49+++ b/lib/lp/soyuz/interfaces/archive.py
50@@ -1515,6 +1515,12 @@ class IArchiveView(IHasBuildRecords):
51 " should be recommended, or None to publish the"
52 " update for everyone."),
53 required=False),
54+ move=Bool(
55+ title=_("Move"),
56+ description=_(
57+ "If true, delete the source publication after copying it to "
58+ "the destination."),
59+ required=False),
60 )
61 @export_write_operation()
62 @operation_for_version('devel')

Subscribers

People subscribed via source and target branches

to status/vote changes: