← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:cibuild-privacy into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:cibuild-privacy into launchpad:master.

Commit message:
Make CIBuild implement IPrivacy, so that the privacy banner works

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/419975
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:cibuild-privacy into launchpad:master.
diff --git a/lib/lp/code/interfaces/cibuild.py b/lib/lp/code/interfaces/cibuild.py
index 9859722..ed9dedf 100644
--- a/lib/lp/code/interfaces/cibuild.py
+++ b/lib/lp/code/interfaces/cibuild.py
@@ -27,6 +27,7 @@ from zope.schema import (
     )
 
 from lp import _
+from lp.app.interfaces.launchpad import IPrivacy
 from lp.buildmaster.interfaces.buildfarmjob import (
     IBuildFarmJobAdmin,
     IBuildFarmJobEdit,
@@ -80,7 +81,7 @@ class CIBuildAlreadyRequested(Exception):
             "An identical build for this commit was already requested.")
 
 
-class ICIBuildView(IPackageBuildView):
+class ICIBuildView(IPackageBuildView, IPrivacy):
     """`ICIBuild` attributes that require launchpad.View."""
 
     git_repository = Reference(
diff --git a/lib/lp/code/model/cibuild.py b/lib/lp/code/model/cibuild.py
index 912d31f..b4b0831 100644
--- a/lib/lp/code/model/cibuild.py
+++ b/lib/lp/code/model/cibuild.py
@@ -222,6 +222,8 @@ class CIBuild(PackageBuildMixin, StormBase):
         """See `IBuildFarmJob`."""
         return self.git_repository.private
 
+    private = is_private
+
     def __repr__(self):
         return "<CIBuild %s/+build/%s>" % (
             self.git_repository.unique_name, self.id)
diff --git a/lib/lp/code/model/tests/test_cibuild.py b/lib/lp/code/model/tests/test_cibuild.py
index d4cc4ec..14e12b0 100644
--- a/lib/lp/code/model/tests/test_cibuild.py
+++ b/lib/lp/code/model/tests/test_cibuild.py
@@ -24,7 +24,10 @@ from zope.security.proxy import removeSecurityProxy
 
 from lp.app.enums import InformationType
 from lp.app.errors import NotFoundError
-from lp.app.interfaces.launchpad import ILaunchpadCelebrities
+from lp.app.interfaces.launchpad import (
+    ILaunchpadCelebrities,
+    IPrivacy,
+    )
 from lp.buildmaster.enums import (
     BuildQueueStatus,
     BuildStatus,
@@ -102,10 +105,11 @@ class TestCIBuild(TestCaseWithFactory):
     layer = LaunchpadZopelessLayer
 
     def test_implements_interfaces(self):
-        # CIBuild implements IPackageBuild and ICIBuild.
+        # CIBuild implements IPackageBuild, ICIBuild, and IPrivacy.
         build = self.factory.makeCIBuild()
         self.assertProvides(build, IPackageBuild)
         self.assertProvides(build, ICIBuild)
+        self.assertProvides(build, IPrivacy)
 
     def test___repr__(self):
         # CIBuild has an informative __repr__.
@@ -140,11 +144,13 @@ class TestCIBuild(TestCaseWithFactory):
         # A CIBuild is private iff its repository is.
         build = self.factory.makeCIBuild()
         self.assertFalse(build.is_private)
+        self.assertFalse(build.private)
         with person_logged_in(self.factory.makePerson()) as owner:
             build = self.factory.makeCIBuild(
                 git_repository=self.factory.makeGitRepository(
                     owner=owner, information_type=InformationType.USERDATA))
             self.assertTrue(build.is_private)
+            self.assertTrue(build.private)
 
     def test_can_be_retried(self):
         ok_cases = [