← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:snapbuild-requester-visibility into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:snapbuild-requester-visibility into launchpad:master.

Commit message:
Don't block team visibility changes due to SnapBuild.requester

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1915521 in Launchpad itself: "Can't make ~multipass-team public, since "it is referenced by a snapbuild""
  https://bugs.launchpad.net/launchpad/+bug/1915521

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398007
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:snapbuild-requester-visibility into launchpad:master.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 4746d64..b7c95db 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -1,4 +1,4 @@
-# Copyright 2009-2020 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2021 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Implementation classes for a Person."""
@@ -2353,6 +2353,7 @@ class Person(
             ('productseries', 'owner'),
             ('sharingjob', 'grantee'),
             ('signedcodeofconduct', 'owner'),
+            ('snapbuild', 'requester'),
             ('specificationsubscription', 'person'),
             ('sshkey', 'person'),
             ('structuralsubscription', 'subscriber'),
diff --git a/lib/lp/registry/tests/test_team.py b/lib/lp/registry/tests/test_team.py
index 7ffc5e1..e860410 100644
--- a/lib/lp/registry/tests/test_team.py
+++ b/lib/lp/registry/tests/test_team.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2018 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2021 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for PersonSet."""
@@ -587,6 +587,16 @@ class TestVisibilityConsistencyWarning(TestCaseWithFactory):
             None,
             self.team.visibilityConsistencyWarning(PersonVisibility.PRIVATE))
 
+    def test_no_warning_for_SnapBuild_requester(self):
+        # Sometimes snap recipe builds can end up having their requester set
+        # to a team for one reason or another.  This doesn't cause a
+        # warning, since the requester does not expose team membership
+        # information.
+        self.factory.makeSnapBuild(
+            requester=self.team, snap=self.factory.makeSnap())
+        self.assertIsNone(
+            self.team.visibilityConsistencyWarning(PersonVisibility.PRIVATE))
+
 
 class TestPersonJoinTeam(TestCaseWithFactory):