Merge lp:~stevenk/launchpad/rbsj-generalise into lp:launchpad
- rbsj-generalise
- Merge into devel
Proposed by
Steve Kowalik
on 2012-06-29
| Status: | Merged |
|---|---|
| Approved by: | William Grant on 2012-06-29 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15539 |
| Proposed branch: | lp:~stevenk/launchpad/rbsj-generalise |
| Merge into: | lp:launchpad |
| Diff against target: |
537 lines (+98/-84) 12 files modified
lib/lp/bugs/model/bug.py (+5/-2) lib/lp/bugs/model/bugtask.py (+4/-2) lib/lp/bugs/model/tests/test_bugtask.py (+3/-3) lib/lp/registry/configure.zcml (+5/-5) lib/lp/registry/interfaces/sharingjob.py (+9/-8) lib/lp/registry/model/sharingjob.py (+23/-23) lib/lp/registry/model/teammembership.py (+4/-2) lib/lp/registry/services/sharingservice.py (+6/-4) lib/lp/registry/services/tests/test_sharingservice.py (+1/-1) lib/lp/registry/tests/test_sharingjob.py (+35/-31) lib/lp/registry/tests/test_teammembership.py (+1/-1) lib/lp/services/config/schema-lazr.conf (+2/-2) |
| To merge this branch: | bzr merge lp:~stevenk/launchpad/rbsj-generalise |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| William Grant | code | 2012-06-29 | Approve on 2012-06-29 |
|
Review via email:
|
|||
Commit Message
Rename RemoveBugSubscr
Description of the Change
RemoveBugSubscr
To that end, I have renamed it and all related pieces to RemoveArtifactS
To post a comment you must log in.
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'lib/lp/bugs/model/bug.py' |
| 2 | --- lib/lp/bugs/model/bug.py 2012-06-19 04:38:35 +0000 |
| 3 | +++ lib/lp/bugs/model/bug.py 2012-07-02 23:43:24 +0000 |
| 4 | @@ -178,7 +178,9 @@ |
| 5 | from lp.registry.interfaces.productseries import IProductSeries |
| 6 | from lp.registry.interfaces.role import IPersonRoles |
| 7 | from lp.registry.interfaces.series import SeriesStatus |
| 8 | -from lp.registry.interfaces.sharingjob import IRemoveBugSubscriptionsJobSource |
| 9 | +from lp.registry.interfaces.sharingjob import ( |
| 10 | + IRemoveArtifactSubscriptionsJobSource, |
| 11 | + ) |
| 12 | from lp.registry.interfaces.sourcepackage import ISourcePackage |
| 13 | from lp.registry.model.accesspolicy import reconcile_access_for_artifact |
| 14 | from lp.registry.model.person import ( |
| 15 | @@ -1831,7 +1833,8 @@ |
| 16 | # As a result of the transition, some subscribers may no longer |
| 17 | # have access to the bug. We need to run a job to remove any such |
| 18 | # subscriptions. |
| 19 | - getUtility(IRemoveBugSubscriptionsJobSource).create(who, [self]) |
| 20 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 21 | + who, [self]) |
| 22 | |
| 23 | return True |
| 24 | |
| 25 | |
| 26 | === modified file 'lib/lp/bugs/model/bugtask.py' |
| 27 | --- lib/lp/bugs/model/bugtask.py 2012-06-14 07:43:06 +0000 |
| 28 | +++ lib/lp/bugs/model/bugtask.py 2012-07-02 23:43:24 +0000 |
| 29 | @@ -119,7 +119,9 @@ |
| 30 | from lp.registry.interfaces.productseries import IProductSeries |
| 31 | from lp.registry.interfaces.projectgroup import IProjectGroup |
| 32 | from lp.registry.interfaces.role import IPersonRoles |
| 33 | -from lp.registry.interfaces.sharingjob import IRemoveBugSubscriptionsJobSource |
| 34 | +from lp.registry.interfaces.sharingjob import ( |
| 35 | + IRemoveArtifactSubscriptionsJobSource, |
| 36 | + ) |
| 37 | from lp.registry.interfaces.sourcepackage import ISourcePackage |
| 38 | from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet |
| 39 | from lp.registry.model.pillar import pillar_sort_key |
| 40 | @@ -1192,7 +1194,7 @@ |
| 41 | # As a result of the transition, some subscribers may no longer |
| 42 | # have access to the parent bug. We need to run a job to remove any |
| 43 | # such subscriptions. |
| 44 | - getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 45 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 46 | user, [self.bug], pillar=target_before_change) |
| 47 | |
| 48 | def updateTargetNameCache(self, newtarget=None): |
| 49 | |
| 50 | === modified file 'lib/lp/bugs/model/tests/test_bugtask.py' |
| 51 | --- lib/lp/bugs/model/tests/test_bugtask.py 2012-06-19 02:14:21 +0000 |
| 52 | +++ lib/lp/bugs/model/tests/test_bugtask.py 2012-07-02 23:43:24 +0000 |
| 53 | @@ -3334,15 +3334,15 @@ |
| 54 | |
| 55 | |
| 56 | class TestTransitionsRemovesSubscribersJob(TestCaseWithFactory): |
| 57 | - """Test that various bug transitions invoke RemoveBugSubscribers job.""" |
| 58 | + """Test that various bug transitions invoke RemoveArtifactSubscribers |
| 59 | + job.""" |
| 60 | |
| 61 | layer = CeleryJobLayer |
| 62 | |
| 63 | def setUp(self): |
| 64 | self.useFixture(FeatureFixture({ |
| 65 | 'disclosure.unsubscribe_jobs.enabled': 'true', |
| 66 | - 'jobs.celery.enabled_classes': |
| 67 | - 'RemoveBugSubscriptionsJob', |
| 68 | + 'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob', |
| 69 | })) |
| 70 | self.useFixture(disable_trigger_fixture()) |
| 71 | super(TestTransitionsRemovesSubscribersJob, self).setUp() |
| 72 | |
| 73 | === modified file 'lib/lp/registry/configure.zcml' |
| 74 | --- lib/lp/registry/configure.zcml 2012-06-15 00:42:38 +0000 |
| 75 | +++ lib/lp/registry/configure.zcml 2012-07-02 23:43:24 +0000 |
| 76 | @@ -2016,17 +2016,17 @@ |
| 77 | </securedutility> |
| 78 | |
| 79 | <!-- Sharing jobs --> |
| 80 | - <class class=".model.sharingjob.RemoveBugSubscriptionsJob"> |
| 81 | - <allow interface=".interfaces.sharingjob.IRemoveBugSubscriptionsJob"/> |
| 82 | + <class class=".model.sharingjob.RemoveArtifactSubscriptionsJob"> |
| 83 | + <allow interface=".interfaces.sharingjob.IRemoveArtifactSubscriptionsJob"/> |
| 84 | <allow attributes=" |
| 85 | context |
| 86 | log_name"/> |
| 87 | </class> |
| 88 | |
| 89 | <securedutility |
| 90 | - component=".model.sharingjob.RemoveBugSubscriptionsJob" |
| 91 | - provides=".interfaces.sharingjob.IRemoveBugSubscriptionsJobSource"> |
| 92 | - <allow interface=".interfaces.sharingjob.IRemoveBugSubscriptionsJobSource"/> |
| 93 | + component=".model.sharingjob.RemoveArtifactSubscriptionsJob" |
| 94 | + provides=".interfaces.sharingjob.IRemoveArtifactSubscriptionsJobSource"> |
| 95 | + <allow interface=".interfaces.sharingjob.IRemoveArtifactSubscriptionsJobSource"/> |
| 96 | </securedutility> |
| 97 | |
| 98 | </configure> |
| 99 | |
| 100 | === modified file 'lib/lp/registry/interfaces/sharingjob.py' |
| 101 | --- lib/lp/registry/interfaces/sharingjob.py 2012-06-15 01:47:33 +0000 |
| 102 | +++ lib/lp/registry/interfaces/sharingjob.py 2012-07-02 23:43:24 +0000 |
| 103 | @@ -6,8 +6,8 @@ |
| 104 | __metaclass__ = type |
| 105 | |
| 106 | __all__ = [ |
| 107 | - 'IRemoveBugSubscriptionsJob', |
| 108 | - 'IRemoveBugSubscriptionsJobSource', |
| 109 | + 'IRemoveArtifactSubscriptionsJob', |
| 110 | + 'IRemoveArtifactSubscriptionsJobSource', |
| 111 | 'ISharingJob', |
| 112 | 'ISharingJobSource', |
| 113 | ] |
| 114 | @@ -66,7 +66,7 @@ |
| 115 | """The person who initiated the job.""" |
| 116 | |
| 117 | |
| 118 | -class IRemoveBugSubscriptionsJob(ISharingJob): |
| 119 | +class IRemoveArtifactSubscriptionsJob(ISharingJob): |
| 120 | """Job to remove subscriptions to artifacts for which access is revoked. |
| 121 | |
| 122 | Invalid subscriptions for a specific bug are removed. |
| 123 | @@ -80,13 +80,14 @@ |
| 124 | """Create a new ISharingJob.""" |
| 125 | |
| 126 | |
| 127 | -class IRemoveBugSubscriptionsJobSource(ISharingJobSource): |
| 128 | - """An interface for acquiring IRemoveBugSubscriptionsJobs.""" |
| 129 | +class IRemoveArtifactSubscriptionsJobSource(ISharingJobSource): |
| 130 | + """An interface for acquiring IRemoveArtifactSubscriptionsJobs.""" |
| 131 | |
| 132 | def create(requestor, bugs=None, grantee=None, pillar=None, |
| 133 | information_types=None): |
| 134 | - """Create a new job to remove subscriptions for the specified bugs. |
| 135 | + """Create a new job to remove subscriptions for the specified |
| 136 | + artifacts. |
| 137 | |
| 138 | - Subscriptions for users who no longer have access to the bugs are |
| 139 | - removed. |
| 140 | + Subscriptions for users who no longer have access to the artifacts |
| 141 | + are removed. |
| 142 | """ |
| 143 | |
| 144 | === modified file 'lib/lp/registry/model/sharingjob.py' |
| 145 | --- lib/lp/registry/model/sharingjob.py 2012-06-28 01:14:33 +0000 |
| 146 | +++ lib/lp/registry/model/sharingjob.py 2012-07-02 23:43:24 +0000 |
| 147 | @@ -8,7 +8,7 @@ |
| 148 | |
| 149 | |
| 150 | __all__ = [ |
| 151 | - 'RemoveBugSubscriptionsJob', |
| 152 | + 'RemoveArtifactSubscriptionsJob', |
| 153 | ] |
| 154 | |
| 155 | import contextlib |
| 156 | @@ -49,8 +49,8 @@ |
| 157 | from lp.registry.interfaces.person import IPersonSet |
| 158 | from lp.registry.interfaces.product import IProduct |
| 159 | from lp.registry.interfaces.sharingjob import ( |
| 160 | - IRemoveBugSubscriptionsJob, |
| 161 | - IRemoveBugSubscriptionsJobSource, |
| 162 | + IRemoveArtifactSubscriptionsJob, |
| 163 | + IRemoveArtifactSubscriptionsJobSource, |
| 164 | ISharingJob, |
| 165 | ISharingJobSource, |
| 166 | ) |
| 167 | @@ -82,17 +82,18 @@ |
| 168 | grant (either direct or indirect via team membership). |
| 169 | """) |
| 170 | |
| 171 | - REMOVE_BUG_SUBSCRIPTIONS = DBItem(1, """ |
| 172 | - Remove subscriptions for users who can no longer access bugs. |
| 173 | + REMOVE_ARTIFACT_SUBSCRIPTIONS = DBItem(1, """ |
| 174 | + Remove subscriptions for users who can no longer access artifacts. |
| 175 | |
| 176 | - This job removes subscriptions to a bug when access is |
| 177 | - no longer possible because the subscriber no longer has an access |
| 178 | - grant (either direct or indirect via team membership). |
| 179 | + This job removes subscriptions to an artifact (such as a bug or |
| 180 | + branch) when access is no longer possible because the subscriber |
| 181 | + no longer has an access grant (either direct or indirect via team |
| 182 | + membership). |
| 183 | """) |
| 184 | |
| 185 | |
| 186 | class SharingJob(StormBase): |
| 187 | - """Base class for jobs related to branch merge proposals.""" |
| 188 | + """Base class for jobs related to sharing.""" |
| 189 | |
| 190 | implements(ISharingJob) |
| 191 | |
| 192 | @@ -238,21 +239,21 @@ |
| 193 | return vars |
| 194 | |
| 195 | |
| 196 | -class RemoveBugSubscriptionsJob(SharingJobDerived): |
| 197 | - """See `IRemoveBugSubscriptionsJob`.""" |
| 198 | - |
| 199 | - implements(IRemoveBugSubscriptionsJob) |
| 200 | - classProvides(IRemoveBugSubscriptionsJobSource) |
| 201 | - class_job_type = SharingJobType.REMOVE_BUG_SUBSCRIPTIONS |
| 202 | - |
| 203 | - config = config.IRemoveBugSubscriptionsJobSource |
| 204 | +class RemoveArtifactSubscriptionsJob(SharingJobDerived): |
| 205 | + """See `IRemoveArtifactSubscriptionsJob`.""" |
| 206 | + |
| 207 | + implements(IRemoveArtifactSubscriptionsJob) |
| 208 | + classProvides(IRemoveArtifactSubscriptionsJobSource) |
| 209 | + class_job_type = SharingJobType.REMOVE_ARTIFACT_SUBSCRIPTIONS |
| 210 | + |
| 211 | + config = config.IRemoveArtifactSubscriptionsJobSource |
| 212 | |
| 213 | @classmethod |
| 214 | - def create(cls, requestor, bugs=None, grantee=None, pillar=None, |
| 215 | + def create(cls, requestor, artifacts=None, grantee=None, pillar=None, |
| 216 | information_types=None): |
| 217 | - """See `IRemoveBugSubscriptionsJob`.""" |
| 218 | + """See `IRemoveArtifactSubscriptionsJob`.""" |
| 219 | |
| 220 | - bug_ids = [bug.id for bug in bugs or []] |
| 221 | + bug_ids = [bug.id for bug in artifacts or []] |
| 222 | information_types = [ |
| 223 | info_type.value for info_type in information_types or [] |
| 224 | ] |
| 225 | @@ -261,7 +262,7 @@ |
| 226 | 'information_types': information_types, |
| 227 | 'requestor.id': requestor.id |
| 228 | } |
| 229 | - return super(RemoveBugSubscriptionsJob, cls).create( |
| 230 | + return super(RemoveArtifactSubscriptionsJob, cls).create( |
| 231 | pillar, grantee, metadata) |
| 232 | |
| 233 | @property |
| 234 | @@ -314,8 +315,7 @@ |
| 235 | '%s=%s' % (k, v) for (k, v) in sorted(info.items()) if v)) |
| 236 | |
| 237 | def run(self): |
| 238 | - """See `IRemoveBugSubscriptionsJob`.""" |
| 239 | - |
| 240 | + """See `IRemoveArtifactSubscriptionsJob`.""" |
| 241 | logger = logging.getLogger() |
| 242 | logger.info(self.getOperationDescription()) |
| 243 | |
| 244 | |
| 245 | === modified file 'lib/lp/registry/model/teammembership.py' |
| 246 | --- lib/lp/registry/model/teammembership.py 2012-06-28 01:14:33 +0000 |
| 247 | +++ lib/lp/registry/model/teammembership.py 2012-07-02 23:43:24 +0000 |
| 248 | @@ -42,7 +42,9 @@ |
| 249 | IMembershipNotificationJobSource, |
| 250 | ) |
| 251 | from lp.registry.interfaces.role import IPersonRoles |
| 252 | -from lp.registry.interfaces.sharingjob import IRemoveBugSubscriptionsJobSource |
| 253 | +from lp.registry.interfaces.sharingjob import ( |
| 254 | + IRemoveArtifactSubscriptionsJobSource, |
| 255 | + ) |
| 256 | from lp.registry.interfaces.teammembership import ( |
| 257 | ACTIVE_STATES, |
| 258 | CyclicalTeamMembershipError, |
| 259 | @@ -391,7 +393,7 @@ |
| 260 | # A person has left the team so they may no longer have access |
| 261 | # to some artifacts shared with the team. We need to run a job |
| 262 | # to remove any subscriptions to such artifacts. |
| 263 | - getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 264 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 265 | user, grantee=self.person) |
| 266 | else: |
| 267 | # Changed from an inactive state to another inactive one, so no |
| 268 | |
| 269 | === modified file 'lib/lp/registry/services/sharingservice.py' |
| 270 | --- lib/lp/registry/services/sharingservice.py 2012-06-28 01:14:33 +0000 |
| 271 | +++ lib/lp/registry/services/sharingservice.py 2012-07-02 23:43:24 +0000 |
| 272 | @@ -44,7 +44,9 @@ |
| 273 | from lp.registry.interfaces.person import IPersonSet |
| 274 | from lp.registry.interfaces.product import IProduct |
| 275 | from lp.registry.interfaces.projectgroup import IProjectGroup |
| 276 | -from lp.registry.interfaces.sharingjob import IRemoveBugSubscriptionsJobSource |
| 277 | +from lp.registry.interfaces.sharingjob import ( |
| 278 | + IRemoveArtifactSubscriptionsJobSource, |
| 279 | + ) |
| 280 | from lp.registry.interfaces.sharingservice import ISharingService |
| 281 | from lp.registry.model.accesspolicy import ( |
| 282 | AccessArtifactGrant, |
| 283 | @@ -383,8 +385,8 @@ |
| 284 | |
| 285 | # Create a job to remove subscriptions for artifacts the sharee can no |
| 286 | # longer see. |
| 287 | - getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 288 | - user, bugs=None, grantee=sharee, pillar=pillar, |
| 289 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 290 | + user, artifacts=None, grantee=sharee, pillar=pillar, |
| 291 | information_types=information_types) |
| 292 | |
| 293 | @available_with_permission('launchpad.Edit', 'pillar') |
| 294 | @@ -411,7 +413,7 @@ |
| 295 | # Create a job to remove subscriptions for artifacts the sharee can no |
| 296 | # longer see. |
| 297 | if bugs: |
| 298 | - getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 299 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 300 | user, bugs, grantee=sharee, pillar=pillar) |
| 301 | # XXX 2012-06-13 wallyworld bug=1012448 |
| 302 | # Remove branch subscriptions when information type fully implemented. |
| 303 | |
| 304 | === modified file 'lib/lp/registry/services/tests/test_sharingservice.py' |
| 305 | --- lib/lp/registry/services/tests/test_sharingservice.py 2012-07-02 17:22:30 +0000 |
| 306 | +++ lib/lp/registry/services/tests/test_sharingservice.py 2012-07-02 23:43:24 +0000 |
| 307 | @@ -57,7 +57,7 @@ |
| 308 | WRITE_FLAG = { |
| 309 | 'disclosure.enhanced_sharing.writable': 'true', |
| 310 | 'disclosure.enhanced_sharing_details.enabled': 'true', |
| 311 | - 'jobs.celery.enabled_classes': 'RemoveBugSubscriptionsJob'} |
| 312 | + 'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob'} |
| 313 | DETAILS_FLAG = {'disclosure.enhanced_sharing_details.enabled': 'true'} |
| 314 | |
| 315 | |
| 316 | |
| 317 | === modified file 'lib/lp/registry/tests/test_sharingjob.py' |
| 318 | --- lib/lp/registry/tests/test_sharingjob.py 2012-06-19 04:38:35 +0000 |
| 319 | +++ lib/lp/registry/tests/test_sharingjob.py 2012-07-02 23:43:24 +0000 |
| 320 | @@ -12,6 +12,10 @@ |
| 321 | from zope.security.proxy import removeSecurityProxy |
| 322 | |
| 323 | from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
| 324 | +from lp.code.enums import ( |
| 325 | + BranchSubscriptionNotificationLevel, |
| 326 | + CodeReviewNotificationLevel, |
| 327 | + ) |
| 328 | from lp.registry.enums import InformationType |
| 329 | from lp.registry.interfaces.accesspolicy import ( |
| 330 | IAccessArtifactGrantSource, |
| 331 | @@ -20,13 +24,13 @@ |
| 332 | ) |
| 333 | from lp.registry.interfaces.person import TeamSubscriptionPolicy |
| 334 | from lp.registry.interfaces.sharingjob import ( |
| 335 | - IRemoveBugSubscriptionsJobSource, |
| 336 | + IRemoveArtifactSubscriptionsJobSource, |
| 337 | ISharingJob, |
| 338 | ISharingJobSource, |
| 339 | ) |
| 340 | from lp.registry.model.accesspolicy import reconcile_access_for_artifact |
| 341 | from lp.registry.model.sharingjob import ( |
| 342 | - RemoveBugSubscriptionsJob, |
| 343 | + RemoveArtifactSubscriptionsJob, |
| 344 | SharingJob, |
| 345 | SharingJobDerived, |
| 346 | SharingJobType, |
| 347 | @@ -93,15 +97,15 @@ |
| 348 | def _makeJob(self): |
| 349 | self.bug = self.factory.makeBug() |
| 350 | self.requestor = self.factory.makePerson() |
| 351 | - job = getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 352 | - self.requestor, bugs=[self.bug]) |
| 353 | + job = getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 354 | + self.requestor, artifacts=[self.bug]) |
| 355 | return job |
| 356 | |
| 357 | def test_repr(self): |
| 358 | job = self._makeJob() |
| 359 | self.assertEqual( |
| 360 | - '<REMOVE_BUG_SUBSCRIPTIONS job reconciling subscriptions for ' |
| 361 | - 'bug_ids=[%d], requestor=%s>' |
| 362 | + '<REMOVE_ARTIFACT_SUBSCRIPTIONS job reconciling subscriptions ' |
| 363 | + 'for bug_ids=[%d], requestor=%s>' |
| 364 | % (self.bug.id, self.requestor.name), |
| 365 | repr(job)) |
| 366 | |
| 367 | @@ -126,27 +130,27 @@ |
| 368 | job_1 = self._makeJob() |
| 369 | job_2 = self._makeJob() |
| 370 | job_2.start() |
| 371 | - jobs = list(RemoveBugSubscriptionsJob.iterReady()) |
| 372 | + jobs = list(RemoveArtifactSubscriptionsJob.iterReady()) |
| 373 | self.assertEqual(1, len(jobs)) |
| 374 | self.assertEqual(job_1, jobs[0]) |
| 375 | |
| 376 | def test_log_name(self): |
| 377 | # The log_name is the name of the implementing class. |
| 378 | job = self._makeJob() |
| 379 | - self.assertEqual('RemoveBugSubscriptionsJob', job.log_name) |
| 380 | + self.assertEqual('RemoveArtifactSubscriptionsJob', job.log_name) |
| 381 | |
| 382 | def test_getOopsVars(self): |
| 383 | # The pillar and grantee name are added to the oops vars. |
| 384 | bug = self.factory.makeBug() |
| 385 | requestor = self.factory.makePerson() |
| 386 | - job = getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 387 | - requestor, bugs=[bug]) |
| 388 | + job = getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 389 | + requestor, artifacts=[bug]) |
| 390 | oops_vars = job.getOopsVars() |
| 391 | self.assertIs(True, len(oops_vars) >= 3) |
| 392 | self.assertIn( |
| 393 | ('sharing_job_type', |
| 394 | - 'Remove subscriptions for users who can no longer access bugs.'), |
| 395 | - oops_vars) |
| 396 | + 'Remove subscriptions for users who can no longer access ' |
| 397 | + 'artifacts.'), oops_vars) |
| 398 | |
| 399 | |
| 400 | def disable_trigger_fixture(): |
| 401 | @@ -208,44 +212,43 @@ |
| 402 | # removed. |
| 403 | |
| 404 | def create_job(distro, bug, grantee, owner): |
| 405 | - job = getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 406 | + job = getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 407 | owner, [bug]) |
| 408 | with person_logged_in(owner): |
| 409 | bug.transitionToInformationType( |
| 410 | InformationType.EMBARGOEDSECURITY, owner) |
| 411 | - return job, IRemoveBugSubscriptionsJobSource.getName() |
| 412 | + return job, IRemoveArtifactSubscriptionsJobSource.getName() |
| 413 | |
| 414 | self._assert_run_cronscript(create_job) |
| 415 | |
| 416 | |
| 417 | -class RemoveBugSubscriptionsJobTestCase(TestCaseWithFactory): |
| 418 | - """Test case for the RemoveBugSubscriptionsJob class.""" |
| 419 | +class RemoveArtifactSubscriptionsJobTestCase(TestCaseWithFactory): |
| 420 | + """Test case for the RemoveArtifactSubscriptionsJob class.""" |
| 421 | |
| 422 | layer = CeleryJobLayer |
| 423 | |
| 424 | def setUp(self): |
| 425 | self.useFixture(FeatureFixture({ |
| 426 | - 'jobs.celery.enabled_classes': |
| 427 | - 'RemoveBugSubscriptionsJob', |
| 428 | + 'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob', |
| 429 | })) |
| 430 | self.useFixture(disable_trigger_fixture()) |
| 431 | - super(RemoveBugSubscriptionsJobTestCase, self).setUp() |
| 432 | + super(RemoveArtifactSubscriptionsJobTestCase, self).setUp() |
| 433 | |
| 434 | def test_create(self): |
| 435 | - # Create an instance of RemoveBugSubscriptionsJob. |
| 436 | + # Create an instance of RemoveArtifactSubscriptionsJob. |
| 437 | self.assertIs( |
| 438 | True, |
| 439 | - IRemoveBugSubscriptionsJobSource.providedBy( |
| 440 | - RemoveBugSubscriptionsJob)) |
| 441 | + IRemoveArtifactSubscriptionsJobSource.providedBy( |
| 442 | + RemoveArtifactSubscriptionsJob)) |
| 443 | self.assertEqual( |
| 444 | - SharingJobType.REMOVE_BUG_SUBSCRIPTIONS, |
| 445 | - RemoveBugSubscriptionsJob.class_job_type) |
| 446 | + SharingJobType.REMOVE_ARTIFACT_SUBSCRIPTIONS, |
| 447 | + RemoveArtifactSubscriptionsJob.class_job_type) |
| 448 | requestor = self.factory.makePerson() |
| 449 | bug = self.factory.makeBug() |
| 450 | - job = getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 451 | + job = getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 452 | requestor, [bug]) |
| 453 | naked_job = removeSecurityProxy(job) |
| 454 | - self.assertIsInstance(job, RemoveBugSubscriptionsJob) |
| 455 | + self.assertIsInstance(job, RemoveArtifactSubscriptionsJob) |
| 456 | self.assertEqual(requestor.id, naked_job.requestor_id) |
| 457 | self.assertContentEqual([bug.id], naked_job.bug_ids) |
| 458 | |
| 459 | @@ -254,7 +257,7 @@ |
| 460 | requestor = self.factory.makePerson() |
| 461 | product = self.factory.makeProduct() |
| 462 | bug = self.factory.makeBug(product=product) |
| 463 | - job = getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 464 | + job = getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 465 | requestor, [bug], pillar=product) |
| 466 | expected_emails = [ |
| 467 | format_address_for_person(person) |
| 468 | @@ -302,13 +305,14 @@ |
| 469 | self.assertIn(policy_team_grantee, subscribers) |
| 470 | self.assertIn(policy_indirect_grantee, subscribers) |
| 471 | |
| 472 | - # Change bug bug attributes so that it can become inaccessible for |
| 473 | + # Change bug attributes so that it can become inaccessible for |
| 474 | # some users. |
| 475 | change_callback(bug) |
| 476 | reconcile_access_for_artifact( |
| 477 | bug, bug.information_type, bug.affected_pillars) |
| 478 | |
| 479 | - getUtility(IRemoveBugSubscriptionsJobSource).create(owner, [bug]) |
| 480 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 481 | + owner, [bug]) |
| 482 | with block_on_job(self): |
| 483 | transaction.commit() |
| 484 | |
| 485 | @@ -375,7 +379,7 @@ |
| 486 | information_type=InformationType.EMBARGOEDSECURITY) |
| 487 | |
| 488 | # Now run the job, removing access to userdata artifacts. |
| 489 | - getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 490 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 491 | pillar.owner, pillar=pillar, |
| 492 | information_types=[InformationType.USERDATA]) |
| 493 | with block_on_job(self): |
| 494 | @@ -399,7 +403,7 @@ |
| 495 | information_type=InformationType.USERDATA) |
| 496 | |
| 497 | bug.subscribe(admin, owner) |
| 498 | - getUtility(IRemoveBugSubscriptionsJobSource).create( |
| 499 | + getUtility(IRemoveArtifactSubscriptionsJobSource).create( |
| 500 | owner, [bug], pillar=product) |
| 501 | with block_on_job(self): |
| 502 | transaction.commit() |
| 503 | |
| 504 | === modified file 'lib/lp/registry/tests/test_teammembership.py' |
| 505 | --- lib/lp/registry/tests/test_teammembership.py 2012-06-15 00:42:38 +0000 |
| 506 | +++ lib/lp/registry/tests/test_teammembership.py 2012-07-02 23:43:24 +0000 |
| 507 | @@ -999,7 +999,7 @@ |
| 508 | def setUp(self): |
| 509 | self.useFixture(FeatureFixture({ |
| 510 | 'disclosure.unsubscribe_jobs.enabled': 'true', |
| 511 | - 'jobs.celery.enabled_classes': 'RemoveBugSubscriptionsJob', |
| 512 | + 'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob', |
| 513 | })) |
| 514 | super(TestTeamMembershipJobs, self).setUp() |
| 515 | |
| 516 | |
| 517 | === modified file 'lib/lp/services/config/schema-lazr.conf' |
| 518 | --- lib/lp/services/config/schema-lazr.conf 2012-06-15 00:42:38 +0000 |
| 519 | +++ lib/lp/services/config/schema-lazr.conf 2012-07-02 23:43:24 +0000 |
| 520 | @@ -1754,7 +1754,7 @@ |
| 521 | IPersonMergeJobSource, |
| 522 | IPlainPackageCopyJobSource, |
| 523 | IQuestionEmailJobSource, |
| 524 | - IRemoveBugSubscriptionsJobSource, |
| 525 | + IRemoveArtifactSubscriptionsJobSource, |
| 526 | ISevenDayCommercialExpirationJobSource, |
| 527 | IThirtyDayCommercialExpirationJobSource |
| 528 | |
| 529 | @@ -1787,7 +1787,7 @@ |
| 530 | dbuser: answertracker |
| 531 | crontab_group: MAIN |
| 532 | |
| 533 | -[IRemoveBugSubscriptionsJobSource] |
| 534 | +[IRemoveArtifactSubscriptionsJobSource] |
| 535 | # This section is used by cronscripts/process-job-source.py. |
| 536 | module: lp.registry.interfaces.sharingjob |
| 537 | dbuser: sharing-jobs |
