forked from Tivix/django-cron
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_crons.py
56 lines (35 loc) · 1.05 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
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)
class RunOnWeekendCronJob(CronJobBase):
code = 'run_on_weekend'
schedule = Schedule(run_on_days=[5,6], run_at_times=['0:00',])
def do(self):
pass
class NoCodeCronJob(CronJobBase):
def do(self):
pass