launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28644
[Merge] ~ilasc/launchpad:api-show-publishing-enabled-ppa into launchpad:master
Ioana Lasc has proposed merging ~ilasc/launchpad:api-show-publishing-enabled-ppa into launchpad:master.
Commit message:
Show in API if publishing for ppa is enabled
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1979368 in Launchpad itself: "Add PPA Publishing status via API"
https://bugs.launchpad.net/launchpad/+bug/1979368
For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/425283
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:api-show-publishing-enabled-ppa into launchpad:master.
diff --git a/lib/lp/soyuz/browser/tests/test_archive_webservice.py b/lib/lp/soyuz/browser/tests/test_archive_webservice.py
index 352b346..e69fecb 100644
--- a/lib/lp/soyuz/browser/tests/test_archive_webservice.py
+++ b/lib/lp/soyuz/browser/tests/test_archive_webservice.py
@@ -131,6 +131,24 @@ class TestArchiveWebservice(TestCaseWithFactory):
# A random user can't delete someone else's PPA.
self.assertEqual(401, ws.delete(ppa_url).status)
+ def test_publishing_enabled(self):
+ with admin_logged_in():
+ archive = self.factory.makeArchive()
+ archive_url = api_url(archive)
+ ws = webservice_for_person(
+ self.factory.makePerson(),
+ permission=OAuthPermission.WRITE_PUBLIC)
+ ws_archive = self.getWebserviceJSON(ws, archive_url)
+
+ self.assertTrue(ws_archive["can_be_published"])
+
+ response = ws.patch(
+ archive_url, "application/json",
+ json.dumps({"can_be_published": False}))
+ self.assertThat(response, MatchesStructure(
+ status=Equals(400),
+ body=Contains(b"You tried to modify a read-only attribute")))
+
class TestSigningKey(TestCaseWithFactory):
"""Test signing-key-related information for archives.
diff --git a/lib/lp/soyuz/interfaces/archive.py b/lib/lp/soyuz/interfaces/archive.py
index fb2ef57..bf235a7 100644
--- a/lib/lp/soyuz/interfaces/archive.py
+++ b/lib/lp/soyuz/interfaces/archive.py
@@ -453,11 +453,12 @@ class IArchiveSubscriberView(Interface):
description=_("Whether or not to update the apt repository. If "
"disabled, nothing will be published. If the archive is "
"private then additionally no builds will be dispatched."))
- can_be_published = Bool(
+ can_be_published = exported(Bool(
title=_("Can be published"), required=True,
description=_(
"True if this archive can be published, considering both the "
- "explicit publish flag and any other constraints."))
+ "explicit publish flag and any other constraints."),
+ readonly=True))
series_with_sources = Attribute(
"DistroSeries to which this archive has published sources")
signing_key_owner = Reference(
diff --git a/lib/lp/soyuz/stories/webservice/xx-archive.rst b/lib/lp/soyuz/stories/webservice/xx-archive.rst
index 8ac9364..b9b55b3 100644
--- a/lib/lp/soyuz/stories/webservice/xx-archive.rst
+++ b/lib/lp/soyuz/stories/webservice/xx-archive.rst
@@ -18,6 +18,7 @@ We publish a subset of their attributes.
>>> from lazr.restful.testing.webservice import pprint_entry
>>> pprint_entry(cprov_archive)
authorized_size: 1024
+ can_be_published: True
dependencies_collection_link:
'http://.../~cprov/+archive/ubuntu/ppa/dependencies'
description: 'packages to help my friends.'
@@ -43,6 +44,7 @@ For "devel" additional attributes are available.
>>> pprint_entry(cprov_archive_devel)
authorized_size: 1024
build_debug_symbols: False
+ can_be_published: True
dependencies_collection_link:
'http://.../~cprov/+archive/ubuntu/ppa/dependencies'
description: 'packages to help my friends.'
@@ -126,6 +128,7 @@ The archive has the following attributes:
... ubuntutest['main_archive_link']).jsonBody()
>>> pprint_entry(ubuntu_main_archive)
authorized_size: None
+ can_be_published: True
dependencies_collection_link:
'http://.../ubuntutest/+archive/primary/dependencies'
description: None
@@ -1198,6 +1201,7 @@ the IArchive context, in this case only Celso has it.
>>> pprint_entry(user_webservice.get(
... "/~cprov/+archive/ubuntu/p3a").jsonBody())
authorized_size: 'tag:launchpad.net:2008:redacted'
+ can_be_published: 'tag:launchpad.net:2008:redacted'
dependencies_collection_link:
'http://.../~cprov/+archive/ubuntu/p3a/dependencies'
description: 'tag:launchpad.net:2008:redacted'
@@ -1219,6 +1223,7 @@ the IArchive context, in this case only Celso has it.
>>> pprint_entry(cprov_webservice.get(
... "/~cprov/+archive/ubuntu/p3a").jsonBody())
authorized_size: 2048
+ can_be_published: True
dependencies_collection_link:
'http://.../~cprov/+archive/ubuntu/p3a/dependencies'
description: 'packages to help my friends.'
References