launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07519
[Merge] lp:~stevenk/launchpad/bugs-factory-information_type into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/bugs-factory-information_type into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/bugs-factory-information_type/+merge/104326
Update LaunchpadObjectFactory.makeBug() to no longer accept a private or security_related parameters, set the default information_type to PUBLIC and change all the callsites that made use of the doomed parameters.
Using a shell one-liner I'd rather not talk about I think I've tracked down all of them, but I may have missed some. Since this branch doesn't impact on code, just tests, I'm not so concerned and I'm sure ec2 will find the rest.
--
https://code.launchpad.net/~stevenk/launchpad/bugs-factory-information_type/+merge/104326
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/bugs-factory-information_type into lp:launchpad.
=== modified file 'lib/lp/app/browser/tests/launchpad-search-pages.txt'
--- lib/lp/app/browser/tests/launchpad-search-pages.txt 2011-12-24 17:49:30 +0000
+++ lib/lp/app/browser/tests/launchpad-search-pages.txt 2012-05-02 05:31:18 +0000
@@ -115,10 +115,12 @@
created because he is the owner.
>>> from lp.services.webapp.interfaces import ILaunchBag
+ >>> from lp.registry.enums import InformationType
>>> login('test@xxxxxxxxxxxxx')
>>> sample_person = getUtility(ILaunchBag).user
- >>> private_bug = factory.makeBug(owner=sample_person, private=True)
+ >>> private_bug = factory.makeBug(
+ ... owner=sample_person, information_type=InformationType.USERDATA)
>>> search_view = getSearchView(
... form={'field.text': private_bug.id})
=== modified file 'lib/lp/app/browser/tests/test_linkchecker.py'
--- lib/lp/app/browser/tests/test_linkchecker.py 2012-01-01 02:58:52 +0000
+++ lib/lp/app/browser/tests/test_linkchecker.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for the LinkCheckerAPI."""
@@ -11,6 +11,7 @@
from zope.security.proxy import removeSecurityProxy
from lp.app.browser.linkchecker import LinkCheckerAPI
+from lp.registry.enums import InformationType
from lp.services.webapp.servers import LaunchpadTestRequest
from lp.testing import TestCaseWithFactory
from lp.testing.layers import DatabaseFunctionalLayer
@@ -67,7 +68,8 @@
As far as searchBugs() is concerned, this is an invalid bug to the
currently authenticated user
"""
- bug_private = self.factory.makeBug(private=True)
+ bug_private = self.factory.makeBug(
+ information_type=InformationType.USERDATA)
return ['/bugs/%d' % (bug_private.id)]
def invoke_link_checker(
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2012-05-01 07:24:59 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2012-05-02 05:31:18 +0000
@@ -1860,7 +1860,7 @@
if bugtask is None:
owner = factory.makePerson()
bug = factory.makeBug(
- owner=owner, private=True, security_related=True)
+ owner=owner, information_type=InformationType.EMBARGOEDSECURITY)
with person_logged_in(owner):
bugtask = bug.default_bugtask
else:
=== modified file 'lib/lp/bugs/doc/bugattachments.txt'
--- lib/lp/bugs/doc/bugattachments.txt 2012-04-10 14:01:17 +0000
+++ lib/lp/bugs/doc/bugattachments.txt 2012-05-02 05:31:18 +0000
@@ -615,9 +615,12 @@
If an attachment is added to a private bug, the "restricted" flag of
its Librarian file is set.
+ >>> from lp.registry.enums import InformationType
>>> private_bug_owner = factory.makePerson()
>>> ignored = login_person(private_bug_owner)
- >>> private_bug = factory.makeBug(private=True, owner=private_bug_owner)
+ >>> private_bug = factory.makeBug(
+ ... information_type=InformationType.USERDATA,
+ ... owner=private_bug_owner)
>>> private_attachment = private_bug.addAttachment(
... owner=private_bug_owner, data="secret", filename="baz.txt",
... comment="Some attachment")
=== modified file 'lib/lp/bugs/doc/bugsummary.txt'
--- lib/lp/bugs/doc/bugsummary.txt 2011-12-21 14:58:31 +0000
+++ lib/lp/bugs/doc/bugsummary.txt 2012-05-02 05:31:18 +0000
@@ -419,17 +419,20 @@
distribution task. Subscribed to by team_c.
- bug_z is public.
+ >>> from lp.registry.enums import InformationType
>>> distro_p = factory.makeDistribution(name='di-p')
>>> series_p = factory.makeDistroSeries(
... distribution=distro_p, name='ds-p')
>>> bug_a = factory.makeBug(
- ... owner=owner, distribution=distro_p, private=True)
+ ... owner=owner, distribution=distro_p,
+ ... information_type=InformationType.USERDATA)
>>> bug_b = factory.makeBug(
- ... owner=owner, distribution=distro_p, private=True)
+ ... owner=owner, distribution=distro_p,
+ ... information_type=InformationType.USERDATA)
>>> bug_c = factory.makeBug(
- ... owner=owner, series=series_p, private=True)
- >>> bug_z = factory.makeBug(
- ... owner=owner, distribution=distro_p, private=False)
+ ... owner=owner, series=series_p,
+ ... information_type=InformationType.USERDATA)
+ >>> bug_z = factory.makeBug(owner=owner, distribution=distro_p)
>>> sub = bug_a.subscribe(team_a, person_a)
>>> sub = bug_b.subscribe(person_b, person_b)
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2012-04-29 22:54:49 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2012-05-02 05:31:18 +0000
@@ -803,9 +803,10 @@
# Public security bugs are currently untested since it is impossible
# to create one at the moment.
bug = self.factory.makeBug()
- private_bug = self.factory.makeBug(private=True)
+ private_bug = self.factory.makeBug(
+ information_type=InformationType.USERDATA)
private_sec_bug = self.factory.makeBug(
- private=True, security_related=True)
+ information_type=InformationType.EMBARGOEDSECURITY)
mapping = (
(bug, InformationType.PUBLIC),
(private_bug, InformationType.USERDATA),
@@ -826,7 +827,7 @@
TestEventListener(IBug, IObjectModifiedEvent, event_callback)
owner = self.factory.makePerson()
bug = self.factory.makeBug(
- private=True, security_related=True, owner=owner)
+ information_type=InformationType.EMBARGOEDSECURITY, owner=owner)
with person_logged_in(owner):
bug.transitionToInformationType(InformationType.PUBLIC, owner)
self.assertEqual(['information_type'], self.event_edited_fields)
@@ -836,7 +837,8 @@
# A private bug transitioning to public has the correct information
# type.
owner = self.factory.makePerson()
- bug = self.factory.makeBug(private=True, owner=owner)
+ bug = self.factory.makeBug(
+ information_type=InformationType.USERDATA, owner=owner)
with person_logged_in(owner):
bug.setPrivate(False, owner)
self.assertEqual(InformationType.PUBLIC, bug.information_type)
@@ -846,7 +848,7 @@
# correct information type.
owner = self.factory.makePerson()
bug = self.factory.makeBug(
- private=True, security_related=True, owner=owner)
+ information_type=InformationType.EMBARGOEDSECURITY, owner=owner)
with person_logged_in(owner):
bug.setPrivate(False, owner)
self.assertEqual(
@@ -857,7 +859,7 @@
# information type.
owner = self.factory.makePerson()
bug = self.factory.makeBug(
- private=True, security_related=True, owner=owner)
+ information_type=InformationType.EMBARGOEDSECURITY, owner=owner)
with person_logged_in(owner):
bug.transitionToInformationType(InformationType.PUBLIC, owner)
self.assertEqual(InformationType.PUBLIC, bug.information_type)
@@ -878,7 +880,8 @@
product.addSubscription(product.owner, product.owner)
reporter = self.factory.makePerson()
bug = self.factory.makeBug(
- private=True, product=product, owner=reporter)
+ information_type=InformationType.USERDATA, product=product,
+ owner=reporter)
recipients = Store.of(bug).using(
BugNotificationRecipient,
Join(BugNotification, BugNotification.bugID == bug.id)).find(
=== modified file 'lib/lp/bugs/model/tests/test_bugsummary.py'
--- lib/lp/bugs/model/tests/test_bugsummary.py 2012-01-20 15:42:44 +0000
+++ lib/lp/bugs/model/tests/test_bugsummary.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the BugSummary class and underlying database triggers."""
@@ -18,6 +18,7 @@
from lp.bugs.model.bug import BugTag
from lp.bugs.model.bugsummary import BugSummary
from lp.bugs.model.bugtask import BugTask
+from lp.registry.enums import InformationType
from lp.registry.model.teammembership import TeamParticipation
from lp.services.database.lpstorm import IMasterStore
from lp.testing import TestCaseWithFactory
@@ -275,7 +276,8 @@
def test_makePublic(self):
product = self.factory.makeProduct()
- bug = self.factory.makeBug(product=product, private=True)
+ bug = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA)
person_a = self.factory.makePerson()
person_b = self.factory.makePerson()
@@ -298,7 +300,8 @@
def test_subscribePrivate(self):
product = self.factory.makeProduct()
- bug = self.factory.makeBug(product=product, private=True)
+ bug = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA)
person_a = self.factory.makePerson()
person_b = self.factory.makePerson()
@@ -316,7 +319,8 @@
def test_unsubscribePrivate(self):
product = self.factory.makeProduct()
- bug = self.factory.makeBug(product=product, private=True)
+ bug = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA)
person_a = self.factory.makePerson()
person_b = self.factory.makePerson()
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2012-04-26 06:38:34 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2012-05-02 05:31:18 +0000
@@ -61,8 +61,8 @@
from lp.registry.interfaces.product import IProductSet
from lp.registry.interfaces.projectgroup import IProjectGroupSet
from lp.services.database.sqlbase import (
+ convert_storm_clause_to_string,
flush_database_updates,
- convert_storm_clause_to_string,
)
from lp.services.searchbuilder import (
all,
@@ -999,9 +999,12 @@
"""Private bugs from a search know the user can see the bugs."""
target = self.makeBugTarget()
person = self.login()
- self.factory.makeBug(product=target, private=True, owner=person)
- self.factory.makeBug(product=target, private=True, owner=person)
- self.factory.makeBug(product=target, private=True, owner=person)
+ self.factory.makeBug(product=target, owner=person,
+ information_type=InformationType.USERDATA)
+ self.factory.makeBug(product=target, owner=person,
+ information_type=InformationType.USERDATA)
+ self.factory.makeBug(product=target, owner=person,
+ information_type=InformationType.USERDATA)
# Search style and parameters taken from the milestone index view
# where the issue was discovered.
login_person(person)
=== modified file 'lib/lp/bugs/tests/test_bug_mirror_access_triggers.py'
--- lib/lp/bugs/tests/test_bug_mirror_access_triggers.py 2012-04-19 21:15:25 +0000
+++ lib/lp/bugs/tests/test_bug_mirror_access_triggers.py 2012-05-02 05:31:18 +0000
@@ -74,7 +74,12 @@
def makeBugAndPolicies(self, private=False):
product = self.factory.makeProduct()
- bug = self.factory.makeBug(private=private, product=product)
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
+ bug = self.factory.makeBug(
+ product=product, information_type=information_type)
return removeSecurityProxy(bug)
def getPoliciesForArtifact(self, artifact):
=== modified file 'lib/lp/bugs/tests/test_bugbranch.py'
--- lib/lp/bugs/tests/test_bugbranch.py 2012-02-08 04:26:40 +0000
+++ lib/lp/bugs/tests/test_bugbranch.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for bug-branch linking from the bugs side."""
@@ -17,6 +17,7 @@
BugBranch,
BugBranchSet,
)
+from lp.registry.enums import InformationType
from lp.testing import (
anonymous_logged_in,
celebrity_logged_in,
@@ -47,7 +48,7 @@
branch_1 = self.factory.makeBranch()
branch_2 = self.factory.makeBranch()
bug_a = self.factory.makeBug()
- bug_b = self.factory.makeBug()
+ self.factory.makeBug()
self.factory.loginAsAnyone()
bug_a.linkBranch(branch_1, self.factory.makePerson())
bug_a.linkBranch(branch_2, self.factory.makePerson())
@@ -97,7 +98,7 @@
# getBranchesWithVisibleBugs does not show private bugs to users
# who aren't logged in.
branch = self.factory.makeBranch()
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
with celebrity_logged_in('admin'):
bug.linkBranch(branch, self.factory.makePerson())
utility = getUtility(IBugBranchSet)
@@ -109,7 +110,7 @@
# arbitrary logged-in users (such as Average Joe, or J. Random
# Hacker).
branch = self.factory.makeBranch()
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
with celebrity_logged_in('admin'):
bug.linkBranch(branch, self.factory.makePerson())
utility = getUtility(IBugBranchSet)
@@ -122,7 +123,7 @@
# getBranchesWithVisibleBugs will show private bugs to their
# subscribers.
branch = self.factory.makeBranch()
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
user = self.factory.makePerson()
with celebrity_logged_in('admin'):
bug.subscribe(user, self.factory.makePerson())
@@ -135,7 +136,7 @@
# getBranchesWithVisibleBugs will show private bugs to their
# assignees.
branch = self.factory.makeBranch()
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
user = self.factory.makePerson()
with celebrity_logged_in('admin'):
bug.default_bugtask.transitionToAssignee(user)
@@ -147,7 +148,7 @@
def test_getBranchesWithVisibleBugs_shows_private_bugs_to_admins(self):
# getBranchesWithVisibleBugs will show private bugs to admins.
branch = self.factory.makeBranch()
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
with celebrity_logged_in('admin'):
bug.linkBranch(branch, self.factory.makePerson())
utility = getUtility(IBugBranchSet)
@@ -261,12 +262,12 @@
def test_the_unwashed_cannot_link_branch_to_private_bug(self):
# Those who cannot see a bug are forbidden to link a branch to it.
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
self.assertRaises(Unauthorized, getattr, bug, 'linkBranch')
def test_the_unwashed_cannot_unlink_branch_from_private_bug(self):
# Those who cannot see a bug are forbidden to unlink branches from it.
- bug = self.factory.makeBug(private=True)
+ bug = self.factory.makeBug(information_type=InformationType.USERDATA)
self.assertRaises(Unauthorized, getattr, bug, 'unlinkBranch')
def test_anonymous_users_cannot_link_branches(self):
=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
--- lib/lp/bugs/tests/test_bugchanges.py 2012-04-27 05:56:48 +0000
+++ lib/lp/bugs/tests/test_bugchanges.py 2012-05-02 05:31:18 +0000
@@ -235,7 +235,8 @@
subscriber = self.factory.makePerson(displayname='Mom')
# Create the private bug.
bug = self.factory.makeBug(
- product=self.product, owner=self.user, private=True)
+ product=self.product, owner=self.user,
+ information_type=InformationType.USERDATA)
bug.subscribe(subscriber, self.user)
self.saveOldChanges(bug=bug)
bug.unsubscribe(subscriber, subscriber)
@@ -582,11 +583,12 @@
def test_make_public(self):
# Marking a bug as public adds items to the bug's activity log
# and notifications.
- private_bug = self.factory.makeBug(private=True)
+ private_bug = self.factory.makeBug(
+ information_type=InformationType.USERDATA)
self.saveOldChanges(private_bug)
self.assertTrue(private_bug.private)
-
- private_bug.setPrivate(False, self.user)
+ private_bug.transitionToInformationType(
+ InformationType.PUBLIC, self.user)
visibility_change_activity = {
'person': self.user,
@@ -1076,7 +1078,8 @@
def test_retarget_private_security_bug_to_product(self):
# A series of tests for re-targetting a private bug task.
bug = self.factory.makeBug(
- product=self.product, owner=self.user, private=True)
+ product=self.product, owner=self.user,
+ information_type=InformationType.USERDATA)
maintainer = self.factory.makePerson()
bug_supervisor = self.factory.makePerson()
@@ -1158,7 +1161,8 @@
new_product = self.factory.makeProduct()
subscriber = self.factory.makePerson()
new_product.addBugSubscription(subscriber, subscriber)
- bug = self.factory.makeBug(product=old_product, private=True)
+ bug = self.factory.makeBug(
+ product=old_product, information_type=InformationType.USERDATA)
bug.default_bugtask.transitionToTarget(new_product)
self.assertNotIn(subscriber, bug.getDirectSubscribers())
self.assertNotIn(subscriber, bug.getIndirectSubscribers())
@@ -1307,7 +1311,8 @@
# Create the private bug.
bug = self.factory.makeBug(
- product=self.product, owner=self.user, private=True)
+ product=self.product, owner=self.user,
+ information_type=InformationType.USERDATA)
bug_task = bug.bugtasks[0]
# Create a test assignee.
old_assignee = self.factory.makePerson()
=== modified file 'lib/lp/bugs/tests/test_bugnotification.py'
--- lib/lp/bugs/tests/test_bugnotification.py 2012-02-24 01:14:29 +0000
+++ lib/lp/bugs/tests/test_bugnotification.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests related to bug notifications."""
@@ -32,6 +32,7 @@
BugNotificationSet,
)
from lp.bugs.model.bugsubscriptionfilter import BugSubscriptionFilterMute
+from lp.registry.enums import InformationType
from lp.services.config import config
from lp.services.messages.interfaces.message import IMessageSet
from lp.services.messages.model.message import MessageSet
@@ -67,7 +68,8 @@
self.bug_subscriber = factory.makePerson(name="bug-subscriber")
self.bug_owner = factory.makePerson(name="bug-owner")
self.private_bug = factory.makeBug(
- product=self.product, private=True, owner=self.bug_owner)
+ product=self.product, owner=self.bug_owner,
+ information_type=InformationType.USERDATA)
self.reporter = self.private_bug.owner
self.private_bug.subscribe(self.bug_subscriber, self.reporter)
[self.product_bugtask] = self.private_bug.bugtasks
=== modified file 'lib/lp/bugs/tests/test_bugtaskflat_triggers.py'
--- lib/lp/bugs/tests/test_bugtaskflat_triggers.py 2012-04-03 06:14:09 +0000
+++ lib/lp/bugs/tests/test_bugtaskflat_triggers.py 2012-05-02 05:31:18 +0000
@@ -14,8 +14,8 @@
from lp.bugs.model.bug import Bug
from lp.registry.enums import InformationType
from lp.registry.interfaces.accesspolicy import (
+ IAccessArtifactGrantSource,
IAccessArtifactSource,
- IAccessArtifactGrantSource,
IAccessPolicyArtifactSource,
IAccessPolicySource,
)
@@ -28,6 +28,7 @@
from lp.testing.dbuser import dbuser
from lp.testing.layers import DatabaseFunctionalLayer
+
BUGTASKFLAT_COLUMNS = (
'bugtask',
'bug',
@@ -90,8 +91,13 @@
def makeLoggedInTask(self, private=False):
owner = self.factory.makePerson()
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
login_person(owner)
- bug = self.factory.makeBug(private=private, owner=owner)
+ bug = self.factory.makeBug(
+ information_type=information_type, owner=owner)
return bug.default_bugtask
@contextmanager
=== modified file 'lib/lp/bugs/tests/test_bugtaskset.py'
--- lib/lp/bugs/tests/test_bugtaskset.py 2011-12-30 06:14:56 +0000
+++ lib/lp/bugs/tests/test_bugtaskset.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for BugTaskSet."""
@@ -12,6 +12,7 @@
BugTaskStatusSearch,
IBugTaskSet,
)
+from lp.registry.enums import InformationType
from lp.services.database.sqlbase import flush_database_updates
from lp.testing import (
login_person,
@@ -38,13 +39,19 @@
return self.bugtask_set.getStatusCountsForProductSeries(
user, self.series)
+ def createBugs(self):
+ self.factory.makeBug(milestone=self.milestone)
+ self.factory.makeBug(
+ milestone=self.milestone,
+ information_type=InformationType.USERDATA)
+ self.factory.makeBug(series=self.series)
+ self.factory.makeBug(
+ series=self.series, information_type=InformationType.USERDATA)
+
def test_privacy_and_counts_for_unauthenticated_user(self):
# An unauthenticated user should see bug counts for each status
# that do not include private bugs.
- self.factory.makeBug(milestone=self.milestone)
- self.factory.makeBug(milestone=self.milestone, private=True)
- self.factory.makeBug(series=self.series)
- self.factory.makeBug(series=self.series, private=True)
+ self.createBugs()
self.assertEqual(
{BugTaskStatus.NEW: 2},
self.get_counts(None))
@@ -52,10 +59,7 @@
def test_privacy_and_counts_for_owner(self):
# The owner should see bug counts for each status that do
# include all private bugs.
- self.factory.makeBug(milestone=self.milestone)
- self.factory.makeBug(milestone=self.milestone, private=True)
- self.factory.makeBug(series=self.series)
- self.factory.makeBug(series=self.series, private=True)
+ self.createBugs()
self.assertEqual(
{BugTaskStatus.NEW: 4},
self.get_counts(self.owner))
@@ -65,10 +69,7 @@
# status that do include all private bugs, since it is costly to
# query just the private bugs that the user has access to view,
# and this query may be run many times on a single page.
- self.factory.makeBug(milestone=self.milestone)
- self.factory.makeBug(milestone=self.milestone, private=True)
- self.factory.makeBug(series=self.series)
- self.factory.makeBug(series=self.series, private=True)
+ self.createBugs()
other = self.factory.makePerson()
self.assertEqual(
{BugTaskStatus.NEW: 4},
=== modified file 'lib/lp/bugs/tests/test_bugvisibility.py'
--- lib/lp/bugs/tests/test_bugvisibility.py 2012-04-19 21:15:25 +0000
+++ lib/lp/bugs/tests/test_bugvisibility.py 2012-05-02 05:31:18 +0000
@@ -1,8 +1,9 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for visibility of a bug."""
+from lp.registry.enums import InformationType
from lp.testing import (
celebrity_logged_in,
TestCaseWithFactory,
@@ -54,7 +55,8 @@
bug_supervisor=self.bug_team,
user=self.product.owner)
self.bug = self.factory.makeBug(
- owner=self.owner, private=True, product=self.product)
+ owner=self.owner, product=self.product,
+ information_type=InformationType.USERDATA)
def test_privateBugRegularUser(self):
# A regular (non-privileged) user can not view a private bug.
=== modified file 'lib/lp/code/browser/tests/test_branch.py'
--- lib/lp/code/browser/tests/test_branch.py 2012-03-07 00:58:37 +0000
+++ lib/lp/code/browser/tests/test_branch.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for BranchView."""
@@ -33,6 +33,7 @@
BranchType,
BranchVisibilityRule,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import PersonVisibility
from lp.services.config import config
from lp.services.database.constants import UTC_NOW
@@ -303,7 +304,8 @@
# can't see any of the tasks.
branch = self.factory.makeAnyBranch()
reporter = self.factory.makePerson()
- bug = self.factory.makeBug(private=True, owner=reporter)
+ bug = self.factory.makeBug(
+ owner=reporter, information_type=InformationType.USERDATA)
with person_logged_in(reporter):
branch.linkBug(bug, reporter)
view = create_initialized_view(branch, '+index')
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-03-27 04:36:24 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-02 05:31:18 +0000
@@ -53,6 +53,7 @@
add_revision_to_branch,
make_merge_proposal_without_reviewers,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import PersonVisibility
from lp.services.messages.model.message import MessageSet
from lp.services.webapp import canonical_url
@@ -890,7 +891,8 @@
"""List bugs that are linked to the source only."""
bug = self.factory.makeBug()
person = self.factory.makePerson()
- private_bug = self.factory.makeBug(owner=person, private=True)
+ private_bug = self.factory.makeBug(
+ owner=person, information_type=InformationType.USERDATA)
self.bmp.source_branch.linkBug(bug, self.bmp.registrant)
with person_logged_in(person):
self.bmp.source_branch.linkBug(private_bug, self.bmp.registrant)
=== modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py'
--- lib/lp/code/mail/tests/test_branchmergeproposal.py 2012-01-01 02:58:52 +0000
+++ lib/lp/code/mail/tests/test_branchmergeproposal.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for BranchMergeProposal mailings"""
@@ -30,6 +30,7 @@
from lp.code.model.codereviewvote import CodeReviewVoteReference
from lp.code.model.diff import PreviewDiff
from lp.code.subscribers.branchmergeproposal import merge_proposal_modified
+from lp.registry.enums import InformationType
from lp.services.database.lpstorm import IStore
from lp.services.webapp import canonical_url
from lp.testing import (
@@ -219,9 +220,8 @@
bugtask = bug.default_bugtask
bmp.source_branch.linkBug(bug, bmp.registrant)
private_bug = self.factory.makeBug(
- title='I am a private bug',
- owner=private_bug_owner,
- private=True)
+ title='I am a private bug', owner=private_bug_owner,
+ information_type=InformationType.USERDATA)
private_bugtask = private_bug.default_bugtask
with person_logged_in(private_bug_owner):
bmp.source_branch.linkBug(private_bug, bmp.registrant)
=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
--- lib/lp/code/model/tests/test_branchmergeproposal.py 2012-04-27 19:03:32 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-02 05:31:18 +0000
@@ -62,6 +62,7 @@
add_revision_to_branch,
make_merge_proposal_without_reviewers,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.product import IProductSet
from lp.services.database.constants import UTC_NOW
@@ -77,9 +78,7 @@
WebServiceTestCase,
ws_object,
)
-from lp.testing.factory import (
- LaunchpadObjectFactory,
- )
+from lp.testing.factory import LaunchpadObjectFactory
from lp.testing.layers import (
DatabaseFunctionalLayer,
LaunchpadFunctionalLayer,
@@ -1274,7 +1273,8 @@
bmp.source_branch.linkBug(bug, bmp.registrant)
person = self.factory.makePerson()
with person_logged_in(person):
- private_bug = self.factory.makeBug(private=True, owner=person)
+ private_bug = self.factory.makeBug(
+ owner=person, information_type=InformationType.USERDATA)
bmp.source_branch.linkBug(private_bug, person)
private_tasks = private_bug.bugtasks
self.assertEqual(
=== modified file 'lib/lp/registry/browser/tests/milestone-views.txt'
--- lib/lp/registry/browser/tests/milestone-views.txt 2012-04-10 14:01:17 +0000
+++ lib/lp/registry/browser/tests/milestone-views.txt 2012-05-02 05:31:18 +0000
@@ -445,7 +445,8 @@
>>> milestone = hoary_series.newMilestone('alpha')
>>> view = create_initialized_view(milestone, '+edit')
>>> view.field_names
- ['name', 'code_name', 'active', 'dateexpected', 'tags', 'summary', 'distroseries']
+ ['name', 'code_name', 'active', 'dateexpected', 'tags', 'summary',
+ 'distroseries']
The distroseries milestone can be updated too.
@@ -736,7 +737,9 @@
>>> ignored = login_person(owner)
>>> milestone = firefox_1_0.newMilestone('1.0.13')
- >>> private_bug = factory.makeBug(product=firefox, private=True)
+ >>> from lp.registry.enums import InformationType
+ >>> private_bug = factory.makeBug(
+ ... product=firefox, information_type=InformationType.USERDATA)
>>> private_bugtask = bug.bugtasks[0]
>>> private_bugtask.milestone = milestone
>>> view = create_initialized_view(milestone, '+delete')
=== modified file 'lib/lp/registry/browser/tests/test_milestone.py'
--- lib/lp/registry/browser/tests/test_milestone.py 2012-04-26 06:38:34 +0000
+++ lib/lp/registry/browser/tests/test_milestone.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test milestone views."""
@@ -12,6 +12,7 @@
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.bugs.interfaces.bugtask import IBugTaskSet
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import TeamSubscriptionPolicy
from lp.registry.model.milestonetag import ProjectGroupMilestoneTag
from lp.services.config import config
@@ -318,7 +319,8 @@
login_person(product.owner)
milestone = self.factory.makeMilestone(
productseries=product.development_focus)
- bug1 = self.factory.makeBug(product=product, private=True,
+ bug1 = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA,
owner=product.owner)
bug1.bugtasks[0].transitionToMilestone(milestone, product.owner)
# We look at the page as someone who is a member of a team and the
@@ -347,12 +349,14 @@
with_1_queries = ["%s: %s" % (pos, stmt[3]) for (pos, stmt) in
enumerate(collector.queries)]
login_person(product.owner)
- bug2 = self.factory.makeBug(product=product, private=True,
+ bug2 = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA,
owner=product.owner)
bug2.bugtasks[0].transitionToMilestone(milestone, product.owner)
bug2.subscribe(subscribed_team, product.owner)
bug2_url = canonical_url(bug2)
- bug3 = self.factory.makeBug(product=product, private=True,
+ bug3 = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA,
owner=product.owner)
bug3.bugtasks[0].transitionToMilestone(milestone, product.owner)
bug3.subscribe(subscribed_team, product.owner)
=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-04-27 19:52:37 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-05-02 05:31:18 +0000
@@ -35,9 +35,7 @@
)
from lp.testing.layers import DatabaseFunctionalLayer
from lp.testing.matchers import HasQueryCount
-from lp.testing.pages import (
- setupBrowserForUser,
- )
+from lp.testing.pages import setupBrowserForUser
from lp.testing.views import (
create_initialized_view,
create_view,
@@ -90,9 +88,7 @@
if with_branch and self.pillar_type == 'product':
branch = self.factory.makeBranch(
- product=self.pillar,
- owner=self.pillar.owner,
- private=True)
+ product=self.pillar, owner=self.pillar.owner, private=True)
artifacts.append(
self.factory.makeAccessArtifact(concrete=branch))
@@ -103,14 +99,12 @@
owner = self.pillar.owner
if self.pillar_type == 'product':
bug = self.factory.makeBug(
- product=self.pillar,
- owner=owner,
- private=True)
+ product=self.pillar, owner=owner,
+ information_type=InformationType.USERDATA)
elif self.pillar_type == 'distribution':
bug = self.factory.makeBug(
- distribution=self.pillar,
- owner=owner,
- private=True)
+ distribution=self.pillar, owner=owner,
+ information_type=InformationType.USERDATA)
artifacts.append(
self.factory.makeAccessArtifact(concrete=bug))
@@ -251,8 +245,6 @@
class TestProductSharingDetailsView(
SharingBaseTestCase, PillarSharingDetailsMixin):
- pillar_type = 'product'
-
def setUp(self):
super(TestProductSharingDetailsView, self).setUp()
login_person(self.owner)
@@ -261,8 +253,6 @@
class TestDistributionSharingDetailsView(
SharingBaseTestCase, PillarSharingDetailsMixin):
- pillar_type = 'distribution'
-
def setUp(self):
super(TestDistributionSharingDetailsView, self).setUp()
login_person(self.owner)
=== modified file 'lib/lp/registry/browser/tests/test_team.py'
--- lib/lp/registry/browser/tests/test_team.py 2012-04-20 07:01:18 +0000
+++ lib/lp/registry/browser/tests/test_team.py 2012-05-02 05:31:18 +0000
@@ -16,6 +16,7 @@
TeamMailingListArchiveView,
TeamOverviewMenu,
)
+from lp.registry.enums import InformationType
from lp.registry.interfaces.mailinglist import MailingListStatus
from lp.registry.interfaces.person import (
CLOSED_TEAM_POLICY,
@@ -368,7 +369,9 @@
# the team is subscribed to a private bug.
def setup_team(team):
- bug = self.factory.makeBug(owner=team.teamowner, private=True)
+ bug = self.factory.makeBug(
+ owner=team.teamowner,
+ information_type=InformationType.USERDATA)
with person_logged_in(team.teamowner):
bug.default_bugtask.transitionToAssignee(team)
=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_sharingservice.py 2012-04-26 07:54:34 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py 2012-05-02 05:31:18 +0000
@@ -646,7 +646,8 @@
distro = self.factory.makeDistribution(owner=owner)
login_person(owner)
bug = self.factory.makeBug(
- distribution=distro, owner=owner, private=True)
+ distribution=distro, owner=owner,
+ information_type=InformationType.USERDATA)
self._assert_revokeAccessGrants(distro, [bug], None)
def test_revokeAccessGrantsBranches(self):
@@ -662,7 +663,8 @@
# revokeAccessGrants raises an Unauthorized exception if the user
# is not permitted to do so.
product = self.factory.makeProduct()
- bug = self.factory.makeBug(product=product, private=True)
+ bug = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA)
sharee = self.factory.makePerson()
with FeatureFixture(WRITE_FLAG):
self.assertRaises(
@@ -685,7 +687,8 @@
# The feature flag needs to be enabled.
owner = self.factory.makePerson()
product = self.factory.makeProduct(owner=owner)
- bug = self.factory.makeBug(product=product, private=True)
+ bug = self.factory.makeBug(
+ product=product, information_type=InformationType.USERDATA)
sharee = self.factory.makePerson()
login_person(owner)
self.assertRaises(
=== modified file 'lib/lp/registry/tests/test_person.py'
--- lib/lp/registry/tests/test_person.py 2012-05-01 06:49:04 +0000
+++ lib/lp/registry/tests/test_person.py 2012-05-02 05:31:18 +0000
@@ -27,6 +27,7 @@
from lp.bugs.interfaces.bugtask import IllegalRelatedBugTasksParams
from lp.bugs.model.bug import Bug
from lp.bugs.model.bugtask import get_related_bugtasks_search_params
+from lp.registry.enums import InformationType
from lp.registry.errors import PrivatePersonLinkageError
from lp.registry.interfaces.karma import IKarmaCacheManager
from lp.registry.interfaces.person import (
@@ -1326,10 +1327,14 @@
def test_skips_private_bugs_the_user_is_not_allowed_to_see(self):
milestone = self.factory.makeMilestone(dateexpected=self.today)
private_bug = removeSecurityProxy(
- self.factory.makeBug(milestone=milestone, private=True))
+ self.factory.makeBug(
+ milestone=milestone,
+ information_type=InformationType.USERDATA))
self._assignBugTaskToTeamOwner(private_bug.bugtasks[0])
private_bug2 = removeSecurityProxy(
- self.factory.makeBug(milestone=milestone, private=True))
+ self.factory.makeBug(
+ milestone=milestone,
+ information_type=InformationType.USERDATA))
self._assignBugTaskToTeamOwner(private_bug2.bugtasks[0])
with person_logged_in(private_bug2.owner):
=== modified file 'lib/lp/registry/tests/test_private_team_visibility.py'
--- lib/lp/registry/tests/test_private_team_visibility.py 2012-04-20 07:01:18 +0000
+++ lib/lp/registry/tests/test_private_team_visibility.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for visibility of private teams.
@@ -20,6 +20,7 @@
from zope.component import getUtility
from zope.security.interfaces import Unauthorized
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import (
PersonVisibility,
TeamSubscriptionPolicy,
@@ -290,8 +291,13 @@
# Users can see teams subscribed to bugs.
bug_owner = self.factory.makePerson()
product = self.factory.makeProduct(owner=bug_owner)
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
bug = self.factory.makeBug(
- owner=bug_owner, product=product, private=private)
+ owner=bug_owner, product=product,
+ information_type=information_type)
# Initially no visibility.
some_person = self.factory.makePerson()
self._check_permission(some_person, False)
@@ -319,8 +325,13 @@
# Users can see teams assigned to bugs.
bug_owner = self.factory.makePerson()
product = self.factory.makeProduct(owner=bug_owner)
+ if private:
+ information_type = InformationType.USERDATA
+ else:
+ information_type = InformationType.PUBLIC
bug = self.factory.makeBug(
- owner=bug_owner, product=product, private=private)
+ owner=bug_owner, product=product,
+ information_type=information_type)
# Initially no visibility.
some_person = self.factory.makePerson()
self._check_permission(some_person, False)
=== modified file 'lib/lp/registry/tests/test_team.py'
--- lib/lp/registry/tests/test_team.py 2012-03-22 14:15:46 +0000
+++ lib/lp/registry/tests/test_team.py 2012-05-02 05:31:18 +0000
@@ -10,7 +10,10 @@
from zope.interface.exceptions import Invalid
from zope.security.proxy import removeSecurityProxy
-from lp.registry.enums import PersonTransferJobType
+from lp.registry.enums import (
+ InformationType,
+ PersonTransferJobType,
+ )
from lp.registry.errors import (
JoinNotAllowed,
TeamSubscriptionPolicyError,
@@ -400,7 +403,9 @@
def test_closed_team_with_private_bugs_cannot_become_open(self):
# The team cannot become open if it is subscribed to private bugs.
self.setUpTeams()
- bug = self.factory.makeBug(owner=self.team.teamowner, private=True)
+ bug = self.factory.makeBug(
+ owner=self.team.teamowner,
+ information_type=InformationType.USERDATA)
with person_logged_in(self.team.teamowner):
bug.subscribe(self.team, self.team.teamowner)
self.assertFalse(
@@ -412,7 +417,9 @@
def test_closed_team_with_private_bugs_assigned_cannot_become_open(self):
# The team cannot become open if it is assigned private bugs.
self.setUpTeams()
- bug = self.factory.makeBug(owner=self.team.teamowner, private=True)
+ bug = self.factory.makeBug(
+ owner=self.team.teamowner,
+ information_type=InformationType.USERDATA)
with person_logged_in(self.team.teamowner):
bug.default_bugtask.transitionToAssignee(self.team)
self.assertFalse(
=== modified file 'lib/lp/registry/tests/test_team_webservice.py'
--- lib/lp/registry/tests/test_team_webservice.py 2012-04-20 05:00:49 +0000
+++ lib/lp/registry/tests/test_team_webservice.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -10,14 +10,12 @@
Unauthorized,
)
import transaction
-from zope.component import getUtility
+from lp.registry.enums import InformationType
from lp.registry.interfaces.person import (
PersonVisibility,
TeamSubscriptionPolicy,
)
-from lp.soyuz.enums import ArchivePurpose
-from lp.soyuz.interfaces.archive import IArchiveSet
from lp.testing import (
ExpectedException,
launchpadlib_for,
@@ -91,14 +89,14 @@
subscription_policy=TeamSubscriptionPolicy.RESTRICTED)
# Create a P3A for the team.
with person_logged_in(team_owner):
- getUtility(IArchiveSet).new(
- owner=db_team, purpose=ArchivePurpose.PPA,
- private=True, name='private-ppa')
+ self.factory.makeArchive(
+ owner=db_team, private=True, name='private-ppa')
# Create an authorised user with limitedView permission on the team.
# We do that by subscribing the team and the user to the same
# private bug.
self.bug_owner = self.factory.makePerson()
- bug = self.factory.makeBug(owner=self.bug_owner, private=True)
+ bug = self.factory.makeBug(
+ owner=self.bug_owner, information_type=InformationType.USERDATA)
self.authorised_person = self.factory.makePerson()
with person_logged_in(self.bug_owner):
bug.subscribe(db_team, self.bug_owner)
=== modified file 'lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py'
--- lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py 2012-05-02 05:31:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -8,6 +8,7 @@
from zope.component import getMultiAdapter
from zope.security.interfaces import Unauthorized
+from lp.registry.enums import InformationType
from lp.services.librarian.interfaces import ILibraryFileAliasWithParent
from lp.testing import (
login_person,
@@ -25,7 +26,8 @@
super(TestLibraryFileAliasForBugAttachment, self).setUp()
self.bug_owner = self.factory.makePerson()
login_person(self.bug_owner)
- self.bug = self.factory.makeBug(owner=self.bug_owner, private=True)
+ self.bug = self.factory.makeBug(
+ owner=self.bug_owner, information_type=InformationType.USERDATA)
self.bug_attachment = self.factory.makeBugAttachment(bug=self.bug)
self.lfa_with_parent = getMultiAdapter(
(self.bug_attachment.libraryfile, self.bug_attachment),
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2012-05-01 11:13:13 +0000
+++ lib/lp/testing/factory.py 2012-05-02 05:31:18 +0000
@@ -76,7 +76,6 @@
)
from lp.blueprints.interfaces.specification import ISpecificationSet
from lp.blueprints.interfaces.sprint import ISprintSet
-from lp.bugs.adapters.bug import convert_to_information_type
from lp.bugs.interfaces.bug import (
CreateBugParams,
IBugSet,
@@ -1638,11 +1637,10 @@
return branch.createBranchRevision(sequence, revision)
def makeBug(self, product=None, owner=None, bug_watch_url=None,
- private=False, security_related=False, information_type=None,
- date_closed=None, title=None, date_created=None,
- description=None, comment=None, status=None,
- distribution=None, milestone=None, series=None, tags=None,
- sourcepackagename=None):
+ information_type=InformationType.PUBLIC, date_closed=None,
+ title=None, date_created=None, description=None,
+ comment=None, status=None, distribution=None, milestone=None,
+ series=None, tags=None, sourcepackagename=None):
"""Create and return a new, arbitrary Bug.
The bug returned uses default values where possible. See
@@ -1689,10 +1687,6 @@
self.makeSourcePackagePublishingHistory(
distroseries=distribution.currentseries,
sourcepackagename=sourcepackagename)
- # Factory changes delayed for a seperate branch.
- if information_type is None:
- information_type = convert_to_information_type(
- private, security_related)
create_bug_params = CreateBugParams(
owner, title, comment=comment, information_type=information_type,
datecreated=date_created, description=description,
Follow ups