Skip to content

Commit

Permalink
chore: removed enable_course_live and enable_big_blue_button flag fla…
Browse files Browse the repository at this point in the history
…gs (#33998)

* chore: removed enable_course_live flag

* chore: removed enable_big_blue_button flag

* fix: fixing failed test cases
  • Loading branch information
ayesha-waris authored Jan 12, 2024
1 parent 53270f1 commit 2fd1f7b
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
__test__ = True

# TODO: decrease query count as part of REVO-28
QUERY_COUNT = 32
QUERY_COUNT = 33

TEST_DATA = {
('no_overrides', 1, True, False): (QUERY_COUNT, 2),
Expand Down
10 changes: 5 additions & 5 deletions lms/djangoapps/courseware/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def test_index_query_counts(self):
self.client.login(username=self.user.username, password=self.user_password)
CourseEnrollment.enroll(self.user, course.id)

with self.assertNumQueries(177, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
with self.assertNumQueries(178, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
with check_mongo_calls(3):
url = reverse(
'courseware_section',
Expand Down Expand Up @@ -1491,8 +1491,8 @@ def test_view_certificate_link(self):
self.assertContains(resp, "earned a certificate for this course.")

@ddt.data(
(True, 53),
(False, 53),
(True, 54),
(False, 54),
)
@ddt.unpack
def test_progress_queries_paced_courses(self, self_paced, query_count):
Expand All @@ -1507,13 +1507,13 @@ def test_progress_queries(self):
ContentTypeGatingConfig.objects.create(enabled=True, enabled_as_of=datetime(2018, 1, 1))
self.setup_course()
with self.assertNumQueries(
53, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST
54, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST
), check_mongo_calls(2):
self._get_progress_page()

for _ in range(2):
with self.assertNumQueries(
37, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST
38, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST
), check_mongo_calls(2):
self._get_progress_page()

Expand Down
31 changes: 0 additions & 31 deletions openedx/core/djangoapps/course_live/config/waffle.py

This file was deleted.

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
4 changes: 1 addition & 3 deletions openedx/core/djangoapps/course_live/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from typing import List, Dict
from django.conf import settings

from openedx.core.djangoapps.course_live.config.waffle import ENABLE_BIG_BLUE_BUTTON


class LiveProvider(ABC):
"""
Expand Down Expand Up @@ -120,7 +118,7 @@ def has_free_tier(self) -> bool:

@property
def is_enabled(self) -> bool:
return ENABLE_BIG_BLUE_BUTTON.is_enabled()
return True

@staticmethod
def get_global_keys() -> Dict:
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
15 changes: 6 additions & 9 deletions openedx/core/djangoapps/course_live/tests/test_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

import ddt
from django.test import RequestFactory
from edx_toggles.toggles.testutils import override_waffle_flag
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 +54,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
22 changes: 8 additions & 14 deletions openedx/core/djangoapps/course_live/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@
import ddt
from django.test import RequestFactory
from django.urls import reverse
from edx_toggles.toggles.testutils import override_waffle_flag
from lti_consumer.models import CourseAllowPIISharingInLTIFlag, LtiConfiguration
from markupsafe import Markup
from rest_framework.test import APITestCase
from xmodule.modulestore import ModuleStoreEnum
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 ..models import CourseLiveConfiguration
from ..providers import ProviderManager


@ddt.ddt
@override_waffle_flag(ENABLE_BIG_BLUE_BUTTON, True)
class TestCourseLiveConfigurationView(ModuleStoreTestCase, APITestCase):
"""
Unit tests for the CourseLiveConfigurationView.
Expand Down Expand Up @@ -310,13 +307,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 @@ -356,7 +352,6 @@ def test_create_configurations_response_free_tier(self, provider, share_email, s
self.assertEqual(content, expected_data)


@override_waffle_flag(ENABLE_BIG_BLUE_BUTTON, True)
class TestCourseLiveProvidersView(ModuleStoreTestCase, APITestCase):
"""
Tests for course live provider view
Expand Down Expand Up @@ -432,11 +427,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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_queries(self):

# Fetch the view and verify that the query counts haven't changed
# TODO: decrease query count as part of REVO-28
with self.assertNumQueries(52, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
with self.assertNumQueries(53, table_ignorelist=QUERY_COUNT_TABLE_IGNORELIST):
with check_mongo_calls(3):
url = course_updates_url(self.course)
self.client.get(url)

0 comments on commit 2fd1f7b

Please sign in to comment.