forked from Tivix/django-cron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_crons.py
43 lines (27 loc) · 835 Bytes
/
test_crons.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from time import sleep
from django_cron import CronJobBase, Schedule
class TestSucessCronJob(CronJobBase):
code = 'test_success_cron_job'
schedule = Schedule(run_every_mins=0)
def do(self):
pass
class TestErrorCronJob(CronJobBase):
code = 'test_error_cron_job'
schedule = Schedule(run_every_mins=0)
def do(self):
raise Exception()
class Test5minsCronJob(CronJobBase):
code = 'test_run_every_mins'
schedule = Schedule(run_every_mins=5)
def do(self):
pass
class TestRunAtTimesCronJob(CronJobBase):
code = 'test_run_at_times'
schedule = Schedule(run_at_times=['0:00', '0:05'])
def do(self):
pass
class Wait3secCronJob(CronJobBase):
code = 'test_wait_3_seconds'
schedule = Schedule(run_every_mins=5)
def do(self):
sleep(3)