~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Graham Binns
  • Date: 2011-08-10 15:57:35 UTC
  • mto: This revision was merged to the branch mainline in revision 13665.
  • Revision ID: graham@canonical.com-20110810155735-5hse3gr18f0rpxlg
Fixed bug 655239.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
    datetime,
10
10
    timedelta,
11
11
    )
 
12
from storm.store import Store
12
13
import unittest
13
14
from urlparse import urlunsplit
14
15
 
475
476
        bug.default_bugtask.bugwatch = bug_watch
476
477
        self.assertRaises(BugWatchDeletionError, bug_watch.destroySelf)
477
478
 
 
479
    def test_deleting_bugwatch_deletes_bugwatchactivity(self):
 
480
        # Deleting a bug watch will also delete all its
 
481
        # BugWatchActivity entries.
 
482
        bug_watch = self.factory.makeBugWatch()
 
483
        for i in range(5):
 
484
            bug_watch.addActivity(message="Activity %s" % i)
 
485
        store = Store.of(bug_watch)
 
486
        watch_activity_query = (
 
487
            "SELECT id FROM BugWatchActivity WHERE bug_watch = %s" %
 
488
            bug_watch.id)
 
489
        self.assertNotEqual(0, store.execute(watch_activity_query).rowcount)
 
490
        bug_watch.destroySelf()
 
491
        self.assertEqual(0, store.execute(watch_activity_query).rowcount)
 
492
 
478
493
 
479
494
class TestBugWatchSet(TestCaseWithFactory):
480
495
    """Tests for the bugwatch updating system."""