feat: Added flag for big blue button provider (#30645)

* feat: added flag for big blue button provider

* feat: Updated a comment

* fix: updated tests

* fix: updated serializer

* fix: resolved failed tests

Co-authored-by: AhtishamShahid <ahtishamshahid@A006-00850.local>
This commit is contained in:
Ahtisham Shahid
2022-06-28 16:34:10 +05:00
committed by GitHub
parent 6a6b883a49
commit 8e8bb57b3b
4 changed files with 25 additions and 14 deletions

View File

@@ -17,3 +17,15 @@ WAFFLE_NAMESPACE = 'course_live'
# .. 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
# .. toggle_default: False
# .. toggle_description: Waffle flag to enable big blue button provider
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2022-06-23
# .. toggle_target_removal_date: 2022-09-23
# .. toggle_warning: When the flag is ON, the big blue button provider will be available in course live
# .. toggle_tickets: INF-308
ENABLE_BIG_BLUE_BUTTON = CourseWaffleFlag(f'{WAFFLE_NAMESPACE}.enable_big_blue_button', __name__)

View File

@@ -5,6 +5,8 @@ from abc import ABC
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):
"""
@@ -111,7 +113,7 @@ class BigBlueButton(LiveProvider, HasGlobalCredentials):
@property
def is_enabled(self) -> bool:
return True
return ENABLE_BIG_BLUE_BUTTON.is_enabled()
@staticmethod
def get_global_keys() -> Dict:
@@ -129,12 +131,10 @@ class BigBlueButton(LiveProvider, HasGlobalCredentials):
"""
credentials = self.get_global_keys()
if credentials:
self.key = credentials['KEY']
self.secret = credentials['SECRET']
self.url = credentials['URL']
return bool(credentials.get("KEY", None)
and credentials.get("SECRET", None)
and credentials.get("URL", None))
self.key = credentials.get('KEY')
self.secret = credentials.get('SECRET')
self.url = credentials.get('URL')
return bool(self.key and self.secret and self.url)
return False

View File

@@ -7,10 +7,6 @@ from lti_consumer.models import LtiConfiguration
from rest_framework import serializers
from .models import CourseLiveConfiguration
# from .utils import provider_requires_custom_email
from .providers import ProviderManager
providers = ProviderManager().get_enabled_providers()
class LtiSerializer(serializers.ModelSerializer):

View File

@@ -13,14 +13,13 @@ 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
from ..config.waffle import ENABLE_COURSE_LIVE, ENABLE_BIG_BLUE_BUTTON
from ..models import CourseLiveConfiguration
from ..providers import ProviderManager
providers = ProviderManager().get_enabled_providers()
@ddt.ddt
@override_waffle_flag(ENABLE_BIG_BLUE_BUTTON, True)
class TestCourseLiveConfigurationView(ModuleStoreTestCase, APITestCase):
"""
Unit tests for the CourseLiveConfigurationView.
@@ -50,6 +49,7 @@ class TestCourseLiveConfigurationView(ModuleStoreTestCase, APITestCase):
"""
creates a courseLiveConfiguration
"""
providers = ProviderManager().get_enabled_providers()
if providers.get(provider).requires_pii_sharing():
CourseAllowPIISharingInLTIFlag.objects.create(course_id=self.course.id, enabled=True)
@@ -272,6 +272,7 @@ class TestCourseLiveConfigurationView(ModuleStoreTestCase, APITestCase):
"""
Create and test POST request response data
"""
providers = ProviderManager().get_enabled_providers()
if providers.get(provider).requires_pii_sharing():
CourseAllowPIISharingInLTIFlag.objects.create(course_id=self.course.id, enabled=True)
@@ -307,6 +308,7 @@ class TestCourseLiveConfigurationView(ModuleStoreTestCase, APITestCase):
self.assertEqual(content, expected_data)
@override_waffle_flag(ENABLE_BIG_BLUE_BUTTON, True)
class TestCourseLiveProvidersView(ModuleStoreTestCase, APITestCase):
"""
Tests for course live provider view
@@ -328,6 +330,7 @@ class TestCourseLiveProvidersView(ModuleStoreTestCase, APITestCase):
)
def test_response_has_correct_data(self):
providers = ProviderManager().get_enabled_providers()
expected_data = {
'providers': {
'active': '',