Skip to content

Commit

Permalink
add: unit test for CrontabSchedule
Browse files Browse the repository at this point in the history
Signed-off-by: K8sCat <[email protected]>
  • Loading branch information
k8scat committed Oct 17, 2023
1 parent 2b9f57e commit 8f258e3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions t/unit/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
IntervalSchedule, PeriodicTask,
PeriodicTasks, SolarSchedule)
from django_celery_beat.utils import NEVER_CHECK_TIMEOUT, make_aware
from django_celery_beat.tzcrontab import TzAwareCrontab

_ids = count(0)

Expand Down Expand Up @@ -668,6 +669,20 @@ def test_CrontabSchedule_unicode(self):
month_of_year='4,6',
)) == '3 3 */2 4,6 tue (m/h/dM/MY/d) UTC'

@override_settings(
DJANGO_CELERY_BEAT_TZ_AWARE=False
)
def test_CrontabSchedule_schedule_crontab(self):
s = CrontabSchedule()
assert isinstance(s.schedule, crontab)

@override_settings(
DJANGO_CELERY_BEAT_TZ_AWARE=True
)
def test_CrontabSchedule_schedule_TzAwareCrontab(self):
s = CrontabSchedule()
assert isinstance(s.schedule, TzAwareCrontab)

def test_PeriodicTask_unicode_interval(self):
p = self.create_model_interval(schedule(timedelta(seconds=10)))
assert str(p) == f'{p.name}: every 10.0 seconds'
Expand Down

0 comments on commit 8f258e3

Please sign in to comment.