From e67975b275d05dbf8f7b71c9a644ed6c5f612f80 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Mon, 6 Jul 2015 12:56:15 -0700 Subject: [PATCH] Feature flag credit provider messaging on the dashboard. When the credit eligibility is disabled, skip the code that access the CreditProvider table. This will allow us to safely delete a column from the table in rc/2015-07-08. --- common/djangoapps/student/views.py | 5 ++++- openedx/core/djangoapps/credit/tests/test_api.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 1420aa5432..3514b56989 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -531,7 +531,10 @@ def dashboard(request): for course, __ in course_enrollment_pairs: enrolled_courses_dict[unicode(course.id)] = course - credit_messages = _create_credit_availability_message(enrolled_courses_dict, user) + if settings.FEATURES.get("ENABLE_CREDIT_ELIGIBILITY"): + credit_messages = _create_credit_availability_message(enrolled_courses_dict, user) + else: + credit_messages = {} course_optouts = Optout.objects.filter(user=user).values_list('course_id', flat=True) diff --git a/openedx/core/djangoapps/credit/tests/test_api.py b/openedx/core/djangoapps/credit/tests/test_api.py index 14b5b7acba..1defe94291 100644 --- a/openedx/core/djangoapps/credit/tests/test_api.py +++ b/openedx/core/djangoapps/credit/tests/test_api.py @@ -5,6 +5,8 @@ import unittest import datetime import ddt import pytz +from mock import patch + from django.test import TestCase from django.test.utils import override_settings from django.db import connection, transaction @@ -697,6 +699,7 @@ class CreditMessagesTests(ModuleStoreTestCase, CreditApiTestBase): request_status = api.get_credit_request_status(self.student.username, self.course.id) self.assertEqual(len(request_status), 0) + @patch.dict(settings.FEATURES, {"ENABLE_CREDIT_ELIGIBILITY": True}) def test_credit_messages(self): self._set_creditcourse()