launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07129
[Merge] lp:~stevenk/launchpad/forbid-proprietary-api into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/forbid-proprietary-api into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/forbid-proprietary-api/+merge/102201
Currently users can call IBug.transistionToInformationType(Proprietary) over the API currently, and as it stands right now, we don't want to allow that at all until we make some design level decisions about when proprietary is shown.
--
https://code.launchpad.net/~stevenk/launchpad/forbid-proprietary-api/+merge/102201
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/forbid-proprietary-api into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2012-04-03 06:14:09 +0000
+++ lib/lp/bugs/model/bug.py 2012-04-16 23:09:33 +0000
@@ -1727,6 +1727,9 @@
def transitionToInformationType(self, information_type, who):
"""See `IBug`."""
bug_before_modification = Snapshot(self, providing=providedBy(self))
+ if information_type == InformationType.PROPRIETARY:
+ raise BugCannotBePrivate(
+ "Can not transition the information type to proprietary.")
if self.information_type == information_type:
return False
f_flag_str = 'disclosure.enhanced_private_bug_subscriptions.enabled'
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2012-04-03 06:14:09 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2012-04-16 23:09:33 +0000
@@ -552,6 +552,16 @@
self.assertThat(
recorder2, HasQueryCount(Equals(recorder1.count)))
+ def test_transitionToInformationType_forbids_proprietary(self):
+ # Calling IBug.transitionToInformationType(PROPRIETARY) is forbidden
+ # currently.
+ bug = self.factory.makeBug()
+ with person_logged_in(bug.owner):
+ self.assertRaisesWithContent(
+ BugCannotBePrivate, "Can not transition the information "
+ "type to proprietary.", bug.transitionToInformationType,
+ InformationType.PROPRIETARY, bug.owner)
+
class TestBugPrivateAndSecurityRelatedUpdatesMixin: