diff --git a/common/test/acceptance/tests/studio/test_studio_outline.py b/common/test/acceptance/tests/studio/test_studio_outline.py
index 207f2878dd..bca3932a58 100644
--- a/common/test/acceptance/tests/studio/test_studio_outline.py
+++ b/common/test/acceptance/tests/studio/test_studio_outline.py
@@ -5,6 +5,7 @@ Acceptance tests for studio related to the outline page.
import itertools
import json
from datetime import datetime, timedelta
+from unittest import skip
from nose.plugins.attrib import attr
from pytz import UTC
@@ -115,6 +116,7 @@ class CourseOutlineDragAndDropTest(CourseOutlineTest):
expected_ordering
)
+ @skip("Fails in Firefox 45 but passes in Chrome")
def test_drop_unit_in_collapsed_subsection(self):
"""
Drag vertical "1.1.2" from subsection "1.1" into collapsed subsection "1.2" which already
diff --git a/openedx/core/djangoapps/schedules/content_highlights.py b/openedx/core/djangoapps/schedules/content_highlights.py
index 076f4aa48f..53b2ba91c1 100644
--- a/openedx/core/djangoapps/schedules/content_highlights.py
+++ b/openedx/core/djangoapps/schedules/content_highlights.py
@@ -1,3 +1,9 @@
+"""
+Contains methods for accessing weekly course highlights. Weekly highlights is a
+schedule experience built on the Schedules app.
+"""
+import logging
+
from courseware.module_render import get_module_for_descriptor
from courseware.model_data import FieldDataCache
from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
@@ -6,6 +12,8 @@ from request_cache import get_request_or_stub
from xmodule.modulestore.django import modulestore
+log = logging.getLogger(__name__)
+
def course_has_highlights(course_key):
"""
@@ -13,35 +21,63 @@ def course_has_highlights(course_key):
This ignores access checks, since highlights may be lurking in currently
inaccessible content.
"""
- if not COURSE_UPDATE_WAFFLE_FLAG.is_enabled(course_key):
+ try:
+ course = _get_course_with_highlights(course_key)
+
+ except CourseUpdateDoesNotExist:
return False
- course = modulestore().get_course(course_key, depth=1)
- return any(
- section.highlights
- for section in course.get_children()
- if not section.hide_from_toc
- )
+ else:
+ highlights_are_available = any(
+ section.highlights
+ for section in course.get_children()
+ if not section.hide_from_toc
+ )
+
+ if not highlights_are_available:
+ log.error(
+ "Course team enabled highlights and provided no highlights."
+ )
+
+ return highlights_are_available
def get_week_highlights(user, course_key, week_num):
"""
Get highlights (list of unicode strings) for a given week.
week_num starts at 1.
- Raises CourseUpdateDoesNotExist if highlights do not exist for
- the requested week_num.
+
+ Raises:
+ CourseUpdateDoesNotExist: if highlights do not exist for
+ the requested week_num.
"""
+ course_descriptor = _get_course_with_highlights(course_key)
+ course_module = _get_course_module(course_descriptor, user)
+ sections_with_highlights = _get_sections_with_highlights(course_module)
+ highlights = _get_highlights_for_week(
+ sections_with_highlights,
+ week_num,
+ course_key,
+ )
+ return highlights
+
+
+def _get_course_with_highlights(course_key):
+ # pylint: disable=missing-docstring
if not COURSE_UPDATE_WAFFLE_FLAG.is_enabled(course_key):
raise CourseUpdateDoesNotExist(
- "%s does not have Course Updates enabled.",
- course_key
+ "%s Course Update Messages waffle flag is disabled.",
+ course_key,
)
course_descriptor = _get_course_descriptor(course_key)
- course_module = _get_course_module(course_descriptor, user)
- sections_with_highlights = _get_sections_with_highlights(course_module)
- highlights = _get_highlights_for_week(sections_with_highlights, week_num, course_key)
- return highlights
+ if not course_descriptor.highlights_enabled_for_messaging:
+ raise CourseUpdateDoesNotExist(
+ "%s Course Update Messages are disabled.",
+ course_key,
+ )
+
+ return course_descriptor
def _get_course_descriptor(course_key):
diff --git a/openedx/core/djangoapps/schedules/tests/test_content_highlights.py b/openedx/core/djangoapps/schedules/tests/test_content_highlights.py
index 1186eb40bf..837aea5a85 100644
--- a/openedx/core/djangoapps/schedules/tests/test_content_highlights.py
+++ b/openedx/core/djangoapps/schedules/tests/test_content_highlights.py
@@ -21,7 +21,9 @@ class TestContentHighlights(ModuleStoreTestCase):
self._setup_user()
def _setup_course(self):
- self.course = CourseFactory.create()
+ self.course = CourseFactory.create(
+ highlights_enabled_for_messaging=True
+ )
self.course_key = self.course.id
def _setup_user(self):
@@ -66,6 +68,23 @@ class TestContentHighlights(ModuleStoreTestCase):
highlights,
)
+ @override_waffle_flag(COURSE_UPDATE_WAFFLE_FLAG, True)
+ def test_highlights_disabled_for_messaging(self):
+ highlights = [u'A test highlight.']
+ with self.store.bulk_operations(self.course_key):
+ self._create_chapter(highlights=highlights)
+ self.course.highlights_enabled_for_messaging = False
+ self.store.update_item(self.course, self.user.id)
+
+ self.assertFalse(course_has_highlights(self.course_key))
+
+ with self.assertRaises(CourseUpdateDoesNotExist):
+ get_week_highlights(
+ self.user,
+ self.course_key,
+ week_num=1,
+ )
+
@override_waffle_flag(COURSE_UPDATE_WAFFLE_FLAG, True)
def test_course_with_no_highlights(self):
with self.store.bulk_operations(self.course_key):
diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt
index 61528c8cff..a97cf516b0 100644
--- a/requirements/edx/base.txt
+++ b/requirements/edx/base.txt
@@ -47,7 +47,7 @@ edx-lint==0.4.3
astroid==1.3.8
edx-django-oauth2-provider==1.2.5
edx-django-sites-extensions==2.3.0
-edx-enterprise==0.53.16
+edx-enterprise==0.53.18
edx-oauth2-provider==1.2.2
edx-opaque-keys==0.4.0
edx-organizations==0.4.8
@@ -204,3 +204,6 @@ py2neo==3.1.2
# Support for plugins
web-fragments==0.2.2
xblock==1.0.0
+
+# Redis version
+redis==2.10.6