@@ -376,7 +376,7 @@ async def test_create_match_copies_volunteer_availability(
376376 async def test_create_match_filters_past_and_invalid_times (
377377 self , db_session , participant_user , volunteer_with_mixed_availability
378378 ):
379- """Should filter out past times and non- half-hour times """
379+ """Should filter out past times and ensure all times are on half-hour boundaries """
380380 try :
381381 match_service = MatchService (db_session )
382382 request = MatchCreateRequest (
@@ -392,16 +392,25 @@ async def test_create_match_filters_past_and_invalid_times(
392392 assert len (match .suggested_time_blocks ) == 0
393393
394394 detail = await match_service .volunteer_accept_match (match_id , volunteer_with_mixed_availability .id )
395- assert len (detail .suggested_time_blocks ) == 2
396395
397- # Should only have 2 valid future times (14:00, 14:30)
398- # Past time and :15 time should be filtered out
396+ # Should have at least some suggested times (exact count depends on day of week due to 8-day projection)
397+ assert len (detail .suggested_time_blocks ) > 0
398+
399399 db_session .refresh (match )
400- assert len (match .suggested_time_blocks ) == 2
400+ assert len (match .suggested_time_blocks ) > 0
401401
402- # Verify all are at :00 or :30
402+ # Verify all times are in the future (past times filtered out)
403+ now = datetime .now (timezone .utc )
403404 for block in match .suggested_time_blocks :
404- assert block .start_time .minute in {0 , 30 }
405+ assert block .start_time >= now , f"Time block { block .start_time } is in the past"
406+
407+ # Verify all are at :00 or :30 (half-hour boundaries)
408+ for block in match .suggested_time_blocks :
409+ assert block .start_time .minute in {0 , 30 }, f"Time block { block .start_time } is not on half-hour boundary"
410+
411+ # Verify all times are in UTC
412+ for block in match .suggested_time_blocks :
413+ assert block .start_time .tzinfo == timezone .utc
405414
406415 db_session .commit ()
407416 except Exception :
0 commit comments