Skip to content

Commit e73f397

Browse files
author
Andrew Yoo
committed
Add -1 case
1 parent b0749b2 commit e73f397

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/unit/test_utils.py

+19
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@ def test_make_aware_not_use_tz_naive_not_dst(self, mock_getattr, mock_is_naive,
9898
@mock.patch('django_celery_beat.utils.time.localtime')
9999
@mock.patch('django_celery_beat.utils.timezone.is_naive')
100100
@mock.patch('django_celery_beat.utils.getattr')
101+
def test_make_aware_not_use_tz_naive_negative_dst(self, mock_getattr, mock_is_naive, mock_localtime_1, mock_make_aware, mock_get_default_timezone, mock_localtime_2):
102+
dt = datetime(2022, 11, 6, 1, 15, 0)
103+
mock_getattr.return_value = False
104+
mock_is_naive.return_value = True
105+
mock_get_default_timezone.return_value = "America/Los_Angeles"
106+
mock_localtime_1.return_value = time.struct_time([2022, 11, 6, 1, 15, 0, 0, 310, -1])
107+
mock_make_aware.return_value = dt
108+
109+
self.assertEquals(utils.make_aware(dt), dt)
110+
111+
mock_localtime_1.assert_called_with()
112+
mock_make_aware.assert_called_with(dt, "America/Los_Angeles", is_dst=None)
113+
mock_get_default_timezone.assert_called()
114+
@mock.patch('django_celery_beat.utils.timezone.localtime')
115+
@mock.patch('django_celery_beat.utils.timezone.get_default_timezone')
116+
@mock.patch('django_celery_beat.utils.timezone.make_aware')
117+
@mock.patch('django_celery_beat.utils.time.localtime')
118+
@mock.patch('django_celery_beat.utils.timezone.is_naive')
119+
@mock.patch('django_celery_beat.utils.getattr')
101120
def test_make_aware_not_use_tz_not_naive_dst(self, mock_getattr, mock_is_naive, mock_localtime_1, mock_make_aware, mock_get_default_timezone, mock_localtime_2):
102121
dt = datetime(2022, 11, 6, 1, 15, 0)
103122
mock_getattr.return_value = False

0 commit comments

Comments
 (0)