Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions learning_resources/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
LevelType,
Pace,
)
from learning_resources.etl.loaders import update_index
from main.serializers import COMMON_IGNORED_FIELDS, WriteableSerializerMethodField

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -592,7 +591,6 @@ def create(self, validated_data):
models.LearningPath.objects.create(
learning_resource=path_resource, author=request.user
)
update_index(path_resource, True) # noqa: FBT003
return path_resource

def update(self, instance, validated_data):
Expand All @@ -604,7 +602,6 @@ def update(self, instance, validated_data):
resource.topics.set(
models.LearningResourceTopic.objects.filter(id__in=topics_data)
)
update_index(resource, False) # noqa: FBT003
return resource

class Meta:
Expand Down
4 changes: 0 additions & 4 deletions learning_resources/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
)
from learning_resources.tasks import get_ocw_courses
from learning_resources.utils import (
resource_delete_actions,
resource_unpublished_actions,
)
from learning_resources_search.api import get_similar_resources
Expand Down Expand Up @@ -384,9 +383,6 @@ def get_queryset(self):
queryset = queryset.filter(published=True)
return queryset

def perform_destroy(self, instance):
resource_delete_actions(instance)


@extend_schema_view(
list=extend_schema(
Expand Down
13 changes: 2 additions & 11 deletions learning_resources/views_learningpath_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def test_learning_path_endpoint_get(client, user, is_public, is_editor, has_imag
@pytest.mark.parametrize("is_editor", [True, False])
@pytest.mark.parametrize("is_anonymous", [True, False])
def test_learning_path_endpoint_create( # pylint: disable=too-many-arguments # noqa: PLR0913
mock_opensearch,
client,
is_anonymous,
is_published,
Expand Down Expand Up @@ -134,17 +133,12 @@ def test_learning_path_endpoint_create( # pylint: disable=too-many-arguments #
if resp.status_code == 201:
assert resp.data.get("title") == resp.data.get("title")
assert resp.data.get("description") == resp.data.get("description")
assert mock_opensearch.upsert_si.call_count == (
1 if has_permission and is_published else 0
)


@pytest.mark.parametrize("is_public", [True, False])
@pytest.mark.parametrize("is_editor", [True, False])
@pytest.mark.parametrize("update_topics", [True, False])
def test_learning_path_endpoint_patch(
mock_opensearch, client, update_topics, is_public, is_editor
):
def test_learning_path_endpoint_patch(client, update_topics, is_public, is_editor):
"""Test learningpath endpoint for updating a LearningPath"""
[original_topic, new_topic] = factories.LearningResourceTopicFactory.create_batch(2)
user = UserFactory.create()
Expand Down Expand Up @@ -179,8 +173,6 @@ def test_learning_path_endpoint_patch(
assert resp.data["topics"][0]["id"] == (
new_topic.id if update_topics else original_topic.id
)
assert mock_opensearch.upsert.call_count == (1 if is_public else 0)
assert mock_opensearch.deindex.call_count == (1 if not is_public else 0)


@pytest.mark.parametrize("is_editor", [True, False])
Expand Down Expand Up @@ -343,7 +335,7 @@ def test_learning_path_items_endpoint_delete_items(client, user, is_editor, num_


@pytest.mark.parametrize("is_editor", [True, False])
def test_learning_path_endpoint_delete(mock_opensearch, client, user, is_editor):
def test_learning_path_endpoint_delete(client, user, is_editor):
"""Test learningpath endpoint for deleting a LearningPath"""
learning_path = factories.LearningPathFactory.create()

Expand All @@ -366,7 +358,6 @@ def test_learning_path_endpoint_delete(mock_opensearch, client, user, is_editor)
).exists()
is not is_editor
)
assert mock_opensearch.deindex.call_count == (1 if is_editor else 0)


@pytest.mark.parametrize("is_editor", [True, False])
Expand Down
1 change: 0 additions & 1 deletion learning_resources_search/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def os_topic(topic_name) -> Mock:
"testindex_program_default",
"testindex_podcast_default",
"testindex_podcast_episode_default",
"testindex_learning_path_default",
"testindex_video_default",
"testindex_video_playlist_default",
],
Expand Down
4 changes: 0 additions & 4 deletions learning_resources_search/connection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def test_get_active_aliases(mocker, index_types, indexes_exist, object_types):
"testindex_podcast_reindexing",
"testindex_podcast_episode_default",
"testindex_podcast_episode_reindexing",
"testindex_learning_path_default",
"testindex_learning_path_reindexing",
"testindex_video_default",
"testindex_video_reindexing",
"testindex_video_playlist_default",
Expand All @@ -64,7 +62,6 @@ def test_get_active_aliases(mocker, index_types, indexes_exist, object_types):
"testindex_program_default",
"testindex_podcast_default",
"testindex_podcast_episode_default",
"testindex_learning_path_default",
"testindex_video_default",
"testindex_video_playlist_default",
]
Expand All @@ -75,7 +72,6 @@ def test_get_active_aliases(mocker, index_types, indexes_exist, object_types):
"testindex_program_reindexing",
"testindex_podcast_reindexing",
"testindex_podcast_episode_reindexing",
"testindex_learning_path_reindexing",
"testindex_video_reindexing",
"testindex_video_playlist_reindexing",
]
Expand Down
1 change: 0 additions & 1 deletion learning_resources_search/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class IndexestoUpdate(Enum):
PROGRAM_TYPE,
PODCAST_TYPE,
PODCAST_EPISODE_TYPE,
LEARNING_PATH_TYPE,
VIDEO_TYPE,
VIDEO_PLAYLIST_TYPE,
)
Expand Down
Loading