Skip to content

Commit

Permalink
chore: removed enable_course_live flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ayesha-waris committed Jan 8, 2024
1 parent 9cd1d7c commit 7c6795b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 35 deletions.
11 changes: 0 additions & 11 deletions openedx/core/djangoapps/course_live/config/waffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@

WAFFLE_NAMESPACE = 'course_live'

# .. toggle_name: course_live.enable_course_live
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Waffle flag to enable the course live app plugin
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2022-03-02
# .. toggle_target_removal_date: 2022-06-02
# .. toggle_warning: When the flag is ON, the course live app will be visible in the course authoring mfe
# .. toggle_tickets: TNL-9603
ENABLE_COURSE_LIVE = CourseWaffleFlag(f'{WAFFLE_NAMESPACE}.enable_course_live', __name__)


# .. toggle_name: course_live.enable_big_blue_button
# .. toggle_implementation: CourseWaffleFlag
Expand Down
5 changes: 2 additions & 3 deletions openedx/core/djangoapps/course_live/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from opaque_keys.edx.keys import CourseKey

from openedx.core.djangoapps.course_apps.plugins import CourseApp
from openedx.core.djangoapps.course_live.config.waffle import ENABLE_COURSE_LIVE

from .models import CourseLiveConfiguration

Expand All @@ -32,9 +31,9 @@ class LiveCourseApp(CourseApp):
@classmethod
def is_available(cls, course_key: CourseKey) -> bool:
"""
Live is available based on ENABLE_COURSE_LIVE flag
Live is available
"""
return ENABLE_COURSE_LIVE.is_enabled(course_key)
return True

@classmethod
def is_enabled(cls, course_key: CourseKey) -> bool:
Expand Down
2 changes: 0 additions & 2 deletions openedx/core/djangoapps/course_live/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from common.djangoapps.student.roles import CourseInstructorRole, CourseStaffRole, GlobalStaff
from lms.djangoapps.courseware.tabs import EnrolledTab
from openedx.core.djangoapps.course_live.config.waffle import ENABLE_COURSE_LIVE
from openedx.core.djangoapps.course_live.models import CourseLiveConfiguration
from openedx.core.djangoapps.course_live.providers import HasGlobalCredentials, ProviderManager
from openedx.core.lib.cache_utils import request_cached
Expand Down Expand Up @@ -87,7 +86,6 @@ def is_enabled(cls, course, user=None):
Check if the tab is enabled.
"""
return (
ENABLE_COURSE_LIVE.is_enabled(course.id) and
super().is_enabled(course, user) and
CourseLiveConfiguration.is_enabled(course.id)
)
Expand Down
14 changes: 6 additions & 8 deletions openedx/core/djangoapps/course_live/tests/test_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from lti_consumer.models import CourseAllowPIISharingInLTIFlag, LtiConfiguration

from lms.djangoapps.courseware.tests.test_tabs import TabTestCase
from openedx.core.djangoapps.course_live.config.waffle import ENABLE_COURSE_LIVE
from openedx.core.djangoapps.course_live.models import CourseLiveConfiguration
from openedx.core.djangoapps.course_live.tab import CourseLiveTab

Expand Down Expand Up @@ -56,13 +55,12 @@ def test_user_can_access_course_live_tab(self, course_live_config_enabled):
self.course_live_config.enabled = course_live_config_enabled
self.course_live_config.save()
tab = self.check_course_live_tab()
with override_waffle_flag(ENABLE_COURSE_LIVE, True):
self.check_can_display_results(
tab,
for_staff_only=True,
for_enrolled_users_only=True,
expected_value=course_live_config_enabled,
)
self.check_can_display_results(
tab,
for_staff_only=True,
for_enrolled_users_only=True,
expected_value=course_live_config_enabled,
)

@ddt.data(*itertools.product((True, False), repeat=3))
@ddt.unpack
Expand Down
20 changes: 9 additions & 11 deletions openedx/core/djangoapps/course_live/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from xmodule.modulestore.tests.django_utils import CourseUserType, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory

from ..config.waffle import ENABLE_COURSE_LIVE, ENABLE_BIG_BLUE_BUTTON
from ..config.waffle import ENABLE_BIG_BLUE_BUTTON
from ..models import CourseLiveConfiguration
from ..providers import ProviderManager

Expand Down Expand Up @@ -310,13 +310,12 @@ def test_non_staff_user_access(self):

def test_courseware_api_has_live_tab(self):
"""
Test if courseware api has live-tab after ENABLE_COURSE_LIVE flag is enabled
Test if courseware api has live-tab
"""
self.create_course_live_config()
with override_waffle_flag(ENABLE_COURSE_LIVE, True):
url = reverse('course-home:course-metadata', args=[self.course.id])
response = self.client.get(url)
content = json.loads(response.content.decode('utf-8'))
url = reverse('course-home:course-metadata', args=[self.course.id])
response = self.client.get(url)
content = json.loads(response.content.decode('utf-8'))
data = next((tab for tab in content['tabs'] if tab['tab_id'] == 'lti_live'), None)
self.assertEqual(data, {
'tab_id': 'lti_live',
Expand Down Expand Up @@ -432,11 +431,10 @@ def test_api_returns_live_iframe(self):
lti_1p1_client_secret='test_client_secret',
)
live_config.save()
with override_waffle_flag(ENABLE_COURSE_LIVE, True):
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.data['iframe'], Markup)
self.assertIn('iframe', str(response.data['iframe']))
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.data['iframe'], Markup)
self.assertIn('iframe', str(response.data['iframe']))

def test_non_authenticated_user(self):
"""
Expand Down

0 comments on commit 7c6795b

Please sign in to comment.