Get rid of calls to set_request_cache_with_short_name
This method from the toggle legacy classes should not actually be exposed to all. So we get rid of it by manually setting the cached value. While we are at it, we convert the STORAGE_BACKING_FOR_CACHE legacy waffle switch to its modern version. As the flag is not being used elsewhere, this should not break anything. We take the opportunity to modernize waffle switches from block_structure.config: to do so we convert the INVALIDATE_CACHE_ON_PUBLISH and RAISE_ERROR_WHEN_NOT_FOUND waffle switches from legacy classes to their modern equivalents. These switches are not used outside of edx-platform, so this change should not trigger any error.
This commit is contained in:
@@ -17,7 +17,7 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import SampleCourseFactory, check_mongo_calls
|
||||
from xmodule.modulestore.tests.sample_courses import BlockInfo
|
||||
from openedx.core.djangoapps.content.block_structure.api import clear_course_from_cache
|
||||
from openedx.core.djangoapps.content.block_structure.config import STORAGE_BACKING_FOR_CACHE, waffle_switch
|
||||
from openedx.core.djangoapps.content.block_structure.config import STORAGE_BACKING_FOR_CACHE
|
||||
|
||||
from ..api import get_blocks
|
||||
|
||||
@@ -230,7 +230,7 @@ class TestGetBlocksQueryCounts(TestGetBlocksQueryCountsBase):
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_query_counts_cached(self, store_type, with_storage_backing):
|
||||
with override_waffle_switch(waffle_switch(STORAGE_BACKING_FOR_CACHE), active=with_storage_backing):
|
||||
with override_waffle_switch(STORAGE_BACKING_FOR_CACHE, active=with_storage_backing):
|
||||
course = self._create_course(store_type)
|
||||
self._get_blocks(
|
||||
course,
|
||||
@@ -247,7 +247,7 @@ class TestGetBlocksQueryCounts(TestGetBlocksQueryCountsBase):
|
||||
@ddt.unpack
|
||||
def test_query_counts_uncached(self, store_type_tuple, with_storage_backing):
|
||||
store_type, expected_mongo_queries = store_type_tuple
|
||||
with override_waffle_switch(waffle_switch(STORAGE_BACKING_FOR_CACHE), active=with_storage_backing):
|
||||
with override_waffle_switch(STORAGE_BACKING_FOR_CACHE, active=with_storage_backing):
|
||||
course = self._create_course(store_type)
|
||||
clear_course_from_cache(course.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user