File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 3333 html_to_markdown ,
3434 load_course_blocklist ,
3535 resource_unpublished_actions ,
36+ resource_upserted_actions ,
3637)
3738from learning_resources_search .constants import COURSE_TYPE
3839from learning_resources_search .exceptions import RetryError
@@ -79,6 +80,8 @@ def update_next_start_date_and_prices():
7980 resources = LearningResource .objects .filter (next_start_date__lt = timezone .now ())
8081 for resource in resources :
8182 load_run_dependent_values (resource )
83+ if resource .published :
84+ resource_upserted_actions (resource , percolate = False )
8285 clear_search_cache ()
8386 return len (resources )
8487
Original file line number Diff line number Diff line change @@ -475,17 +475,26 @@ def test_get_youtube_transcripts(mocker):
475475 )
476476
477477
478- def test_update_next_start_date (mocker ):
478+ @pytest .mark .parametrize ("published" , [True , False ])
479+ def test_update_next_start_date (mocker , published ):
479480 learning_resource = LearningResourceFactory .create (
480- next_start_date = (timezone .now () - timedelta (10 ))
481+ next_start_date = (timezone .now () - timedelta (10 )),
482+ published = published ,
481483 )
482484 LearningResourceFactory .create (next_start_date = (timezone .now () + timedelta (1 )))
483485
484486 mock_load_next_start_date = mocker .patch (
485487 "learning_resources.tasks.load_run_dependent_values"
486488 )
489+ mock_upsert_index = mocker .patch (
490+ "learning_resources.tasks.resource_upserted_actions"
491+ )
487492 update_next_start_date_and_prices ()
488493 mock_load_next_start_date .assert_called_once_with (learning_resource )
494+ if published :
495+ mock_upsert_index .assert_called_once_with (learning_resource , percolate = False )
496+ else :
497+ mock_upsert_index .assert_not_called ()
489498
490499
491500@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments