Пример #1
0
 def test_send_removed_revision_emails_subscribed(self):
     """send_removed_revision_emails run when RevisionsRemoved emitted."""
     self.useBzrBranches(direct_database=True)
     db_branch, tree = self.create_branch_and_tree()
     db_branch.subscribe(db_branch.registrant,
                         BranchSubscriptionNotificationLevel.FULL,
                         BranchSubscriptionDiffSize.WHOLEDIFF,
                         CodeReviewNotificationLevel.FULL,
                         db_branch.registrant)
     self.assertEqual(0, len(list(RevisionMailJob.iterReady())))
     notify(events.RevisionsRemoved(db_branch, tree.branch, ['x']))
     self.assertEqual(1, len(list(RevisionMailJob.iterReady())))
Пример #2
0
 def test_queue_tip_changed_email_jobs_subscribed(self):
     """A queue_tip_changed_email_jobs is run when TipChanged emitted."""
     self.useBzrBranches(direct_database=True)
     db_branch, tree = self.create_branch_and_tree()
     db_branch.subscribe(db_branch.registrant,
                         BranchSubscriptionNotificationLevel.FULL,
                         BranchSubscriptionDiffSize.WHOLEDIFF,
                         CodeReviewNotificationLevel.FULL,
                         db_branch.registrant)
     self.assertEqual(0, len(list(RevisionMailJob.iterReady())))
     notify(events.TipChanged(db_branch, tree.branch, True))
     self.assertEqual(1, len(list(RevisionMailJob.iterReady())))
Пример #3
0
 def test_send_removed_revision_emails_subscribed(self):
     """send_removed_revision_emails run when RevisionsRemoved emitted."""
     self.useBzrBranches(direct_database=True)
     db_branch, tree = self.create_branch_and_tree()
     db_branch.subscribe(
         db_branch.registrant,
         BranchSubscriptionNotificationLevel.FULL,
         BranchSubscriptionDiffSize.WHOLEDIFF,
         CodeReviewNotificationLevel.FULL,
         db_branch.registrant)
     self.assertEqual(0, len(list(RevisionMailJob.iterReady())))
     notify(events.RevisionsRemoved(db_branch, tree.branch, ['x']))
     self.assertEqual(1, len(list(RevisionMailJob.iterReady())))
Пример #4
0
 def test_queue_tip_changed_email_jobs_subscribed(self):
     """A queue_tip_changed_email_jobs is run when TipChanged emitted."""
     self.useBzrBranches(direct_database=True)
     db_branch, tree = self.create_branch_and_tree()
     db_branch.subscribe(
         db_branch.registrant,
         BranchSubscriptionNotificationLevel.FULL,
         BranchSubscriptionDiffSize.WHOLEDIFF,
         CodeReviewNotificationLevel.FULL,
         db_branch.registrant)
     self.assertEqual(0, len(list(RevisionMailJob.iterReady())))
     notify(events.TipChanged(db_branch, tree.branch, True))
     self.assertEqual(1, len(list(RevisionMailJob.iterReady())))
 def test_sendbranchmail(self):
     """Ensure sendbranchmail runs and sends email."""
     self.useBzrBranches()
     branch, tree = self.createBranch()
     mail_job = RevisionMailJob.create(branch, 1, '*****@*****.**',
                                       'body', 'foo')
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'cronscripts/process-job-source.py', ['IRevisionMailJobSource'])
     self.assertTextMatchesExpressionIgnoreWhitespace(
         'INFO    '
         'Creating lockfile: /var/lock/launchpad-process-job-source-'
         'IRevisionMailJobSource.lock\n'
         'INFO    Running synchronously.\n'
         'INFO    Running <REVISION_MAIL branch job \(\d+\) for .*?> '
         '\(ID %d\) in status Waiting\n'
         'INFO    Ran 1 RevisionMailJob jobs.\n' % mail_job.job.id, stderr)
     self.assertEqual('', stdout)
     self.assertEqual(0, retcode)
 def test_sendbranchmail(self):
     """Ensure sendbranchmail runs and sends email."""
     self.useBzrBranches()
     branch, tree = self.createBranch()
     mail_job = RevisionMailJob.create(
         branch, 1, '*****@*****.**', 'body', 'foo')
     transaction.commit()
     retcode, stdout, stderr = run_script(
         'cronscripts/process-job-source.py', ['IRevisionMailJobSource'])
     self.assertTextMatchesExpressionIgnoreWhitespace(
         'INFO    '
         'Creating lockfile: /var/lock/launchpad-process-job-source-'
         'IRevisionMailJobSource.lock\n'
         'INFO    Running synchronously.\n'
         'INFO    Running <REVISION_MAIL branch job \(\d+\) for .*?> '
         '\(ID %d\) in status Waiting\n'
         'INFO    Ran 1 RevisionMailJob jobs.\n' % mail_job.job.id, stderr)
     self.assertEqual('', stdout)
     self.assertEqual(0, retcode)