Merge lp:~stevenk/launchpad/bugs-factory-information_type into lp:launchpad
- bugs-factory-information_type
- Merge into devel
Proposed by
Steve Kowalik
on 2012-05-02
| Status: | Merged |
|---|---|
| Approved by: | Steve Kowalik on 2012-05-02 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15194 |
| Proposed branch: | lp:~stevenk/launchpad/bugs-factory-information_type |
| Merge into: | lp:launchpad |
| Diff against target: |
1126 lines (+199/-127) 32 files modified
lib/lp/app/browser/tests/launchpad-search-pages.txt (+3/-1) lib/lp/app/browser/tests/test_linkchecker.py (+4/-2) lib/lp/bugs/browser/tests/test_bugtask.py (+1/-1) lib/lp/bugs/doc/bugattachments.txt (+4/-1) lib/lp/bugs/doc/bugsummary.txt (+8/-5) lib/lp/bugs/model/tests/test_bug.py (+9/-6) lib/lp/bugs/model/tests/test_bugsummary.py (+8/-4) lib/lp/bugs/model/tests/test_bugtask.py (+7/-4) lib/lp/bugs/scripts/tests/test_bugnotification.py (+2/-1) lib/lp/bugs/tests/test_bug_mirror_access_triggers.py (+7/-2) lib/lp/bugs/tests/test_bugbranch.py (+10/-9) lib/lp/bugs/tests/test_bugchanges.py (+10/-6) lib/lp/bugs/tests/test_bugnotification.py (+4/-2) lib/lp/bugs/tests/test_bugtaskflat_triggers.py (+8/-2) lib/lp/bugs/tests/test_bugtaskset.py (+14/-13) lib/lp/bugs/tests/test_bugvisibility.py (+4/-2) lib/lp/code/browser/tests/test_branch.py (+4/-2) lib/lp/code/browser/tests/test_branchmergeproposal.py (+3/-1) lib/lp/code/mail/tests/test_branchmergeproposal.py (+4/-4) lib/lp/code/model/tests/test_branchcollection.py (+6/-3) lib/lp/code/model/tests/test_branchmergeproposal.py (+4/-4) lib/lp/registry/browser/tests/milestone-views.txt (+5/-2) lib/lp/registry/browser/tests/test_milestone.py (+8/-4) lib/lp/registry/browser/tests/test_pillar_sharing.py (+7/-14) lib/lp/registry/browser/tests/test_team.py (+4/-1) lib/lp/registry/services/tests/test_sharingservice.py (+6/-3) lib/lp/registry/tests/test_person.py (+7/-2) lib/lp/registry/tests/test_private_team_visibility.py (+14/-3) lib/lp/registry/tests/test_team.py (+10/-3) lib/lp/registry/tests/test_team_webservice.py (+6/-8) lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py (+4/-2) lib/lp/testing/factory.py (+4/-10) |
| To merge this branch: | bzr merge lp:~stevenk/launchpad/bugs-factory-information_type |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Ian Booth (community) | 2012-05-02 | Approve on 2012-05-02 | |
|
Review via email:
|
|||
Commit Message
Update LaunchpadObject
Description of the Change
Update LaunchpadObject
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.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'lib/lp/app/browser/tests/launchpad-search-pages.txt' |
| 2 | --- lib/lp/app/browser/tests/launchpad-search-pages.txt 2011-12-24 17:49:30 +0000 |
| 3 | +++ lib/lp/app/browser/tests/launchpad-search-pages.txt 2012-05-03 01:17:18 +0000 |
| 4 | @@ -115,10 +115,12 @@ |
| 5 | created because he is the owner. |
| 6 | |
| 7 | >>> from lp.services.webapp.interfaces import ILaunchBag |
| 8 | + >>> from lp.registry.enums import InformationType |
| 9 | |
| 10 | >>> login('test@canonical.com') |
| 11 | >>> sample_person = getUtility(ILaunchBag).user |
| 12 | - >>> private_bug = factory.makeBug(owner=sample_person, private=True) |
| 13 | + >>> private_bug = factory.makeBug( |
| 14 | + ... owner=sample_person, information_type=InformationType.USERDATA) |
| 15 | |
| 16 | >>> search_view = getSearchView( |
| 17 | ... form={'field.text': private_bug.id}) |
| 18 | |
| 19 | === modified file 'lib/lp/app/browser/tests/test_linkchecker.py' |
| 20 | --- lib/lp/app/browser/tests/test_linkchecker.py 2012-01-01 02:58:52 +0000 |
| 21 | +++ lib/lp/app/browser/tests/test_linkchecker.py 2012-05-03 01:17:18 +0000 |
| 22 | @@ -1,4 +1,4 @@ |
| 23 | -# Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
| 24 | +# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
| 25 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 26 | |
| 27 | """Unit tests for the LinkCheckerAPI.""" |
| 28 | @@ -11,6 +11,7 @@ |
| 29 | from zope.security.proxy import removeSecurityProxy |
| 30 | |
| 31 | from lp.app.browser.linkchecker import LinkCheckerAPI |
| 32 | +from lp.registry.enums import InformationType |
| 33 | from lp.services.webapp.servers import LaunchpadTestRequest |
| 34 | from lp.testing import TestCaseWithFactory |
| 35 | from lp.testing.layers import DatabaseFunctionalLayer |
| 36 | @@ -67,7 +68,8 @@ |
| 37 | As far as searchBugs() is concerned, this is an invalid bug to the |
| 38 | currently authenticated user |
| 39 | """ |
| 40 | - bug_private = self.factory.makeBug(private=True) |
| 41 | + bug_private = self.factory.makeBug( |
| 42 | + information_type=InformationType.USERDATA) |
| 43 | return ['/bugs/%d' % (bug_private.id)] |
| 44 | |
| 45 | def invoke_link_checker( |
| 46 | |
| 47 | === modified file 'lib/lp/bugs/browser/tests/test_bugtask.py' |
| 48 | --- lib/lp/bugs/browser/tests/test_bugtask.py 2012-05-01 07:24:59 +0000 |
| 49 | +++ lib/lp/bugs/browser/tests/test_bugtask.py 2012-05-03 01:17:18 +0000 |
| 50 | @@ -1860,7 +1860,7 @@ |
| 51 | if bugtask is None: |
| 52 | owner = factory.makePerson() |
| 53 | bug = factory.makeBug( |
| 54 | - owner=owner, private=True, security_related=True) |
| 55 | + owner=owner, information_type=InformationType.EMBARGOEDSECURITY) |
| 56 | with person_logged_in(owner): |
| 57 | bugtask = bug.default_bugtask |
| 58 | else: |
| 59 | |
| 60 | === modified file 'lib/lp/bugs/doc/bugattachments.txt' |
| 61 | --- lib/lp/bugs/doc/bugattachments.txt 2012-04-10 14:01:17 +0000 |
| 62 | +++ lib/lp/bugs/doc/bugattachments.txt 2012-05-03 01:17:18 +0000 |
| 63 | @@ -615,9 +615,12 @@ |
| 64 | If an attachment is added to a private bug, the "restricted" flag of |
| 65 | its Librarian file is set. |
| 66 | |
| 67 | + >>> from lp.registry.enums import InformationType |
| 68 | >>> private_bug_owner = factory.makePerson() |
| 69 | >>> ignored = login_person(private_bug_owner) |
| 70 | - >>> private_bug = factory.makeBug(private=True, owner=private_bug_owner) |
| 71 | + >>> private_bug = factory.makeBug( |
| 72 | + ... information_type=InformationType.USERDATA, |
| 73 | + ... owner=private_bug_owner) |
| 74 | >>> private_attachment = private_bug.addAttachment( |
| 75 | ... owner=private_bug_owner, data="secret", filename="baz.txt", |
| 76 | ... comment="Some attachment") |
| 77 | |
| 78 | === modified file 'lib/lp/bugs/doc/bugsummary.txt' |
| 79 | --- lib/lp/bugs/doc/bugsummary.txt 2011-12-21 14:58:31 +0000 |
| 80 | +++ lib/lp/bugs/doc/bugsummary.txt 2012-05-03 01:17:18 +0000 |
| 81 | @@ -419,17 +419,20 @@ |
| 82 | distribution task. Subscribed to by team_c. |
| 83 | - bug_z is public. |
| 84 | |
| 85 | + >>> from lp.registry.enums import InformationType |
| 86 | >>> distro_p = factory.makeDistribution(name='di-p') |
| 87 | >>> series_p = factory.makeDistroSeries( |
| 88 | ... distribution=distro_p, name='ds-p') |
| 89 | >>> bug_a = factory.makeBug( |
| 90 | - ... owner=owner, distribution=distro_p, private=True) |
| 91 | + ... owner=owner, distribution=distro_p, |
| 92 | + ... information_type=InformationType.USERDATA) |
| 93 | >>> bug_b = factory.makeBug( |
| 94 | - ... owner=owner, distribution=distro_p, private=True) |
| 95 | + ... owner=owner, distribution=distro_p, |
| 96 | + ... information_type=InformationType.USERDATA) |
| 97 | >>> bug_c = factory.makeBug( |
| 98 | - ... owner=owner, series=series_p, private=True) |
| 99 | - >>> bug_z = factory.makeBug( |
| 100 | - ... owner=owner, distribution=distro_p, private=False) |
| 101 | + ... owner=owner, series=series_p, |
| 102 | + ... information_type=InformationType.USERDATA) |
| 103 | + >>> bug_z = factory.makeBug(owner=owner, distribution=distro_p) |
| 104 | |
| 105 | >>> sub = bug_a.subscribe(team_a, person_a) |
| 106 | >>> sub = bug_b.subscribe(person_b, person_b) |
| 107 | |
| 108 | === modified file 'lib/lp/bugs/model/tests/test_bug.py' |
| 109 | --- lib/lp/bugs/model/tests/test_bug.py 2012-05-02 23:15:38 +0000 |
| 110 | +++ lib/lp/bugs/model/tests/test_bug.py 2012-05-03 01:17:18 +0000 |
| 111 | @@ -803,9 +803,10 @@ |
| 112 | # Public security bugs are currently untested since it is impossible |
| 113 | # to create one at the moment. |
| 114 | bug = self.factory.makeBug() |
| 115 | - private_bug = self.factory.makeBug(private=True) |
| 116 | + private_bug = self.factory.makeBug( |
| 117 | + information_type=InformationType.USERDATA) |
| 118 | private_sec_bug = self.factory.makeBug( |
| 119 | - private=True, security_related=True) |
| 120 | + information_type=InformationType.EMBARGOEDSECURITY) |
| 121 | mapping = ( |
| 122 | (bug, InformationType.PUBLIC), |
| 123 | (private_bug, InformationType.USERDATA), |
| 124 | @@ -817,7 +818,8 @@ |
| 125 | # A private bug transitioning to public has the correct information |
| 126 | # type. |
| 127 | owner = self.factory.makePerson() |
| 128 | - bug = self.factory.makeBug(private=True, owner=owner) |
| 129 | + bug = self.factory.makeBug( |
| 130 | + information_type=InformationType.USERDATA, owner=owner) |
| 131 | with person_logged_in(owner): |
| 132 | bug.setPrivate(False, owner) |
| 133 | self.assertEqual(InformationType.PUBLIC, bug.information_type) |
| 134 | @@ -827,7 +829,7 @@ |
| 135 | # correct information type. |
| 136 | owner = self.factory.makePerson() |
| 137 | bug = self.factory.makeBug( |
| 138 | - private=True, security_related=True, owner=owner) |
| 139 | + information_type=InformationType.EMBARGOEDSECURITY, owner=owner) |
| 140 | with person_logged_in(owner): |
| 141 | bug.setPrivate(False, owner) |
| 142 | self.assertEqual( |
| 143 | @@ -838,7 +840,7 @@ |
| 144 | # information type. |
| 145 | owner = self.factory.makePerson() |
| 146 | bug = self.factory.makeBug( |
| 147 | - private=True, security_related=True, owner=owner) |
| 148 | + information_type=InformationType.EMBARGOEDSECURITY, owner=owner) |
| 149 | with person_logged_in(owner): |
| 150 | bug.transitionToInformationType(InformationType.PUBLIC, owner) |
| 151 | self.assertEqual(InformationType.PUBLIC, bug.information_type) |
| 152 | @@ -859,7 +861,8 @@ |
| 153 | product.addSubscription(product.owner, product.owner) |
| 154 | reporter = self.factory.makePerson() |
| 155 | bug = self.factory.makeBug( |
| 156 | - private=True, product=product, owner=reporter) |
| 157 | + information_type=InformationType.USERDATA, product=product, |
| 158 | + owner=reporter) |
| 159 | recipients = Store.of(bug).using( |
| 160 | BugNotificationRecipient, |
| 161 | Join(BugNotification, BugNotification.bugID == bug.id)).find( |
| 162 | |
| 163 | === modified file 'lib/lp/bugs/model/tests/test_bugsummary.py' |
| 164 | --- lib/lp/bugs/model/tests/test_bugsummary.py 2012-01-20 15:42:44 +0000 |
| 165 | +++ lib/lp/bugs/model/tests/test_bugsummary.py 2012-05-03 01:17:18 +0000 |
| 166 | @@ -1,4 +1,4 @@ |
| 167 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
| 168 | +# Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
| 169 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 170 | |
| 171 | """Tests for the BugSummary class and underlying database triggers.""" |
| 172 | @@ -18,6 +18,7 @@ |
| 173 | from lp.bugs.model.bug import BugTag |
| 174 | from lp.bugs.model.bugsummary import BugSummary |
| 175 | from lp.bugs.model.bugtask import BugTask |
| 176 | +from lp.registry.enums import InformationType |
| 177 | from lp.registry.model.teammembership import TeamParticipation |
| 178 | from lp.services.database.lpstorm import IMasterStore |
| 179 | from lp.testing import TestCaseWithFactory |
| 180 | @@ -275,7 +276,8 @@ |
| 181 | |
| 182 | def test_makePublic(self): |
| 183 | product = self.factory.makeProduct() |
| 184 | - bug = self.factory.makeBug(product=product, private=True) |
| 185 | + bug = self.factory.makeBug( |
| 186 | + product=product, information_type=InformationType.USERDATA) |
| 187 | |
| 188 | person_a = self.factory.makePerson() |
| 189 | person_b = self.factory.makePerson() |
| 190 | @@ -298,7 +300,8 @@ |
| 191 | |
| 192 | def test_subscribePrivate(self): |
| 193 | product = self.factory.makeProduct() |
| 194 | - bug = self.factory.makeBug(product=product, private=True) |
| 195 | + bug = self.factory.makeBug( |
| 196 | + product=product, information_type=InformationType.USERDATA) |
| 197 | |
| 198 | person_a = self.factory.makePerson() |
| 199 | person_b = self.factory.makePerson() |
| 200 | @@ -316,7 +319,8 @@ |
| 201 | |
| 202 | def test_unsubscribePrivate(self): |
| 203 | product = self.factory.makeProduct() |
| 204 | - bug = self.factory.makeBug(product=product, private=True) |
| 205 | + bug = self.factory.makeBug( |
| 206 | + product=product, information_type=InformationType.USERDATA) |
| 207 | |
| 208 | person_a = self.factory.makePerson() |
| 209 | person_b = self.factory.makePerson() |
| 210 | |
| 211 | === modified file 'lib/lp/bugs/model/tests/test_bugtask.py' |
| 212 | --- lib/lp/bugs/model/tests/test_bugtask.py 2012-05-02 10:53:31 +0000 |
| 213 | +++ lib/lp/bugs/model/tests/test_bugtask.py 2012-05-03 01:17:18 +0000 |
| 214 | @@ -61,8 +61,8 @@ |
| 215 | from lp.registry.interfaces.product import IProductSet |
| 216 | from lp.registry.interfaces.projectgroup import IProjectGroupSet |
| 217 | from lp.services.database.sqlbase import ( |
| 218 | + convert_storm_clause_to_string, |
| 219 | flush_database_updates, |
| 220 | - convert_storm_clause_to_string, |
| 221 | ) |
| 222 | from lp.services.searchbuilder import ( |
| 223 | all, |
| 224 | @@ -1002,9 +1002,12 @@ |
| 225 | """Private bugs from a search know the user can see the bugs.""" |
| 226 | target = self.makeBugTarget() |
| 227 | person = self.login() |
| 228 | - self.factory.makeBug(product=target, private=True, owner=person) |
| 229 | - self.factory.makeBug(product=target, private=True, owner=person) |
| 230 | - self.factory.makeBug(product=target, private=True, owner=person) |
| 231 | + self.factory.makeBug(product=target, owner=person, |
| 232 | + information_type=InformationType.USERDATA) |
| 233 | + self.factory.makeBug(product=target, owner=person, |
| 234 | + information_type=InformationType.USERDATA) |
| 235 | + self.factory.makeBug(product=target, owner=person, |
| 236 | + information_type=InformationType.USERDATA) |
| 237 | # Search style and parameters taken from the milestone index view |
| 238 | # where the issue was discovered. |
| 239 | login_person(person) |
| 240 | |
| 241 | === modified file 'lib/lp/bugs/scripts/tests/test_bugnotification.py' |
| 242 | --- lib/lp/bugs/scripts/tests/test_bugnotification.py 2012-04-29 22:52:18 +0000 |
| 243 | +++ lib/lp/bugs/scripts/tests/test_bugnotification.py 2012-05-03 01:17:18 +0000 |
| 244 | @@ -606,7 +606,8 @@ |
| 245 | self.bug_subscriber = self.factory.makePerson(name="bug-subscriber") |
| 246 | self.bug_owner = self.factory.makePerson(name="bug-owner") |
| 247 | self.bug = self.factory.makeBug( |
| 248 | - product=self.product, private=False, owner=self.bug_owner) |
| 249 | + product=self.product, owner=self.bug_owner, |
| 250 | + information_type=InformationType.USERDATA) |
| 251 | self.reporter = self.bug.owner |
| 252 | self.bug.subscribe(self.bug_subscriber, self.reporter) |
| 253 | [self.product_bugtask] = self.bug.bugtasks |
| 254 | |
| 255 | === modified file 'lib/lp/bugs/tests/test_bug_mirror_access_triggers.py' |
| 256 | --- lib/lp/bugs/tests/test_bug_mirror_access_triggers.py 2012-04-19 21:15:25 +0000 |
| 257 | +++ lib/lp/bugs/tests/test_bug_mirror_access_triggers.py 2012-05-03 01:17:18 +0000 |
| 258 | @@ -74,7 +74,12 @@ |
| 259 | |
| 260 | def makeBugAndPolicies(self, private=False): |
| 261 | product = self.factory.makeProduct() |
| 262 | - bug = self.factory.makeBug(private=private, product=product) |
| 263 | + if private: |
| 264 | + information_type = InformationType.USERDATA |
| 265 | + else: |
| 266 | + information_type = InformationType.PUBLIC |
| 267 | + bug = self.factory.makeBug( |
| 268 | + product=product, information_type=information_type) |
| 269 | return removeSecurityProxy(bug) |
| 270 | |
| 271 | def getPoliciesForArtifact(self, artifact): |
| 272 | @@ -88,7 +93,7 @@ |
| 273 | policy.type for policy in self.getPoliciesForArtifact(artifact)) |
| 274 | |
| 275 | def test_public_has_nothing(self): |
| 276 | - bug = self.factory.makeBug(private=False) |
| 277 | + bug = self.factory.makeBug(information_type=InformationType.PUBLIC) |
| 278 | artifact = getUtility(IAccessArtifactSource).find([bug]).one() |
| 279 | self.assertIs(None, artifact) |
| 280 | |
| 281 | |
| 282 | === modified file 'lib/lp/bugs/tests/test_bugbranch.py' |
| 283 | --- lib/lp/bugs/tests/test_bugbranch.py 2012-05-02 12:45:53 +0000 |
| 284 | +++ lib/lp/bugs/tests/test_bugbranch.py 2012-05-03 01:17:18 +0000 |
| 285 | @@ -1,4 +1,4 @@ |
| 286 | -# Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
| 287 | +# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
| 288 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 289 | |
| 290 | """Tests for bug-branch linking from the bugs side.""" |
| 291 | @@ -17,6 +17,7 @@ |
| 292 | BugBranch, |
| 293 | BugBranchSet, |
| 294 | ) |
| 295 | +from lp.registry.enums import InformationType |
| 296 | from lp.testing import ( |
| 297 | anonymous_logged_in, |
| 298 | celebrity_logged_in, |
| 299 | @@ -47,7 +48,7 @@ |
| 300 | branch_1 = self.factory.makeBranch() |
| 301 | branch_2 = self.factory.makeBranch() |
| 302 | bug_a = self.factory.makeBug() |
| 303 | - bug_b = self.factory.makeBug() |
| 304 | + self.factory.makeBug() |
| 305 | self.factory.loginAsAnyone() |
| 306 | bug_a.linkBranch(branch_1, self.factory.makePerson()) |
| 307 | bug_a.linkBranch(branch_2, self.factory.makePerson()) |
| 308 | @@ -61,7 +62,7 @@ |
| 309 | # getBranchesWithVisibleBugs shows public bugs to anyone, |
| 310 | # including anonymous users. |
| 311 | branch = self.factory.makeBranch() |
| 312 | - bug = self.factory.makeBug(private=False) |
| 313 | + bug = self.factory.makeBug() |
| 314 | with celebrity_logged_in('admin'): |
| 315 | bug.linkBranch(branch, self.factory.makePerson()) |
| 316 | utility = getUtility(IBugBranchSet) |
| 317 | @@ -97,7 +98,7 @@ |
| 318 | # getBranchesWithVisibleBugs does not show private bugs to users |
| 319 | # who aren't logged in. |
| 320 | branch = self.factory.makeBranch() |
| 321 | - bug = self.factory.makeBug(private=True) |
| 322 | + bug = self.factory.makeBug(information_type=InformationType.USERDATA) |
| 323 | with celebrity_logged_in('admin'): |
| 324 | bug.linkBranch(branch, self.factory.makePerson()) |
| 325 | utility = getUtility(IBugBranchSet) |
| 326 | @@ -109,7 +110,7 @@ |
| 327 | # arbitrary logged-in users (such as Average Joe, or J. Random |
| 328 | # Hacker). |
| 329 | branch = self.factory.makeBranch() |
| 330 | - bug = self.factory.makeBug(private=True) |
| 331 | + bug = self.factory.makeBug(information_type=InformationType.USERDATA) |
| 332 | with celebrity_logged_in('admin'): |
| 333 | bug.linkBranch(branch, self.factory.makePerson()) |
| 334 | utility = getUtility(IBugBranchSet) |
| 335 | @@ -122,7 +123,7 @@ |
| 336 | # getBranchesWithVisibleBugs will show private bugs to their |
| 337 | # subscribers. |
| 338 | branch = self.factory.makeBranch() |
| 339 | - bug = self.factory.makeBug(private=True) |
| 340 | + bug = self.factory.makeBug(information_type=InformationType.USERDATA) |
| 341 | user = self.factory.makePerson() |
| 342 | with celebrity_logged_in('admin'): |
| 343 | bug.subscribe(user, self.factory.makePerson()) |
| 344 | @@ -134,7 +135,7 @@ |
| 345 | def test_getBranchesWithVisibleBugs_shows_private_bugs_to_admins(self): |
| 346 | # getBranchesWithVisibleBugs will show private bugs to admins. |
| 347 | branch = self.factory.makeBranch() |
| 348 | - bug = self.factory.makeBug(private=True) |
| 349 | + bug = self.factory.makeBug(information_type=InformationType.USERDATA) |
| 350 | with celebrity_logged_in('admin'): |
| 351 | bug.linkBranch(branch, self.factory.makePerson()) |
| 352 | utility = getUtility(IBugBranchSet) |
| 353 | @@ -248,12 +249,12 @@ |
| 354 | |
| 355 | def test_the_unwashed_cannot_link_branch_to_private_bug(self): |
| 356 | # Those who cannot see a bug are forbidden to link a branch to it. |
| 357 | - bug = self.factory.makeBug(private=True) |
| 358 | + bug = self.factory.makeBug(information_type=InformationType.USERDATA) |
| 359 | self.assertRaises(Unauthorized, getattr, bug, 'linkBranch') |
| 360 | |
| 361 | def test_the_unwashed_cannot_unlink_branch_from_private_bug(self): |
| 362 | # Those who cannot see a bug are forbidden to unlink branches from it. |
| 363 | - bug = self.factory.makeBug(private=True) |
| 364 | + bug = self.factory.makeBug(information_type=InformationType.USERDATA) |
| 365 | self.assertRaises(Unauthorized, getattr, bug, 'unlinkBranch') |
| 366 | |
| 367 | def test_anonymous_users_cannot_link_branches(self): |
| 368 | |
| 369 | === modified file 'lib/lp/bugs/tests/test_bugchanges.py' |
| 370 | --- lib/lp/bugs/tests/test_bugchanges.py 2012-05-02 23:22:31 +0000 |
| 371 | +++ lib/lp/bugs/tests/test_bugchanges.py 2012-05-03 01:17:18 +0000 |
| 372 | @@ -237,7 +237,8 @@ |
| 373 | subscriber = self.factory.makePerson(displayname='Mom') |
| 374 | # Create the private bug. |
| 375 | bug = self.factory.makeBug( |
| 376 | - product=self.product, owner=self.user, private=True) |
| 377 | + product=self.product, owner=self.user, |
| 378 | + information_type=InformationType.USERDATA) |
| 379 | bug.subscribe(subscriber, self.user) |
| 380 | self.saveOldChanges(bug=bug) |
| 381 | bug.unsubscribe(subscriber, subscriber) |
| 382 | @@ -588,13 +589,14 @@ |
| 383 | def test_make_public(self): |
| 384 | # Marking a bug as public adds items to the bug's activity log |
| 385 | # and notifications. |
| 386 | - private_bug = self.factory.makeBug(private=True) |
| 387 | + private_bug = self.factory.makeBug( |
| 388 | + information_type=InformationType.USERDATA) |
| 389 | self.saveOldChanges(private_bug) |
| 390 | self.assertTrue(private_bug.private) |
| 391 | - |
| 392 | bug_before_modification = Snapshot( |
| 393 | private_bug, providing=providedBy(private_bug)) |
| 394 | - private_bug.setPrivate(False, self.user) |
| 395 | + private_bug.transitionToInformationType( |
| 396 | + InformationType.PUBLIC, self.user) |
| 397 | notify(ObjectModifiedEvent( |
| 398 | private_bug, bug_before_modification, ['private'], |
| 399 | user=self.user)) |
| 400 | @@ -1126,7 +1128,8 @@ |
| 401 | def test_retarget_private_security_bug_to_product(self): |
| 402 | # A series of tests for re-targetting a private bug task. |
| 403 | bug = self.factory.makeBug( |
| 404 | - product=self.product, owner=self.user, private=True) |
| 405 | + product=self.product, owner=self.user, |
| 406 | + information_type=InformationType.USERDATA) |
| 407 | maintainer = self.factory.makePerson() |
| 408 | bug_supervisor = self.factory.makePerson() |
| 409 | |
| 410 | @@ -1208,7 +1211,8 @@ |
| 411 | new_product = self.factory.makeProduct() |
| 412 | subscriber = self.factory.makePerson() |
| 413 | new_product.addBugSubscription(subscriber, subscriber) |
| 414 | - bug = self.factory.makeBug(product=old_product, private=True) |
| 415 | + bug = self.factory.makeBug( |
| 416 | + product=old_product, information_type=InformationType.USERDATA) |
| 417 | bug.default_bugtask.transitionToTarget(new_product) |
| 418 | self.assertNotIn(subscriber, bug.getDirectSubscribers()) |
| 419 | self.assertNotIn(subscriber, bug.getIndirectSubscribers()) |
| 420 | |
| 421 | === modified file 'lib/lp/bugs/tests/test_bugnotification.py' |
| 422 | --- lib/lp/bugs/tests/test_bugnotification.py 2012-02-24 01:14:29 +0000 |
| 423 | +++ lib/lp/bugs/tests/test_bugnotification.py 2012-05-03 01:17:18 +0000 |
| 424 | @@ -1,4 +1,4 @@ |
| 425 | -# Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
| 426 | +# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
| 427 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 428 | |
| 429 | """Tests related to bug notifications.""" |
| 430 | @@ -32,6 +32,7 @@ |
| 431 | BugNotificationSet, |
| 432 | ) |
| 433 | from lp.bugs.model.bugsubscriptionfilter import BugSubscriptionFilterMute |
| 434 | +from lp.registry.enums import InformationType |
| 435 | from lp.services.config import config |
| 436 | from lp.services.messages.interfaces.message import IMessageSet |
| 437 | from lp.services.messages.model.message import MessageSet |
| 438 | @@ -67,7 +68,8 @@ |
| 439 | self.bug_subscriber = factory.makePerson(name="bug-subscriber") |
| 440 | self.bug_owner = factory.makePerson(name="bug-owner") |
| 441 | self.private_bug = factory.makeBug( |
| 442 | - product=self.product, private=True, owner=self.bug_owner) |
| 443 | + product=self.product, owner=self.bug_owner, |
| 444 | + information_type=InformationType.USERDATA) |
| 445 | self.reporter = self.private_bug.owner |
| 446 | self.private_bug.subscribe(self.bug_subscriber, self.reporter) |
| 447 | [self.product_bugtask] = self.private_bug.bugtasks |
| 448 | |
| 449 | === modified file 'lib/lp/bugs/tests/test_bugtaskflat_triggers.py' |
| 450 | --- lib/lp/bugs/tests/test_bugtaskflat_triggers.py 2012-05-02 23:15:38 +0000 |
| 451 | +++ lib/lp/bugs/tests/test_bugtaskflat_triggers.py 2012-05-03 01:17:18 +0000 |
| 452 | @@ -14,8 +14,8 @@ |
| 453 | from lp.bugs.model.bug import Bug |
| 454 | from lp.registry.enums import InformationType |
| 455 | from lp.registry.interfaces.accesspolicy import ( |
| 456 | + IAccessArtifactGrantSource, |
| 457 | IAccessArtifactSource, |
| 458 | - IAccessArtifactGrantSource, |
| 459 | IAccessPolicyArtifactSource, |
| 460 | IAccessPolicySource, |
| 461 | ) |
| 462 | @@ -28,6 +28,7 @@ |
| 463 | from lp.testing.dbuser import dbuser |
| 464 | from lp.testing.layers import DatabaseFunctionalLayer |
| 465 | |
| 466 | + |
| 467 | BUGTASKFLAT_COLUMNS = ( |
| 468 | 'bugtask', |
| 469 | 'bug', |
| 470 | @@ -90,8 +91,13 @@ |
| 471 | |
| 472 | def makeLoggedInTask(self, private=False): |
| 473 | owner = self.factory.makePerson() |
| 474 | + if private: |
| 475 | + information_type = InformationType.USERDATA |
| 476 | + else: |
| 477 | + information_type = InformationType.PUBLIC |
| 478 | login_person(owner) |
| 479 | - bug = self.factory.makeBug(private=private, owner=owner) |
| 480 | + bug = self.factory.makeBug( |
| 481 | + information_type=information_type, owner=owner) |
| 482 | return bug.default_bugtask |
| 483 | |
| 484 | @contextmanager |
| 485 | |
| 486 | === modified file 'lib/lp/bugs/tests/test_bugtaskset.py' |
| 487 | --- lib/lp/bugs/tests/test_bugtaskset.py 2011-12-30 06:14:56 +0000 |
| 488 | +++ lib/lp/bugs/tests/test_bugtaskset.py 2012-05-03 01:17:18 +0000 |
| 489 | @@ -1,4 +1,4 @@ |
| 490 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
| 491 | +# Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
| 492 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 493 | |
| 494 | """Tests for BugTaskSet.""" |
| 495 | @@ -12,6 +12,7 @@ |
| 496 | BugTaskStatusSearch, |
| 497 | IBugTaskSet, |
| 498 | ) |
| 499 | +from lp.registry.enums import InformationType |
| 500 | from lp.services.database.sqlbase import flush_database_updates |
| 501 | from lp.testing import ( |
| 502 | login_person, |
| 503 | @@ -38,13 +39,19 @@ |
| 504 | return self.bugtask_set.getStatusCountsForProductSeries( |
| 505 | user, self.series) |
| 506 | |
| 507 | + def createBugs(self): |
| 508 | + self.factory.makeBug(milestone=self.milestone) |
| 509 | + self.factory.makeBug( |
| 510 | + milestone=self.milestone, |
| 511 | + information_type=InformationType.USERDATA) |
| 512 | + self.factory.makeBug(series=self.series) |
| 513 | + self.factory.makeBug( |
| 514 | + series=self.series, information_type=InformationType.USERDATA) |
| 515 | + |
| 516 | def test_privacy_and_counts_for_unauthenticated_user(self): |
| 517 | # An unauthenticated user should see bug counts for each status |
| 518 | # that do not include private bugs. |
| 519 | - self.factory.makeBug(milestone=self.milestone) |
| 520 | - self.factory.makeBug(milestone=self.milestone, private=True) |
| 521 | - self.factory.makeBug(series=self.series) |
| 522 | - self.factory.makeBug(series=self.series, private=True) |
| 523 | + self.createBugs() |
| 524 | self.assertEqual( |
| 525 | {BugTaskStatus.NEW: 2}, |
| 526 | self.get_counts(None)) |
| 527 | @@ -52,10 +59,7 @@ |
| 528 | def test_privacy_and_counts_for_owner(self): |
| 529 | # The owner should see bug counts for each status that do |
| 530 | # include all private bugs. |
| 531 | - self.factory.makeBug(milestone=self.milestone) |
| 532 | - self.factory.makeBug(milestone=self.milestone, private=True) |
| 533 | - self.factory.makeBug(series=self.series) |
| 534 | - self.factory.makeBug(series=self.series, private=True) |
| 535 | + self.createBugs() |
| 536 | self.assertEqual( |
| 537 | {BugTaskStatus.NEW: 4}, |
| 538 | self.get_counts(self.owner)) |
| 539 | @@ -65,10 +69,7 @@ |
| 540 | # status that do include all private bugs, since it is costly to |
| 541 | # query just the private bugs that the user has access to view, |
| 542 | # and this query may be run many times on a single page. |
| 543 | - self.factory.makeBug(milestone=self.milestone) |
| 544 | - self.factory.makeBug(milestone=self.milestone, private=True) |
| 545 | - self.factory.makeBug(series=self.series) |
| 546 | - self.factory.makeBug(series=self.series, private=True) |
| 547 | + self.createBugs() |
| 548 | other = self.factory.makePerson() |
| 549 | self.assertEqual( |
| 550 | {BugTaskStatus.NEW: 4}, |
| 551 | |
| 552 | === modified file 'lib/lp/bugs/tests/test_bugvisibility.py' |
| 553 | --- lib/lp/bugs/tests/test_bugvisibility.py 2012-04-26 07:58:38 +0000 |
| 554 | +++ lib/lp/bugs/tests/test_bugvisibility.py 2012-05-03 01:17:18 +0000 |
| 555 | @@ -1,8 +1,9 @@ |
| 556 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
| 557 | +# Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
| 558 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 559 | |
| 560 | """Tests for visibility of a bug.""" |
| 561 | |
| 562 | +from lp.registry.enums import InformationType |
| 563 | from lp.testing import ( |
| 564 | celebrity_logged_in, |
| 565 | TestCaseWithFactory, |
| 566 | @@ -54,7 +55,8 @@ |
| 567 | bug_supervisor=self.bug_team, |
| 568 | user=self.product.owner) |
| 569 | self.bug = self.factory.makeBug( |
| 570 | - owner=self.owner, private=True, product=self.product) |
| 571 | + owner=self.owner, product=self.product, |
| 572 | + information_type=InformationType.USERDATA) |
| 573 | |
| 574 | def test_privateBugRegularUser(self): |
| 575 | # A regular (non-privileged) user can not view a private bug. |
| 576 | |
| 577 | === modified file 'lib/lp/code/browser/tests/test_branch.py' |
| 578 | --- lib/lp/code/browser/tests/test_branch.py 2012-03-07 00:58:37 +0000 |
| 579 | +++ lib/lp/code/browser/tests/test_branch.py 2012-05-03 01:17:18 +0000 |
| 580 | @@ -1,4 +1,4 @@ |
| 581 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
| 582 | +# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
| 583 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 584 | |
| 585 | """Unit tests for BranchView.""" |
| 586 | @@ -33,6 +33,7 @@ |
| 587 | BranchType, |
| 588 | BranchVisibilityRule, |
| 589 | ) |
| 590 | +from lp.registry.enums import InformationType |
| 591 | from lp.registry.interfaces.person import PersonVisibility |
| 592 | from lp.services.config import config |
| 593 | from lp.services.database.constants import UTC_NOW |
| 594 | @@ -303,7 +304,8 @@ |
| 595 | # can't see any of the tasks. |
| 596 | branch = self.factory.makeAnyBranch() |
| 597 | reporter = self.factory.makePerson() |
| 598 | - bug = self.factory.makeBug(private=True, owner=reporter) |
| 599 | + bug = self.factory.makeBug( |
| 600 | + owner=reporter, information_type=InformationType.USERDATA) |
| 601 | with person_logged_in(reporter): |
| 602 | branch.linkBug(bug, reporter) |
| 603 | view = create_initialized_view(branch, '+index') |
| 604 | |
| 605 | === modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py' |
| 606 | --- lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-03-27 04:36:24 +0000 |
| 607 | +++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-03 01:17:18 +0000 |
| 608 | @@ -53,6 +53,7 @@ |
| 609 | add_revision_to_branch, |
| 610 | make_merge_proposal_without_reviewers, |
| 611 | ) |
| 612 | +from lp.registry.enums import InformationType |
| 613 | from lp.registry.interfaces.person import PersonVisibility |
| 614 | from lp.services.messages.model.message import MessageSet |
| 615 | from lp.services.webapp import canonical_url |
| 616 | @@ -890,7 +891,8 @@ |
| 617 | """List bugs that are linked to the source only.""" |
| 618 | bug = self.factory.makeBug() |
| 619 | person = self.factory.makePerson() |
| 620 | - private_bug = self.factory.makeBug(owner=person, private=True) |
| 621 | + private_bug = self.factory.makeBug( |
| 622 | + owner=person, information_type=InformationType.USERDATA) |
| 623 | self.bmp.source_branch.linkBug(bug, self.bmp.registrant) |
| 624 | with person_logged_in(person): |
| 625 | self.bmp.source_branch.linkBug(private_bug, self.bmp.registrant) |
| 626 | |
| 627 | === modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py' |
| 628 | --- lib/lp/code/mail/tests/test_branchmergeproposal.py 2012-01-01 02:58:52 +0000 |
| 629 | +++ lib/lp/code/mail/tests/test_branchmergeproposal.py 2012-05-03 01:17:18 +0000 |
| 630 | @@ -1,4 +1,4 @@ |
| 631 | -# Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
| 632 | +# Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
| 633 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 634 | |
| 635 | """Tests for BranchMergeProposal mailings""" |
| 636 | @@ -30,6 +30,7 @@ |
| 637 | from lp.code.model.codereviewvote import CodeReviewVoteReference |
| 638 | from lp.code.model.diff import PreviewDiff |
| 639 | from lp.code.subscribers.branchmergeproposal import merge_proposal_modified |
| 640 | +from lp.registry.enums import InformationType |
| 641 | from lp.services.database.lpstorm import IStore |
| 642 | from lp.services.webapp import canonical_url |
| 643 | from lp.testing import ( |
| 644 | @@ -219,9 +220,8 @@ |
| 645 | bugtask = bug.default_bugtask |
| 646 | bmp.source_branch.linkBug(bug, bmp.registrant) |
| 647 | private_bug = self.factory.makeBug( |
| 648 | - title='I am a private bug', |
| 649 | - owner=private_bug_owner, |
| 650 | - private=True) |
| 651 | + title='I am a private bug', owner=private_bug_owner, |
| 652 | + information_type=InformationType.USERDATA) |
| 653 | private_bugtask = private_bug.default_bugtask |
| 654 | with person_logged_in(private_bug_owner): |
| 655 | bmp.source_branch.linkBug(private_bug, bmp.registrant) |
| 656 | |
| 657 | === modified file 'lib/lp/code/model/tests/test_branchcollection.py' |
| 658 | --- lib/lp/code/model/tests/test_branchcollection.py 2012-01-01 02:58:52 +0000 |
| 659 | +++ lib/lp/code/model/tests/test_branchcollection.py 2012-05-03 01:17:18 +0000 |
| 660 | @@ -30,6 +30,7 @@ |
| 661 | from lp.code.model.branch import Branch |
| 662 | from lp.code.model.branchcollection import GenericBranchCollection |
| 663 | from lp.code.tests.helpers import remove_all_sample_data_branches |
| 664 | +from lp.registry.enums import InformationType |
| 665 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
| 666 | from lp.services.webapp.interfaces import ( |
| 667 | DEFAULT_FLAVOR, |
| 668 | @@ -768,11 +769,13 @@ |
| 669 | linked_bugtasks = [] |
| 670 | with person_logged_in(branch.owner): |
| 671 | for x in range(0, 4): |
| 672 | - private = x % 2 |
| 673 | + information_type = InformationType.PUBLIC |
| 674 | + if x % 2: |
| 675 | + information_type = InformationType.USERDATA |
| 676 | bug = self.factory.makeBug( |
| 677 | - owner=branch.owner, private=private) |
| 678 | + owner=branch.owner, information_type=information_type) |
| 679 | merge_proposals[0].source_branch.linkBug(bug, branch.owner) |
| 680 | - if not private: |
| 681 | + if information_type == InformationType.PUBLIC: |
| 682 | linked_bugtasks.append(bug.default_bugtask) |
| 683 | expected_rev_details[0]['linked_bugtasks'] = linked_bugtasks |
| 684 | |
| 685 | |
| 686 | === modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py' |
| 687 | --- lib/lp/code/model/tests/test_branchmergeproposal.py 2012-04-27 19:03:32 +0000 |
| 688 | +++ lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-03 01:17:18 +0000 |
| 689 | @@ -62,6 +62,7 @@ |
| 690 | add_revision_to_branch, |
| 691 | make_merge_proposal_without_reviewers, |
| 692 | ) |
| 693 | +from lp.registry.enums import InformationType |
| 694 | from lp.registry.interfaces.person import IPersonSet |
| 695 | from lp.registry.interfaces.product import IProductSet |
| 696 | from lp.services.database.constants import UTC_NOW |
| 697 | @@ -77,9 +78,7 @@ |
| 698 | WebServiceTestCase, |
| 699 | ws_object, |
| 700 | ) |
| 701 | -from lp.testing.factory import ( |
| 702 | - LaunchpadObjectFactory, |
| 703 | - ) |
| 704 | +from lp.testing.factory import LaunchpadObjectFactory |
| 705 | from lp.testing.layers import ( |
| 706 | DatabaseFunctionalLayer, |
| 707 | LaunchpadFunctionalLayer, |
| 708 | @@ -1274,7 +1273,8 @@ |
| 709 | bmp.source_branch.linkBug(bug, bmp.registrant) |
| 710 | person = self.factory.makePerson() |
| 711 | with person_logged_in(person): |
| 712 | - private_bug = self.factory.makeBug(private=True, owner=person) |
| 713 | + private_bug = self.factory.makeBug( |
| 714 | + owner=person, information_type=InformationType.USERDATA) |
| 715 | bmp.source_branch.linkBug(private_bug, person) |
| 716 | private_tasks = private_bug.bugtasks |
| 717 | self.assertEqual( |
| 718 | |
| 719 | === modified file 'lib/lp/registry/browser/tests/milestone-views.txt' |
| 720 | --- lib/lp/registry/browser/tests/milestone-views.txt 2012-04-10 14:01:17 +0000 |
| 721 | +++ lib/lp/registry/browser/tests/milestone-views.txt 2012-05-03 01:17:18 +0000 |
| 722 | @@ -445,7 +445,8 @@ |
| 723 | >>> milestone = hoary_series.newMilestone('alpha') |
| 724 | >>> view = create_initialized_view(milestone, '+edit') |
| 725 | >>> view.field_names |
| 726 | - ['name', 'code_name', 'active', 'dateexpected', 'tags', 'summary', 'distroseries'] |
| 727 | + ['name', 'code_name', 'active', 'dateexpected', 'tags', 'summary', |
| 728 | + 'distroseries'] |
| 729 | |
| 730 | The distroseries milestone can be updated too. |
| 731 | |
| 732 | @@ -736,7 +737,9 @@ |
| 733 | |
| 734 | >>> ignored = login_person(owner) |
| 735 | >>> milestone = firefox_1_0.newMilestone('1.0.13') |
| 736 | - >>> private_bug = factory.makeBug(product=firefox, private=True) |
| 737 | + >>> from lp.registry.enums import InformationType |
| 738 | + >>> private_bug = factory.makeBug( |
| 739 | + ... product=firefox, information_type=InformationType.USERDATA) |
| 740 | >>> private_bugtask = bug.bugtasks[0] |
| 741 | >>> private_bugtask.milestone = milestone |
| 742 | >>> view = create_initialized_view(milestone, '+delete') |
| 743 | |
| 744 | === modified file 'lib/lp/registry/browser/tests/test_milestone.py' |
| 745 | --- lib/lp/registry/browser/tests/test_milestone.py 2012-04-26 06:38:34 +0000 |
| 746 | +++ lib/lp/registry/browser/tests/test_milestone.py 2012-05-03 01:17:18 +0000 |
| 747 | @@ -1,4 +1,4 @@ |
| 748 | -# Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
| 749 | +# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
| 750 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 751 | |
| 752 | """Test milestone views.""" |
| 753 | @@ -12,6 +12,7 @@ |
| 754 | |
| 755 | from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
| 756 | from lp.bugs.interfaces.bugtask import IBugTaskSet |
| 757 | +from lp.registry.enums import InformationType |
| 758 | from lp.registry.interfaces.person import TeamSubscriptionPolicy |
| 759 | from lp.registry.model.milestonetag import ProjectGroupMilestoneTag |
| 760 | from lp.services.config import config |
| 761 | @@ -318,7 +319,8 @@ |
| 762 | login_person(product.owner) |
| 763 | milestone = self.factory.makeMilestone( |
| 764 | productseries=product.development_focus) |
| 765 | - bug1 = self.factory.makeBug(product=product, private=True, |
| 766 | + bug1 = self.factory.makeBug( |
| 767 | + product=product, information_type=InformationType.USERDATA, |
| 768 | owner=product.owner) |
| 769 | bug1.bugtasks[0].transitionToMilestone(milestone, product.owner) |
| 770 | # We look at the page as someone who is a member of a team and the |
| 771 | @@ -347,12 +349,14 @@ |
| 772 | with_1_queries = ["%s: %s" % (pos, stmt[3]) for (pos, stmt) in |
| 773 | enumerate(collector.queries)] |
| 774 | login_person(product.owner) |
| 775 | - bug2 = self.factory.makeBug(product=product, private=True, |
| 776 | + bug2 = self.factory.makeBug( |
| 777 | + product=product, information_type=InformationType.USERDATA, |
| 778 | owner=product.owner) |
| 779 | bug2.bugtasks[0].transitionToMilestone(milestone, product.owner) |
| 780 | bug2.subscribe(subscribed_team, product.owner) |
| 781 | bug2_url = canonical_url(bug2) |
| 782 | - bug3 = self.factory.makeBug(product=product, private=True, |
| 783 | + bug3 = self.factory.makeBug( |
| 784 | + product=product, information_type=InformationType.USERDATA, |
| 785 | owner=product.owner) |
| 786 | bug3.bugtasks[0].transitionToMilestone(milestone, product.owner) |
| 787 | bug3.subscribe(subscribed_team, product.owner) |
| 788 | |
| 789 | === modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py' |
| 790 | --- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-04-27 19:52:37 +0000 |
| 791 | +++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-05-03 01:17:18 +0000 |
| 792 | @@ -35,9 +35,7 @@ |
| 793 | ) |
| 794 | from lp.testing.layers import DatabaseFunctionalLayer |
| 795 | from lp.testing.matchers import HasQueryCount |
| 796 | -from lp.testing.pages import ( |
| 797 | - setupBrowserForUser, |
| 798 | - ) |
| 799 | +from lp.testing.pages import setupBrowserForUser |
| 800 | from lp.testing.views import ( |
| 801 | create_initialized_view, |
| 802 | create_view, |
| 803 | @@ -69,8 +67,7 @@ |
| 804 | self.pillar = self.factory.makeProduct( |
| 805 | owner=self.owner, driver=self.driver) |
| 806 | self.access_policy = self.factory.makeAccessPolicy( |
| 807 | - pillar=self.pillar, |
| 808 | - type=InformationType.PROPRIETARY) |
| 809 | + pillar=self.pillar, type=InformationType.PROPRIETARY) |
| 810 | self.grantees = [] |
| 811 | |
| 812 | def makeGrantee(self, name=None): |
| 813 | @@ -90,9 +87,7 @@ |
| 814 | |
| 815 | if with_branch and self.pillar_type == 'product': |
| 816 | branch = self.factory.makeBranch( |
| 817 | - product=self.pillar, |
| 818 | - owner=self.pillar.owner, |
| 819 | - private=True) |
| 820 | + product=self.pillar, owner=self.pillar.owner, private=True) |
| 821 | artifacts.append( |
| 822 | self.factory.makeAccessArtifact(concrete=branch)) |
| 823 | |
| 824 | @@ -103,14 +98,12 @@ |
| 825 | owner = self.pillar.owner |
| 826 | if self.pillar_type == 'product': |
| 827 | bug = self.factory.makeBug( |
| 828 | - product=self.pillar, |
| 829 | - owner=owner, |
| 830 | - private=True) |
| 831 | + product=self.pillar, owner=owner, |
| 832 | + information_type=InformationType.USERDATA) |
| 833 | elif self.pillar_type == 'distribution': |
| 834 | bug = self.factory.makeBug( |
| 835 | - distribution=self.pillar, |
| 836 | - owner=owner, |
| 837 | - private=True) |
| 838 | + distribution=self.pillar, owner=owner, |
| 839 | + information_type=InformationType.USERDATA) |
| 840 | artifacts.append( |
| 841 | self.factory.makeAccessArtifact(concrete=bug)) |
| 842 | |
| 843 | |
| 844 | === modified file 'lib/lp/registry/browser/tests/test_team.py' |
| 845 | --- lib/lp/registry/browser/tests/test_team.py 2012-04-20 07:01:18 +0000 |
| 846 | +++ lib/lp/registry/browser/tests/test_team.py 2012-05-03 01:17:18 +0000 |
| 847 | @@ -16,6 +16,7 @@ |
| 848 | TeamMailingListArchiveView, |
| 849 | TeamOverviewMenu, |
| 850 | ) |
| 851 | +from lp.registry.enums import InformationType |
| 852 | from lp.registry.interfaces.mailinglist import MailingListStatus |
| 853 | from lp.registry.interfaces.person import ( |
| 854 | CLOSED_TEAM_POLICY, |
| 855 | @@ -368,7 +369,9 @@ |
| 856 | # the team is subscribed to a private bug. |
| 857 | |
| 858 | def setup_team(team): |
| 859 | - bug = self.factory.makeBug(owner=team.teamowner, private=True) |
| 860 | + bug = self.factory.makeBug( |
| 861 | + owner=team.teamowner, |
| 862 | + information_type=InformationType.USERDATA) |
| 863 | with person_logged_in(team.teamowner): |
| 864 | bug.default_bugtask.transitionToAssignee(team) |
| 865 | |
| 866 | |
| 867 | === modified file 'lib/lp/registry/services/tests/test_sharingservice.py' |
| 868 | --- lib/lp/registry/services/tests/test_sharingservice.py 2012-04-26 07:54:34 +0000 |
| 869 | +++ lib/lp/registry/services/tests/test_sharingservice.py 2012-05-03 01:17:18 +0000 |
| 870 | @@ -646,7 +646,8 @@ |
| 871 | distro = self.factory.makeDistribution(owner=owner) |
| 872 | login_person(owner) |
| 873 | bug = self.factory.makeBug( |
| 874 | - distribution=distro, owner=owner, private=True) |
| 875 | + distribution=distro, owner=owner, |
| 876 | + information_type=InformationType.USERDATA) |
| 877 | self._assert_revokeAccessGrants(distro, [bug], None) |
| 878 | |
| 879 | def test_revokeAccessGrantsBranches(self): |
| 880 | @@ -662,7 +663,8 @@ |
| 881 | # revokeAccessGrants raises an Unauthorized exception if the user |
| 882 | # is not permitted to do so. |
| 883 | product = self.factory.makeProduct() |
| 884 | - bug = self.factory.makeBug(product=product, private=True) |
| 885 | + bug = self.factory.makeBug( |
| 886 | + product=product, information_type=InformationType.USERDATA) |
| 887 | sharee = self.factory.makePerson() |
| 888 | with FeatureFixture(WRITE_FLAG): |
| 889 | self.assertRaises( |
| 890 | @@ -685,7 +687,8 @@ |
| 891 | # The feature flag needs to be enabled. |
| 892 | owner = self.factory.makePerson() |
| 893 | product = self.factory.makeProduct(owner=owner) |
| 894 | - bug = self.factory.makeBug(product=product, private=True) |
| 895 | + bug = self.factory.makeBug( |
| 896 | + product=product, information_type=InformationType.USERDATA) |
| 897 | sharee = self.factory.makePerson() |
| 898 | login_person(owner) |
| 899 | self.assertRaises( |
| 900 | |
| 901 | === modified file 'lib/lp/registry/tests/test_person.py' |
| 902 | --- lib/lp/registry/tests/test_person.py 2012-05-01 06:49:04 +0000 |
| 903 | +++ lib/lp/registry/tests/test_person.py 2012-05-03 01:17:18 +0000 |
| 904 | @@ -27,6 +27,7 @@ |
| 905 | from lp.bugs.interfaces.bugtask import IllegalRelatedBugTasksParams |
| 906 | from lp.bugs.model.bug import Bug |
| 907 | from lp.bugs.model.bugtask import get_related_bugtasks_search_params |
| 908 | +from lp.registry.enums import InformationType |
| 909 | from lp.registry.errors import PrivatePersonLinkageError |
| 910 | from lp.registry.interfaces.karma import IKarmaCacheManager |
| 911 | from lp.registry.interfaces.person import ( |
| 912 | @@ -1326,10 +1327,14 @@ |
| 913 | def test_skips_private_bugs_the_user_is_not_allowed_to_see(self): |
| 914 | milestone = self.factory.makeMilestone(dateexpected=self.today) |
| 915 | private_bug = removeSecurityProxy( |
| 916 | - self.factory.makeBug(milestone=milestone, private=True)) |
| 917 | + self.factory.makeBug( |
| 918 | + milestone=milestone, |
| 919 | + information_type=InformationType.USERDATA)) |
| 920 | self._assignBugTaskToTeamOwner(private_bug.bugtasks[0]) |
| 921 | private_bug2 = removeSecurityProxy( |
| 922 | - self.factory.makeBug(milestone=milestone, private=True)) |
| 923 | + self.factory.makeBug( |
| 924 | + milestone=milestone, |
| 925 | + information_type=InformationType.USERDATA)) |
| 926 | self._assignBugTaskToTeamOwner(private_bug2.bugtasks[0]) |
| 927 | |
| 928 | with person_logged_in(private_bug2.owner): |
| 929 | |
| 930 | === modified file 'lib/lp/registry/tests/test_private_team_visibility.py' |
| 931 | --- lib/lp/registry/tests/test_private_team_visibility.py 2012-04-20 07:01:18 +0000 |
| 932 | +++ lib/lp/registry/tests/test_private_team_visibility.py 2012-05-03 01:17:18 +0000 |
| 933 | @@ -1,4 +1,4 @@ |
| 934 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
| 935 | +# Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
| 936 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 937 | |
| 938 | """Tests for visibility of private teams. |
| 939 | @@ -20,6 +20,7 @@ |
| 940 | from zope.component import getUtility |
| 941 | from zope.security.interfaces import Unauthorized |
| 942 | |
| 943 | +from lp.registry.enums import InformationType |
| 944 | from lp.registry.interfaces.person import ( |
| 945 | PersonVisibility, |
| 946 | TeamSubscriptionPolicy, |
| 947 | @@ -290,8 +291,13 @@ |
| 948 | # Users can see teams subscribed to bugs. |
| 949 | bug_owner = self.factory.makePerson() |
| 950 | product = self.factory.makeProduct(owner=bug_owner) |
| 951 | + if private: |
| 952 | + information_type = InformationType.USERDATA |
| 953 | + else: |
| 954 | + information_type = InformationType.PUBLIC |
| 955 | bug = self.factory.makeBug( |
| 956 | - owner=bug_owner, product=product, private=private) |
| 957 | + owner=bug_owner, product=product, |
| 958 | + information_type=information_type) |
| 959 | # Initially no visibility. |
| 960 | some_person = self.factory.makePerson() |
| 961 | self._check_permission(some_person, False) |
| 962 | @@ -319,8 +325,13 @@ |
| 963 | # Users can see teams assigned to bugs. |
| 964 | bug_owner = self.factory.makePerson() |
| 965 | product = self.factory.makeProduct(owner=bug_owner) |
| 966 | + if private: |
| 967 | + information_type = InformationType.USERDATA |
| 968 | + else: |
| 969 | + information_type = InformationType.PUBLIC |
| 970 | bug = self.factory.makeBug( |
| 971 | - owner=bug_owner, product=product, private=private) |
| 972 | + owner=bug_owner, product=product, |
| 973 | + information_type=information_type) |
| 974 | # Initially no visibility. |
| 975 | some_person = self.factory.makePerson() |
| 976 | self._check_permission(some_person, False) |
| 977 | |
| 978 | === modified file 'lib/lp/registry/tests/test_team.py' |
| 979 | --- lib/lp/registry/tests/test_team.py 2012-03-22 14:15:46 +0000 |
| 980 | +++ lib/lp/registry/tests/test_team.py 2012-05-03 01:17:18 +0000 |
| 981 | @@ -10,7 +10,10 @@ |
| 982 | from zope.interface.exceptions import Invalid |
| 983 | from zope.security.proxy import removeSecurityProxy |
| 984 | |
| 985 | -from lp.registry.enums import PersonTransferJobType |
| 986 | +from lp.registry.enums import ( |
| 987 | + InformationType, |
| 988 | + PersonTransferJobType, |
| 989 | + ) |
| 990 | from lp.registry.errors import ( |
| 991 | JoinNotAllowed, |
| 992 | TeamSubscriptionPolicyError, |
| 993 | @@ -400,7 +403,9 @@ |
| 994 | def test_closed_team_with_private_bugs_cannot_become_open(self): |
| 995 | # The team cannot become open if it is subscribed to private bugs. |
| 996 | self.setUpTeams() |
| 997 | - bug = self.factory.makeBug(owner=self.team.teamowner, private=True) |
| 998 | + bug = self.factory.makeBug( |
| 999 | + owner=self.team.teamowner, |
| 1000 | + information_type=InformationType.USERDATA) |
| 1001 | with person_logged_in(self.team.teamowner): |
| 1002 | bug.subscribe(self.team, self.team.teamowner) |
| 1003 | self.assertFalse( |
| 1004 | @@ -412,7 +417,9 @@ |
| 1005 | def test_closed_team_with_private_bugs_assigned_cannot_become_open(self): |
| 1006 | # The team cannot become open if it is assigned private bugs. |
| 1007 | self.setUpTeams() |
| 1008 | - bug = self.factory.makeBug(owner=self.team.teamowner, private=True) |
| 1009 | + bug = self.factory.makeBug( |
| 1010 | + owner=self.team.teamowner, |
| 1011 | + information_type=InformationType.USERDATA) |
| 1012 | with person_logged_in(self.team.teamowner): |
| 1013 | bug.default_bugtask.transitionToAssignee(self.team) |
| 1014 | self.assertFalse( |
| 1015 | |
| 1016 | === modified file 'lib/lp/registry/tests/test_team_webservice.py' |
| 1017 | --- lib/lp/registry/tests/test_team_webservice.py 2012-04-20 05:00:49 +0000 |
| 1018 | +++ lib/lp/registry/tests/test_team_webservice.py 2012-05-03 01:17:18 +0000 |
| 1019 | @@ -1,4 +1,4 @@ |
| 1020 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
| 1021 | +# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
| 1022 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 1023 | |
| 1024 | __metaclass__ = type |
| 1025 | @@ -10,14 +10,12 @@ |
| 1026 | Unauthorized, |
| 1027 | ) |
| 1028 | import transaction |
| 1029 | -from zope.component import getUtility |
| 1030 | |
| 1031 | +from lp.registry.enums import InformationType |
| 1032 | from lp.registry.interfaces.person import ( |
| 1033 | PersonVisibility, |
| 1034 | TeamSubscriptionPolicy, |
| 1035 | ) |
| 1036 | -from lp.soyuz.enums import ArchivePurpose |
| 1037 | -from lp.soyuz.interfaces.archive import IArchiveSet |
| 1038 | from lp.testing import ( |
| 1039 | ExpectedException, |
| 1040 | launchpadlib_for, |
| 1041 | @@ -91,14 +89,14 @@ |
| 1042 | subscription_policy=TeamSubscriptionPolicy.RESTRICTED) |
| 1043 | # Create a P3A for the team. |
| 1044 | with person_logged_in(team_owner): |
| 1045 | - getUtility(IArchiveSet).new( |
| 1046 | - owner=db_team, purpose=ArchivePurpose.PPA, |
| 1047 | - private=True, name='private-ppa') |
| 1048 | + self.factory.makeArchive( |
| 1049 | + owner=db_team, private=True, name='private-ppa') |
| 1050 | # Create an authorised user with limitedView permission on the team. |
| 1051 | # We do that by subscribing the team and the user to the same |
| 1052 | # private bug. |
| 1053 | self.bug_owner = self.factory.makePerson() |
| 1054 | - bug = self.factory.makeBug(owner=self.bug_owner, private=True) |
| 1055 | + bug = self.factory.makeBug( |
| 1056 | + owner=self.bug_owner, information_type=InformationType.USERDATA) |
| 1057 | self.authorised_person = self.factory.makePerson() |
| 1058 | with person_logged_in(self.bug_owner): |
| 1059 | bug.subscribe(db_team, self.bug_owner) |
| 1060 | |
| 1061 | === modified file 'lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py' |
| 1062 | --- lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py 2012-01-01 02:58:52 +0000 |
| 1063 | +++ lib/lp/services/librarian/tests/test_libraryfilealias_with_parent.py 2012-05-03 01:17:18 +0000 |
| 1064 | @@ -1,4 +1,4 @@ |
| 1065 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
| 1066 | +# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
| 1067 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 1068 | |
| 1069 | __metaclass__ = type |
| 1070 | @@ -8,6 +8,7 @@ |
| 1071 | from zope.component import getMultiAdapter |
| 1072 | from zope.security.interfaces import Unauthorized |
| 1073 | |
| 1074 | +from lp.registry.enums import InformationType |
| 1075 | from lp.services.librarian.interfaces import ILibraryFileAliasWithParent |
| 1076 | from lp.testing import ( |
| 1077 | login_person, |
| 1078 | @@ -25,7 +26,8 @@ |
| 1079 | super(TestLibraryFileAliasForBugAttachment, self).setUp() |
| 1080 | self.bug_owner = self.factory.makePerson() |
| 1081 | login_person(self.bug_owner) |
| 1082 | - self.bug = self.factory.makeBug(owner=self.bug_owner, private=True) |
| 1083 | + self.bug = self.factory.makeBug( |
| 1084 | + owner=self.bug_owner, information_type=InformationType.USERDATA) |
| 1085 | self.bug_attachment = self.factory.makeBugAttachment(bug=self.bug) |
| 1086 | self.lfa_with_parent = getMultiAdapter( |
| 1087 | (self.bug_attachment.libraryfile, self.bug_attachment), |
| 1088 | |
| 1089 | === modified file 'lib/lp/testing/factory.py' |
| 1090 | --- lib/lp/testing/factory.py 2012-05-01 11:13:13 +0000 |
| 1091 | +++ lib/lp/testing/factory.py 2012-05-03 01:17:18 +0000 |
| 1092 | @@ -76,7 +76,6 @@ |
| 1093 | ) |
| 1094 | from lp.blueprints.interfaces.specification import ISpecificationSet |
| 1095 | from lp.blueprints.interfaces.sprint import ISprintSet |
| 1096 | -from lp.bugs.adapters.bug import convert_to_information_type |
| 1097 | from lp.bugs.interfaces.bug import ( |
| 1098 | CreateBugParams, |
| 1099 | IBugSet, |
| 1100 | @@ -1638,11 +1637,10 @@ |
| 1101 | return branch.createBranchRevision(sequence, revision) |
| 1102 | |
| 1103 | def makeBug(self, product=None, owner=None, bug_watch_url=None, |
| 1104 | - private=False, security_related=False, information_type=None, |
| 1105 | - date_closed=None, title=None, date_created=None, |
| 1106 | - description=None, comment=None, status=None, |
| 1107 | - distribution=None, milestone=None, series=None, tags=None, |
| 1108 | - sourcepackagename=None): |
| 1109 | + information_type=InformationType.PUBLIC, date_closed=None, |
| 1110 | + title=None, date_created=None, description=None, |
| 1111 | + comment=None, status=None, distribution=None, milestone=None, |
| 1112 | + series=None, tags=None, sourcepackagename=None): |
| 1113 | """Create and return a new, arbitrary Bug. |
| 1114 | |
| 1115 | The bug returned uses default values where possible. See |
| 1116 | @@ -1689,10 +1687,6 @@ |
| 1117 | self.makeSourcePackagePublishingHistory( |
| 1118 | distroseries=distribution.currentseries, |
| 1119 | sourcepackagename=sourcepackagename) |
| 1120 | - # Factory changes delayed for a seperate branch. |
| 1121 | - if information_type is None: |
| 1122 | - information_type = convert_to_information_type( |
| 1123 | - private, security_related) |
| 1124 | create_bug_params = CreateBugParams( |
| 1125 | owner, title, comment=comment, information_type=information_type, |
| 1126 | datecreated=date_created, description=description, |

Looks reasonable. Let's hope ec2 finds any remaining issues.