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" ])
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.")
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)
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'] )