@@ -61,7 +61,7 @@ def test_status_is_expired_and_no_end_date_has_validation_error(self):
6161
6262 def test_status_is_expired_and_end_date_not_past_has_validation_error (self ):
6363 """Test that an allocation with status 'expired' and end date in the future raises a validation error."""
64- end_date_in_the_future : datetime .date = ( timezone . now () + datetime .timedelta (days = 1 )). date ( )
64+ end_date_in_the_future : datetime .date = datetime . date . today () + datetime .timedelta (days = 1 )
6565 actual_allocation : Allocation = AllocationFactory .build (
6666 status = self .expired_status , end_date = end_date_in_the_future , project = self .project
6767 )
@@ -70,7 +70,7 @@ def test_status_is_expired_and_end_date_not_past_has_validation_error(self):
7070
7171 def test_status_is_expired_and_start_date_after_end_date_has_validation_error (self ):
7272 """Test that an allocation with status 'expired' and start date after end date raises a validation error."""
73- end_date : datetime .date = ( timezone . now () + datetime .timedelta (days = 1 )). date ( )
73+ end_date : datetime .date = datetime . date . today () + datetime .timedelta (days = 1 )
7474 start_date_after_end_date : datetime .date = end_date + datetime .timedelta (days = 1 )
7575
7676 actual_allocation : Allocation = AllocationFactory .build (
@@ -116,7 +116,7 @@ def test_status_is_active_and_no_end_date_has_validation_error(self):
116116
117117 def test_status_is_active_and_start_date_after_end_date_has_validation_error (self ):
118118 """Test that an allocation with status 'active' and start date after end date raises a validation error."""
119- end_date : datetime .date = ( timezone . now () + datetime .timedelta (days = 1 )). date ( )
119+ end_date : datetime .date = datetime . date . today () + datetime .timedelta (days = 1 )
120120 start_date_after_end_date : datetime .date = end_date + datetime .timedelta (days = 1 )
121121
122122 actual_allocation : Allocation = AllocationFactory .build (
@@ -237,32 +237,32 @@ class AllocationModelExpiresInTests(TestCase):
237237
238238 def test_end_date_is_today_returns_zero (self ):
239239 """Test that the expires_in method returns 0 when the end date is today."""
240- allocation : Allocation = AllocationFactory (end_date = timezone . now (). date ())
240+ allocation : Allocation = AllocationFactory (end_date = datetime . date . today ())
241241 self .assertEqual (allocation .expires_in , 0 )
242242
243243 def test_end_date_tomorrow_returns_one (self ):
244244 """Test that the expires_in method returns 1 when the end date is tomorrow."""
245- tomorrow : datetime .date = ( timezone . now () + datetime .timedelta (days = 1 )). date ( )
245+ tomorrow : datetime .date = datetime . date . today () + datetime .timedelta (days = 1 )
246246 allocation : Allocation = AllocationFactory (end_date = tomorrow )
247247 self .assertEqual (allocation .expires_in , 1 )
248248
249249 def test_end_date_yesterday_returns_negative_one (self ):
250250 """Test that the expires_in method returns -1 when the end date is yesterday."""
251- yesterday : datetime .date = ( timezone . now () - datetime .timedelta (days = 1 )). date ( )
251+ yesterday : datetime .date = datetime . date . today () - datetime .timedelta (days = 1 )
252252 allocation : Allocation = AllocationFactory (end_date = yesterday )
253253 self .assertEqual (allocation .expires_in , - 1 )
254254
255255 def test_end_date_one_week_ago_returns_negative_seven (self ):
256256 """Test that the expires_in method returns -7 when the end date is one week ago."""
257257 days_in_a_week : int = 7
258- one_week_ago : datetime .date = ( timezone . now () - datetime .timedelta (days = days_in_a_week )). date ( )
258+ one_week_ago : datetime .date = datetime . date . today () - datetime .timedelta (days = days_in_a_week )
259259 allocation : Allocation = AllocationFactory (end_date = one_week_ago )
260260 self .assertEqual (allocation .expires_in , - days_in_a_week )
261261
262262 def test_end_date_in_one_week_returns_seven (self ):
263263 """Test that the expires_in method returns 7 when the end date is in one week."""
264264 days_in_a_week : int = 7
265- one_week_from_now : datetime .date = ( timezone . now () + datetime .timedelta (days = days_in_a_week )). date ( )
265+ one_week_from_now : datetime .date = datetime . date . today () + datetime .timedelta (days = days_in_a_week )
266266 allocation : Allocation = AllocationFactory (end_date = one_week_from_now )
267267 self .assertEqual (allocation .expires_in , days_in_a_week )
268268
0 commit comments