|
17 | 17 | from learning_resources.factories import ( |
18 | 18 | ContentFileFactory, |
19 | 19 | LearningResourceFactory, |
20 | | - LearningResourcePlatformFactory, |
21 | 20 | LearningResourceRunFactory, |
22 | 21 | ) |
23 | 22 | from learning_resources.models import ContentFile, LearningResource |
|
27 | 26 | get_youtube_data, |
28 | 27 | get_youtube_transcripts, |
29 | 28 | marketing_page_for_resources, |
30 | | - remove_duplicate_resources, |
31 | 29 | scrape_marketing_pages, |
32 | 30 | sync_canvas_courses, |
33 | 31 | update_next_start_date_and_prices, |
@@ -839,37 +837,6 @@ def test_sync_canvas_courses(settings, mocker, django_assert_num_queries, canvas |
839 | 837 | assert mock_ingest_course.call_count == 2 |
840 | 838 |
|
841 | 839 |
|
842 | | -def test_remove_duplicate_resources(mocker, mocked_celery): |
843 | | - """ |
844 | | - Test that remove_duplicate_resources removes duplicate unpublished resources |
845 | | - while keeping the most recently created resource. |
846 | | - """ |
847 | | - duplicate_id = "duplicate_id" |
848 | | - |
849 | | - for platform_type in [PlatformType.edx, PlatformType.xpro, PlatformType.youtube]: |
850 | | - LearningResourceFactory.create( |
851 | | - readable_id=duplicate_id, |
852 | | - published=False, |
853 | | - platform=LearningResourcePlatformFactory.create(code=platform_type.name), |
854 | | - ) |
855 | | - |
856 | | - published_reasource = LearningResourceFactory.create( |
857 | | - readable_id=duplicate_id, |
858 | | - published=True, |
859 | | - platform=LearningResourcePlatformFactory.create( |
860 | | - code=platform_type.mitxonline.name |
861 | | - ), |
862 | | - ) |
863 | | - generate_embeddings_mock = mocker.patch( |
864 | | - "vector_search.tasks.generate_embeddings", autospec=True |
865 | | - ) |
866 | | - assert LearningResource.objects.filter(readable_id=duplicate_id).count() == 4 |
867 | | - with pytest.raises(mocked_celery.replace_exception_class): |
868 | | - remove_duplicate_resources() |
869 | | - assert generate_embeddings_mock.mock_calls[0].args[0] == [published_reasource.id] |
870 | | - assert LearningResource.objects.filter(readable_id=duplicate_id).count() == 1 |
871 | | - |
872 | | - |
873 | 840 | @pytest.mark.parametrize( |
874 | 841 | ("etl_source", "archive_path", "overwrite"), |
875 | 842 | [ |
|
0 commit comments