From 407e7f432cf2f47b07e49b61dd90603cce9092aa Mon Sep 17 00:00:00 2001 From: Will Daly Date: Tue, 7 Jul 2015 12:10:25 -0700 Subject: [PATCH] Cherrypick hotfix-2015-07-07 into release candidate Includes the changes from 897fddba3e36011f6793040e5b1f296c6e399cbb. Those changes were introduced while resolving a merge conflict from release back into master. --- common/djangoapps/student/tests/test_credit.py | 2 ++ common/djangoapps/student/views.py | 4 ++++ openedx/core/djangoapps/credit/tests/test_api.py | 1 + 3 files changed, 7 insertions(+) diff --git a/common/djangoapps/student/tests/test_credit.py b/common/djangoapps/student/tests/test_credit.py index 0b2a226e88..4b8dc82115 100644 --- a/common/djangoapps/student/tests/test_credit.py +++ b/common/djangoapps/student/tests/test_credit.py @@ -5,6 +5,7 @@ import unittest import datetime import pytz +from mock import patch from django.conf import settings from django.core.urlresolvers import reverse @@ -26,6 +27,7 @@ TEST_CREDIT_PROVIDER_SECRET_KEY = "931433d583c84ca7ba41784bad3232e6" @override_settings(CREDIT_PROVIDER_SECRET_KEYS={ "hogwarts": TEST_CREDIT_PROVIDER_SECRET_KEY, }) +@patch.dict(settings.FEATURES, {"ENABLE_CREDIT_ELIGIBILITY": True}) class CreditCourseDashboardTest(ModuleStoreTestCase): """ Tests for credit courses on the student dashboard. diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 1e546c3806..b012d16cc1 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -799,6 +799,10 @@ def _credit_statuses(user, course_enrollment_pairs): """ from openedx.core.djangoapps.credit import api as credit_api + # Feature flag off + if not settings.FEATURES.get("ENABLE_CREDIT_ELIGIBILITY"): + return {} + request_status_by_course = { request["course_key"]: request["status"] for request in credit_api.get_credit_requests_for_user(user.username) diff --git a/openedx/core/djangoapps/credit/tests/test_api.py b/openedx/core/djangoapps/credit/tests/test_api.py index 45a2ac1fb4..38deef2f66 100644 --- a/openedx/core/djangoapps/credit/tests/test_api.py +++ b/openedx/core/djangoapps/credit/tests/test_api.py @@ -4,6 +4,7 @@ Tests for the API functions in the credit app. import datetime import ddt import pytz + from django.test import TestCase from django.test.utils import override_settings from django.db import connection, transaction