From 861ebd3625acbeab804fc8f7033d2c2df8c65e39 Mon Sep 17 00:00:00 2001 From: Muhammad Afaq Shuaib <78806673+AfaqShuaib09@users.noreply.github.com> Date: Tue, 26 Sep 2023 17:05:00 +0500 Subject: [PATCH] chore: add Add CompressedCacheResponseMixin to CourseRun Viewset (#4109) --- .../apps/api/v1/tests/test_views/test_course_runs.py | 1 + course_discovery/apps/api/v1/views/course_runs.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/course_discovery/apps/api/v1/tests/test_views/test_course_runs.py b/course_discovery/apps/api/v1/tests/test_views/test_course_runs.py index a541ebed46..ec6439b0d1 100644 --- a/course_discovery/apps/api/v1/tests/test_views/test_course_runs.py +++ b/course_discovery/apps/api/v1/tests/test_views/test_course_runs.py @@ -38,6 +38,7 @@ @ddt.ddt +@pytest.mark.usefixtures('django_cache') class CourseRunViewSetTests(SerializationMixin, ElasticsearchTestMixin, OAuth2Mixin, APITestCase): def setUp(self): super().setUp() diff --git a/course_discovery/apps/api/v1/views/course_runs.py b/course_discovery/apps/api/v1/views/course_runs.py index fb202c7f7f..32476fa0a6 100644 --- a/course_discovery/apps/api/v1/views/course_runs.py +++ b/course_discovery/apps/api/v1/views/course_runs.py @@ -14,6 +14,7 @@ from rest_framework.response import Response from course_discovery.apps.api import filters, serializers +from course_discovery.apps.api.cache import CompressedCacheResponseMixin from course_discovery.apps.api.mixins import ValidElasticSearchQueryRequiredMixin from course_discovery.apps.api.pagination import ProxiedPagination from course_discovery.apps.api.permissions import IsCourseRunEditorOrDjangoOrReadOnly @@ -49,7 +50,7 @@ def inner(*args, **kwargs): # pylint: disable=useless-super-delegation -class CourseRunViewSet(ValidElasticSearchQueryRequiredMixin, viewsets.ModelViewSet): +class CourseRunViewSet(CompressedCacheResponseMixin, ValidElasticSearchQueryRequiredMixin, viewsets.ModelViewSet): """ CourseRun resource. """ filter_backends = (DjangoFilterBackend, OrderingFilter) filterset_class = filters.CourseRunFilter