~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/tests/test_bugchanges.py

Merged db-devel into replication.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from lp.bugs.interfaces.cve import ICveSet
26
26
from lp.bugs.model.bugnotification import BugNotification
27
27
from lp.bugs.scripts.bugnotification import construct_email_notifications
 
28
from lp.services.features.testing import FeatureFixture
28
29
from lp.testing import (
 
30
    celebrity_logged_in,
 
31
    login_person,
29
32
    person_logged_in,
30
33
    TestCaseWithFactory,
31
34
    )
1084
1087
            bug, maintainer, bug_supervisor)
1085
1088
 
1086
1089
        # Now make the bug visible to the bug supervisor and re-test.
1087
 
        with person_logged_in(bug.default_bugtask.pillar.owner):
 
1090
        with celebrity_logged_in('admin'):
1088
1091
            bug.default_bugtask.transitionToAssignee(bug_supervisor)
1089
1092
 
1090
1093
        # Test with bug supervisor = maintainer.
1403
1406
            expected_activity=expected_activity,
1404
1407
            expected_notification=expected_notification)
1405
1408
 
 
1409
    def test_bugtask_deleted(self):
 
1410
        # Deleting a bug task adds entries in both BugActivity and
 
1411
        # BugNotification.
 
1412
        target = self.factory.makeProduct()
 
1413
        task_to_delete = self.bug.addTask(self.user, target)
 
1414
        self.saveOldChanges()
 
1415
 
 
1416
        login_person(self.user)
 
1417
        flags = {u"disclosure.delete_bugtask.enabled": u"on"}
 
1418
        with FeatureFixture(flags):
 
1419
            task_to_delete.delete()
 
1420
 
 
1421
        task_deleted_activity = {
 
1422
            'person': self.user,
 
1423
            'whatchanged': 'bug task deleted',
 
1424
            'oldvalue': target.bugtargetname,
 
1425
            }
 
1426
 
 
1427
        task_deleted_notification = {
 
1428
            'person': self.user,
 
1429
            'text': (
 
1430
                "** No longer affects: %s" % target.bugtargetname),
 
1431
            }
 
1432
 
 
1433
        self.assertRecordedChange(
 
1434
            expected_notification=task_deleted_notification,
 
1435
            expected_activity=task_deleted_activity)
 
1436
 
1406
1437
    def test_product_series_nominated(self):
1407
1438
        # Nominating a bug to be fixed in a product series adds an item
1408
1439
        # to the activity log only.