launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18998
Re: [Merge] lp:~wgrant/launchpad/webhook-jobrunner into lp:launchpad
Review: Approve
Diff comments:
>
> === modified file 'lib/lp/services/webhooks/tests/test_webhookjob.py'
> --- lib/lp/services/webhooks/tests/test_webhookjob.py 2015-07-13 11:01:57 +0000
> +++ lib/lp/services/webhooks/tests/test_webhookjob.py 2015-07-13 11:01:58 +0000
> @@ -251,3 +256,45 @@
> self.assertEqual(1, len(oopses.oopses))
> self.assertEqual(
> 'No webhook proxy configured.', oopses.oopses[0]['value'])
> +
> +
> +class TestViaCronscript(TestCaseWithFactory):
> +
> + layer = ZopelessDatabaseLayer
> +
> + def test_run_from_cronscript(self):
> + hook = self.factory.makeWebhook(delivery_url=u'http://hookep.com/foo')
> + job = WebhookDeliveryJob.create(hook, payload={'foo': 'bar'})
> + self.assertEqual(JobStatus.WAITING, job.status)
> + transaction.commit()
> +
> + retcode, stdout, stderr = run_script(
> + 'cronscripts/process-job-source.py', ['IWebhookDeliveryJobSource'],
> + expect_returncode=0)
> + self.assertEqual('', stdout)
> + self.assertIn('INFO Ran 1 WebhookDeliveryJob jobs.\n', stderr)
> +
> + self.assertEqual(JobStatus.COMPLETED, job.status)
> + self.assertIn(
> + 'Cannot connect to proxy',
> + job.json_data['result']['connection_error'])
> +
> +
> +class TestViaCelery(TestCaseWithFactory):
> +
> + layer = CeleryJobLayer
> +
> + def test_WebhookDeliveryJob(self):
> + """MergeProposalNeedsReviewEmailJob runs under Celery."""
Should be WebhookDeliveryJob.
> + hook = self.factory.makeWebhook(delivery_url=u'http://hookep.com/foo')
> +
> + self.useFixture(FeatureFixture(
> + {'jobs.celery.enabled_classes': 'WebhookDeliveryJob'}))
> + with block_on_job():
> + job = WebhookDeliveryJob.create(hook, payload={'foo': 'bar'})
> + transaction.commit()
> +
> + self.assertEqual(JobStatus.COMPLETED, job.status)
> + self.assertIn(
> + 'Cannot connect to proxy',
> + job.json_data['result']['connection_error'])
--
https://code.launchpad.net/~wgrant/launchpad/webhook-jobrunner/+merge/264533
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
References