コード例 #1
0
 def test_schedule_job(self):
     job = [
         (
             {
                 "foo": "baz"
             },
             "sentry.tasks.enqueue_scheduled_jobs",
             timezone.now() + timedelta(days=1),
         ),
         (
             {
                 "foo": "baz"
             },
             "sentry.tasks.enqueue_scheduled_jobs_followup",
             timezone.now() + timedelta(days=1),
         ),
     ]
     schedule_jobs(job)
     assert set(
         ScheduledJob.objects.filter(payload={
             "foo": "baz"
         }).values_list("name", flat=True)) == set([
             "sentry.tasks.enqueue_scheduled_jobs",
             "sentry.tasks.enqueue_scheduled_jobs_followup"
         ])
コード例 #2
0
 def test_schedule_job_order(self):
     with pytest.raises(ValidationError):
         job = [(
             "sentry.tasks.enqueue_scheduled_jobs",
             {
                 "foo": "baz"
             },
             timezone.now() + timedelta(days=1),
         )]
         schedule_jobs(job)
         pytest.fail("ValidationError raised. Check order of inputs.")
コード例 #3
0
 def test_schedule_job_order(self):
     with pytest.raises(
         ValidationError, message="ValidationError raised. Check order of inputs"
     ):
         job = [
             (
                 'sentry.tasks.enqueue_scheduled_jobs', {
                     'foo': 'baz'
                 }, timezone.now() + timedelta(days=1)
             )
         ]
         schedule_jobs(job)
コード例 #4
0
 def test_schedule_job(self):
     job = [
         (
             {
                 'foo': 'baz'
             }, 'sentry.tasks.enqueue_scheduled_jobs', timezone.now() + timedelta(days=1)
         ), (
             {
                 'foo': 'baz'
             }, 'sentry.tasks.enqueue_scheduled_jobs_followup',
             timezone.now() + timedelta(days=1)
         )
     ]
     schedule_jobs(job)
     assert set(
         ScheduledJob.objects.filter(
             payload={'foo': 'baz'},
         ).values_list('name', flat=True)
     ) == set(
         ['sentry.tasks.enqueue_scheduled_jobs', 'sentry.tasks.enqueue_scheduled_jobs_followup']
     )