~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/buildmaster/tests/test_packagebuild.py

  • Committer: Ian Booth
  • Date: 2011-05-16 04:53:14 UTC
  • mto: This revision was merged to the branch mainline in revision 13059.
  • Revision ID: ian.booth@canonical.com-20110516045314-qa68oj46xqgwky3l
Add extra logic to allow notifications to be vetoed

Show diffs side-by-side

added added

removed removed

Lines of Context:
381
381
        return d.addCallback(got_status)
382
382
 
383
383
    def _test_handleStatus_notifies(self, status):
384
 
        # An email notification is sent for a given build status.
 
384
        # An email notification is sent for a given build status if
 
385
        # notifications are allowed for that status.
 
386
 
 
387
        naked_build = removeSecurityProxy(self.build)
 
388
        expected_notification = (
 
389
            status in naked_build._getAllowedStatusNotifications())
 
390
 
385
391
        def got_status(ignored):
386
 
            self.failIf(
387
 
                len(pop_notifications()) == 0, "No notifications received")
 
392
            if expected_notification:
 
393
                self.failIf(
 
394
                    len(pop_notifications()) == 0,
 
395
                    "No notifications received")
 
396
            else:
 
397
                self.failIf(
 
398
                    len(pop_notifications()) > 0,
 
399
                    "Notifications received")
388
400
 
389
401
        d = self.build.handleStatus(status, None, {})
390
402
        return d.addCallback(got_status)