From bfd95c7fbb6dfecf579db7a8196867627edad566 Mon Sep 17 00:00:00 2001
From: Zainab Amir <zainab.amir@arbisoft.com>
Date: Wed, 27 May 2020 18:38:01 +0500
Subject: [PATCH] Remove transcript credential saving in VAL (#24066)

---
 .../views/tests/test_transcript_settings.py   | 55 -------------------
 .../contentstore/views/transcript_settings.py | 17 ++----
 cms/envs/common.py                            |  9 ---
 lms/envs/production.py                        |  5 --
 .../video_pipeline/config/waffle.py           |  6 --
 5 files changed, 4 insertions(+), 88 deletions(-)

diff --git a/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py b/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py
index 67d67f4f98d..d7b6351c42d 100644
--- a/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py
+++ b/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py
@@ -15,11 +15,6 @@ from contentstore.tests.utils import CourseTestCase
 from contentstore.utils import reverse_course_url
 from contentstore.views.transcript_settings import TranscriptionProviderErrorType, validate_transcript_credentials
 from openedx.core.djangoapps.profile_images.tests.helpers import make_image_file
-from openedx.core.djangoapps.video_pipeline.config.waffle import (
-    SAVE_CREDENTIALS_IN_VAL,
-    waffle_flags
-)
-from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
 from student.roles import CourseStaffRole
 
 
@@ -113,56 +108,6 @@ class TranscriptCredentialsTest(CourseTestCase):
         self.assertEqual(response.status_code, expected_status_code)
         self.assertEqual(response.content.decode('utf-8'), expected_response)
 
-    @override_waffle_flag(waffle_flags()[SAVE_CREDENTIALS_IN_VAL], True)
-    @ddt.data(
-        (
-            {
-                'provider': '3PlayMedia',
-                'api_key': '11111',
-                'api_secret_key': '44444'
-            },
-            {'error_type': TranscriptionProviderErrorType.INVALID_CREDENTIALS},
-            400,
-            '{\n  "error": "The information you entered is incorrect."\n}'
-        ),
-        (
-            {
-                'provider': 'Cielo24',
-                'api_key': '12345',
-                'username': 'test_user'
-            },
-            {'error_type': None},
-            200,
-            ''
-        ),
-        (
-            {
-                'provider': '3PlayMedia',
-                'api_key': '12345',
-                'api_secret_key': '44444'
-            },
-            {'error_type': None},
-            200,
-            ''
-        )
-    )
-    @ddt.unpack
-    @patch('edxval.api.create_or_update_transcript_credentials')
-    def test_val_transcript_credentials_handler(self, request_payload, update_credentials_response,
-                                                expected_status_code, expected_response, api_patch):
-        """
-        Test that credentials handler works fine with VAL api endpoint.
-        """
-        api_patch.return_value = update_credentials_response
-        transcript_credentials_url = self.get_url_for_course_key(self.course.id)
-        response = self.client.post(
-            transcript_credentials_url,
-            data=json.dumps(request_payload),
-            content_type='application/json'
-        )
-        self.assertEqual(response.status_code, expected_status_code)
-        self.assertEqual(response.content.decode('utf-8'), expected_response)
-
 
 @ddt.ddt
 class TranscriptCredentialsValidationTest(TestCase):
diff --git a/cms/djangoapps/contentstore/views/transcript_settings.py b/cms/djangoapps/contentstore/views/transcript_settings.py
index 7c6f3312197..8e328e3587f 100644
--- a/cms/djangoapps/contentstore/views/transcript_settings.py
+++ b/cms/djangoapps/contentstore/views/transcript_settings.py
@@ -11,6 +11,9 @@ from django.core.files.base import ContentFile
 from django.http import HttpResponse, HttpResponseNotFound
 from django.utils.translation import ugettext as _
 from django.views.decorators.http import require_GET, require_http_methods, require_POST
+from opaque_keys.edx.keys import CourseKey
+
+from contentstore.views.videos import TranscriptProvider
 from edxval.api import (
     create_or_update_video_transcript,
     delete_video_transcript,
@@ -19,14 +22,7 @@ from edxval.api import (
     get_video_transcript_data,
     update_transcript_credentials_state_for_org
 )
-from opaque_keys.edx.keys import CourseKey
-
-from contentstore.views.videos import TranscriptProvider
 from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag
-from openedx.core.djangoapps.video_pipeline.config.waffle import (
-    SAVE_CREDENTIALS_IN_VAL,
-    waffle_flags
-)
 from openedx.core.djangoapps.video_pipeline.api import update_3rd_party_transcription_service_credentials
 from student.auth import has_studio_write_access
 from util.json_request import JsonResponse, expect_json
@@ -114,12 +110,7 @@ def transcript_credentials_handler(request, course_key_string):
     else:
         # Send the validated credentials to edx-video-pipeline.
         credentials_payload = dict(validated_credentials, org=course_key.org, provider=provider)
-        if waffle_flags()[SAVE_CREDENTIALS_IN_VAL].is_enabled(course_key):
-            from edxval.api import create_or_update_transcript_credentials
-            response = create_or_update_transcript_credentials(**credentials_payload)
-            error_response, is_updated = response, not response.get('error_type')
-        else:
-            error_response, is_updated = update_3rd_party_transcription_service_credentials(**credentials_payload)
+        error_response, is_updated = update_3rd_party_transcription_service_credentials(**credentials_payload)
         # Send appropriate response based on whether credentials were updated or not.
         if is_updated:
             # Cache credentials state in edx-val.
diff --git a/cms/envs/common.py b/cms/envs/common.py
index 800d467fff3..5443e168f5a 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -2094,15 +2094,6 @@ VIDEO_TRANSCRIPTS_SETTINGS = dict(
 
 VIDEO_TRANSCRIPTS_MAX_AGE = 31536000
 
-############################ TRANSCRIPT PROVIDERS SETTINGS ########################
-
-# Note: These settings will also exist in video-encode-manager, so any update here
-# should also be done there.
-CIELO24_SETTINGS = {
-    'CIELO24_API_VERSION': 1,
-    'CIELO24_BASE_API_URL': "https://api.cielo24.com/api",
-    'CIELO24_LOGIN_URL': "https://api.cielo24.com/api/account/login"
-}
 
 ##### shoppingcart Payment #####
 PAYMENT_SUPPORT_EMAIL = 'billing@example.com'
diff --git a/lms/envs/production.py b/lms/envs/production.py
index a98a5764c55..1a7e8a32ed1 100644
--- a/lms/envs/production.py
+++ b/lms/envs/production.py
@@ -923,11 +923,6 @@ PARENTAL_CONSENT_AGE_LIMIT = ENV_TOKENS.get(
 # Allow extra middleware classes to be added to the app through configuration.
 MIDDLEWARE.extend(ENV_TOKENS.get('EXTRA_MIDDLEWARE_CLASSES', []))
 
-############### Settings for django-fernet-fields ##################
-VEDA_FERNET_KEYS = AUTH_TOKENS.get('VEDA_FERNET_KEYS', [])
-FERNET_KEYS = AUTH_TOKENS.get('FERNET_KEYS', FERNET_KEYS)
-FERNET_KEYS += VEDA_FERNET_KEYS
-
 ################# Settings for the maintenance banner #################
 MAINTENANCE_BANNER_TEXT = ENV_TOKENS.get('MAINTENANCE_BANNER_TEXT', None)
 
diff --git a/openedx/core/djangoapps/video_pipeline/config/waffle.py b/openedx/core/djangoapps/video_pipeline/config/waffle.py
index 43e26759f64..e0151e49c0b 100644
--- a/openedx/core/djangoapps/video_pipeline/config/waffle.py
+++ b/openedx/core/djangoapps/video_pipeline/config/waffle.py
@@ -11,7 +11,6 @@ WAFFLE_NAMESPACE = 'videos'
 # Waffle flag telling whether youtube is deprecated.
 DEPRECATE_YOUTUBE = 'deprecate_youtube'
 ENABLE_DEVSTACK_VIDEO_UPLOADS = 'enable_devstack_video_uploads'
-SAVE_CREDENTIALS_IN_VAL = 'save_credentials_in_val'
 
 
 def waffle_flags():
@@ -29,9 +28,4 @@ def waffle_flags():
             flag_name=ENABLE_DEVSTACK_VIDEO_UPLOADS,
             flag_undefined_default=False
         ),
-        SAVE_CREDENTIALS_IN_VAL: CourseWaffleFlag(
-            waffle_namespace=namespace,
-            flag_name=SAVE_CREDENTIALS_IN_VAL,
-            flag_undefined_default=False
-        )
     }
-- 
GitLab