~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/model/tests/test_bugtask.py

[r=sinzui][bug=904902] When a bugtask is deleted,
 also delete any associated BugNomination record so that the bug can
 then be re-nominated against the target again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1552
1552
            self.assertRaises(CannotDeleteBugtask, bugtask.delete)
1553
1553
 
1554
1554
    def test_delete_bugtask(self):
1555
 
        # A bugtask can be deleted.
1556
 
        bug = self.factory.makeBug()
1557
 
        bugtask = self.factory.makeBugTask(bug=bug)
1558
 
        bug = bugtask.bug
1559
 
        login_person(bugtask.owner)
 
1555
        # A bugtask can be deleted and after deletion, re-nominated.
 
1556
        owner = self.factory.makePerson()
 
1557
        product = self.factory.makeProduct(driver=owner, bug_supervisor=owner)
 
1558
        bug = self.factory.makeBug(
 
1559
            product=product, owner=owner)
 
1560
        target = self.factory.makeProductSeries(product=product)
 
1561
        login_person(bug.owner)
 
1562
        nomination = bug.addNomination(bug.owner, target)
 
1563
        nomination.approve(bug.owner)
 
1564
        bugtask = bug.getBugTask(target)
1560
1565
        with FeatureFixture(self.flags):
1561
1566
            bugtask.delete()
1562
1567
        self.assertEqual([bug.default_bugtask], bug.bugtasks)
 
1568
        self.assertTrue(bug.canBeNominatedFor(target))
1563
1569
 
1564
1570
    def test_delete_default_bugtask(self):
1565
1571
        # The default bugtask can be deleted.