Remove CONTENT_TYPE_GATING flag
This commit is contained in:
@@ -18,7 +18,6 @@ from django_comment_common.models import assign_default_role
|
||||
from django_comment_common.utils import seed_permissions_roles
|
||||
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
|
||||
from openedx.features.course_duration_limits.config import (
|
||||
CONTENT_TYPE_GATING_FLAG,
|
||||
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG
|
||||
)
|
||||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
|
||||
@@ -465,11 +464,11 @@ def get_visibility_partition_info(xblock, course=None):
|
||||
if len(partition["groups"]) > 1 or any(group["selected"] for group in partition["groups"]):
|
||||
selectable_partitions.append(partition)
|
||||
|
||||
flag_enabled = CONTENT_TYPE_GATING_FLAG.is_enabled() and not FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled()
|
||||
kill_flag_disabled = not FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled()
|
||||
course_key = xblock.scope_ids.usage_id.course_key
|
||||
is_library = isinstance(course_key, LibraryLocator)
|
||||
if not is_library and (
|
||||
flag_enabled or ContentTypeGatingConfig.current(course_key=course_key).studio_override_enabled
|
||||
kill_flag_disabled and ContentTypeGatingConfig.current(course_key=course_key).studio_override_enabled
|
||||
):
|
||||
selectable_partitions += get_user_partition_info(xblock, schemes=[CONTENT_TYPE_GATING_SCHEME], course=course)
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ class CourseListSearchViewTest(CourseApiTestViewMixin, ModuleStoreTestCase, Sear
|
||||
self.setup_user(self.audit_user)
|
||||
|
||||
# These query counts were found empirically
|
||||
query_counts = [65, 52, 52, 52, 52, 52, 52, 52, 52, 52, 22]
|
||||
query_counts = [64, 51, 51, 51, 51, 51, 51, 51, 51, 51, 21]
|
||||
ordered_course_ids = sorted([str(cid) for cid in (course_ids + [c.id for c in self.courses])])
|
||||
|
||||
self.clear_caches()
|
||||
|
||||
@@ -313,7 +313,7 @@ class TestGradeIteration(SharedModuleStoreTestCase):
|
||||
else mock_course_grade.return_value
|
||||
for student in self.students
|
||||
]
|
||||
with self.assertNumQueries(9):
|
||||
with self.assertNumQueries(8):
|
||||
all_course_grades, all_errors = self._course_grades_and_errors_for(self.course, self.students)
|
||||
self.assertEqual(
|
||||
{student: text_type(all_errors[student]) for student in all_errors},
|
||||
|
||||
@@ -413,7 +413,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
|
||||
|
||||
RequestCache.clear_all_namespaces()
|
||||
|
||||
expected_query_count = 50
|
||||
expected_query_count = 49
|
||||
with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'):
|
||||
with check_mongo_calls(mongo_count):
|
||||
with self.assertNumQueries(expected_query_count):
|
||||
|
||||
@@ -22,7 +22,6 @@ from openedx.core.djangoapps.config_model_utils.models import StackedConfigurati
|
||||
from openedx.core.djangoapps.config_model_utils.utils import is_in_holdback
|
||||
from openedx.features.content_type_gating.helpers import FULL_ACCESS, LIMITED_ACCESS
|
||||
from openedx.features.course_duration_limits.config import (
|
||||
CONTENT_TYPE_GATING_FLAG,
|
||||
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG,
|
||||
)
|
||||
from student.models import CourseEnrollment
|
||||
@@ -109,9 +108,6 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
|
||||
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
|
||||
return False
|
||||
|
||||
if CONTENT_TYPE_GATING_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
if enrollment is not None and (user is not None or course_key is not None):
|
||||
raise ValueError('Specify enrollment or user/course_key, but not both')
|
||||
|
||||
@@ -175,9 +171,6 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
|
||||
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
|
||||
return False
|
||||
|
||||
if CONTENT_TYPE_GATING_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
if target_datetime is None:
|
||||
target_datetime = timezone.now()
|
||||
|
||||
@@ -199,9 +192,6 @@ class ContentTypeGatingConfig(StackedConfigurationModel):
|
||||
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
|
||||
return False
|
||||
|
||||
if CONTENT_TYPE_GATING_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
# Explicitly cast this to bool, so that when self.enabled is None the method doesn't return None
|
||||
return bool(self.enabled and self.enabled_as_of <= target_datetime)
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfi
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
|
||||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
|
||||
from openedx.features.course_duration_limits.config import CONTENT_TYPE_GATING_FLAG
|
||||
from student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
|
||||
|
||||
@@ -74,9 +73,9 @@ class TestContentTypeGatingConfig(CacheIsolationTestCase):
|
||||
user = self.user
|
||||
course_key = self.course_overview.id
|
||||
|
||||
query_count = 8
|
||||
query_count = 7
|
||||
if not already_enrolled or not pass_enrollment and already_enrolled:
|
||||
query_count = 9
|
||||
query_count = 8
|
||||
|
||||
with self.assertNumQueries(query_count):
|
||||
enabled = ContentTypeGatingConfig.enabled_for_enrollment(
|
||||
@@ -94,12 +93,6 @@ class TestContentTypeGatingConfig(CacheIsolationTestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
ContentTypeGatingConfig.enabled_for_enrollment(Mock(name='enrollment'), None, Mock(name='course_key'))
|
||||
|
||||
@override_waffle_flag(CONTENT_TYPE_GATING_FLAG, True)
|
||||
def test_enabled_for_enrollment_flag_override(self):
|
||||
self.assertTrue(ContentTypeGatingConfig.enabled_for_enrollment(None, None, None))
|
||||
self.assertTrue(ContentTypeGatingConfig.enabled_for_enrollment(Mock(name='enrollment'), Mock(name='user'), None))
|
||||
self.assertTrue(ContentTypeGatingConfig.enabled_for_enrollment(Mock(name='enrollment'), None, Mock(name='course_key')))
|
||||
|
||||
@ddt.data(True, False)
|
||||
def test_enabled_for_course(
|
||||
self,
|
||||
|
||||
@@ -14,12 +14,6 @@ from student.signals import ENROLL_STATUS_CHANGE
|
||||
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name=u'content_type_gating')
|
||||
|
||||
CONTENT_TYPE_GATING_FLAG = WaffleFlag(
|
||||
waffle_namespace=WAFFLE_FLAG_NAMESPACE,
|
||||
flag_name=u'debug',
|
||||
flag_undefined_default=False
|
||||
)
|
||||
|
||||
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG = WaffleFlag(
|
||||
waffle_namespace=WAFFLE_FLAG_NAMESPACE,
|
||||
flag_name=u'global_kill_switch',
|
||||
|
||||
@@ -22,7 +22,6 @@ from openedx.core.djangoapps.config_model_utils.models import StackedConfigurati
|
||||
from openedx.core.djangoapps.config_model_utils.utils import is_in_holdback
|
||||
from openedx.features.content_type_gating.helpers import CONTENT_GATING_PARTITION_ID, CONTENT_TYPE_GATE_GROUP_IDS
|
||||
from openedx.features.course_duration_limits.config import (
|
||||
CONTENT_TYPE_GATING_FLAG,
|
||||
FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG,
|
||||
)
|
||||
from student.models import CourseEnrollment
|
||||
@@ -100,9 +99,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
|
||||
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
|
||||
return False
|
||||
|
||||
if CONTENT_TYPE_GATING_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
if enrollment is not None and (user is not None or course_key is not None):
|
||||
raise ValueError('Specify enrollment or user/course_key, but not both')
|
||||
|
||||
@@ -170,9 +166,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
|
||||
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
|
||||
return False
|
||||
|
||||
if CONTENT_TYPE_GATING_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
if target_datetime is None:
|
||||
target_datetime = timezone.now()
|
||||
|
||||
@@ -194,9 +187,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
|
||||
if FEATURE_BASED_ENROLLMENT_GLOBAL_KILL_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
if CONTENT_TYPE_GATING_FLAG.is_enabled():
|
||||
return True
|
||||
|
||||
# Explicitly cast this to bool, so that when self.enabled is None the method doesn't return None
|
||||
return bool(self.enabled and self.enabled_as_of <= target_datetime)
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ from openedx.core.djangoapps.content.course_overviews.tests.factories import Cou
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
|
||||
from openedx.features.course_duration_limits.models import CourseDurationLimitConfig
|
||||
from openedx.features.course_duration_limits.config import CONTENT_TYPE_GATING_FLAG
|
||||
from student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
|
||||
|
||||
@@ -81,9 +80,9 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase):
|
||||
user = self.user
|
||||
course_key = self.course_overview.id
|
||||
|
||||
query_count = 9
|
||||
query_count = 8
|
||||
if pass_enrollment and already_enrolled:
|
||||
query_count = 8
|
||||
query_count = 7
|
||||
|
||||
with self.assertNumQueries(query_count):
|
||||
enabled = CourseDurationLimitConfig.enabled_for_enrollment(
|
||||
@@ -109,24 +108,6 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase):
|
||||
Mock(name='course_key')
|
||||
)
|
||||
|
||||
@override_waffle_flag(CONTENT_TYPE_GATING_FLAG, True)
|
||||
def test_enabled_for_enrollment_flag_override(self):
|
||||
self.assertTrue(CourseDurationLimitConfig.enabled_for_enrollment(
|
||||
None,
|
||||
None,
|
||||
None
|
||||
))
|
||||
self.assertTrue(CourseDurationLimitConfig.enabled_for_enrollment(
|
||||
Mock(name='enrollment'),
|
||||
Mock(name='user'),
|
||||
None
|
||||
))
|
||||
self.assertTrue(CourseDurationLimitConfig.enabled_for_enrollment(
|
||||
Mock(name='enrollment'),
|
||||
None,
|
||||
Mock(name='course_key')
|
||||
))
|
||||
|
||||
@ddt.data(True, False)
|
||||
def test_enabled_for_course(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user