test: Remove test variants that test without a cache.
Since the cache is now always on, remove test cases that test the case when it's disabled.
This commit is contained in:
@@ -3,16 +3,13 @@ Tests for Blocks api.py
|
||||
"""
|
||||
|
||||
|
||||
from itertools import product
|
||||
from unittest.mock import patch
|
||||
|
||||
import ddt
|
||||
from django.test.client import RequestFactory
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
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
|
||||
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import SampleCourseFactory, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order
|
||||
@@ -209,34 +206,25 @@ class TestGetBlocksQueryCounts(TestGetBlocksQueryCountsBase):
|
||||
Tests query counts for the get_blocks function.
|
||||
"""
|
||||
|
||||
@ddt.data(
|
||||
*product(
|
||||
(ModuleStoreEnum.Type.split, ),
|
||||
(True, False),
|
||||
@ddt.data(ModuleStoreEnum.Type.split)
|
||||
def test_query_counts_cached(self, store_type):
|
||||
course = self._create_course(store_type)
|
||||
self._get_blocks(
|
||||
course,
|
||||
expected_mongo_queries=0,
|
||||
expected_sql_queries=14,
|
||||
)
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_query_counts_cached(self, store_type, 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,
|
||||
expected_mongo_queries=0,
|
||||
expected_sql_queries=14 if with_storage_backing else 13,
|
||||
)
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.split, 2, True, 24),
|
||||
(ModuleStoreEnum.Type.split, 2, False, 14),
|
||||
(ModuleStoreEnum.Type.split, 2, 24),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_query_counts_uncached(self, store_type, expected_mongo_queries, with_storage_backing, num_sql_queries):
|
||||
with override_waffle_switch(STORAGE_BACKING_FOR_CACHE, active=with_storage_backing):
|
||||
course = self._create_course(store_type)
|
||||
clear_course_from_cache(course.id)
|
||||
def test_query_counts_uncached(self, store_type, expected_mongo_queries, num_sql_queries):
|
||||
course = self._create_course(store_type)
|
||||
clear_course_from_cache(course.id)
|
||||
|
||||
self._get_blocks(
|
||||
course,
|
||||
expected_mongo_queries,
|
||||
expected_sql_queries=num_sql_queries,
|
||||
)
|
||||
self._get_blocks(
|
||||
course,
|
||||
expected_mongo_queries,
|
||||
expected_sql_queries=num_sql_queries,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user