Merge pull request #11226 from edx/aj/ecom3384-course-image-breaking
Studio - Schedule & Details tab broken
This commit is contained in:
@@ -101,6 +101,9 @@ if STATIC_URL_BASE:
|
||||
STATIC_URL += "/"
|
||||
STATIC_URL += EDX_PLATFORM_REVISION + "/"
|
||||
|
||||
# DEFAULT_COURSE_ABOUT_IMAGE_URL specifies the default image to show for courses that don't provide one
|
||||
DEFAULT_COURSE_ABOUT_IMAGE_URL = ENV_TOKENS.get('DEFAULT_COURSE_ABOUT_IMAGE_URL', DEFAULT_COURSE_ABOUT_IMAGE_URL)
|
||||
|
||||
# GITHUB_REPO_ROOT is the base directory
|
||||
# for course data
|
||||
GITHUB_REPO_ROOT = ENV_TOKENS.get('GITHUB_REPO_ROOT', GITHUB_REPO_ROOT)
|
||||
|
||||
@@ -56,6 +56,7 @@ from lms.envs.common import (
|
||||
# The following setting is included as it is used to check whether to
|
||||
# display credit eligibility table on the CMS or not.
|
||||
ENABLE_CREDIT_ELIGIBILITY, YOUTUBE_API_KEY,
|
||||
DEFAULT_COURSE_ABOUT_IMAGE_URL,
|
||||
|
||||
# Django REST framework configuration
|
||||
REST_FRAMEWORK,
|
||||
|
||||
@@ -29,6 +29,7 @@ from nose.tools import raises
|
||||
from nose.plugins.attrib import attr
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from opaque_keys.edx.locator import UsageKey
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from courseware.models import StudentModule
|
||||
@@ -66,6 +67,7 @@ from certificates.tests.factories import GeneratedCertificateFactory
|
||||
from certificates.models import CertificateStatuses
|
||||
|
||||
from openedx.core.djangoapps.course_groups.cohorts import set_course_cohort_settings
|
||||
from openedx.core.lib.xblock_utils import grade_histogram
|
||||
|
||||
from .test_tools import msk_from_problem_urlname
|
||||
|
||||
@@ -3092,6 +3094,7 @@ class TestInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginEnrollmentTes
|
||||
|
||||
@attr('shard_1')
|
||||
@patch.dict(settings.FEATURES, {'ENTRANCE_EXAMS': True})
|
||||
@ddt.ddt
|
||||
class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
Test endpoints whereby instructors can rescore student grades,
|
||||
@@ -3160,6 +3163,29 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE
|
||||
)
|
||||
self.ee_modules = [ee_module_to_reset1.module_state_key, ee_module_to_reset2.module_state_key]
|
||||
|
||||
@ddt.data(ModuleStoreEnum.Type.split, ModuleStoreEnum.Type.mongo)
|
||||
def test_grade_histogram(self, store):
|
||||
"""
|
||||
Verify that a histogram has been created.
|
||||
"""
|
||||
course = CourseFactory.create(default_store=store)
|
||||
|
||||
usage_key = course.id.make_usage_key('problem', 'first_problem')
|
||||
StudentModule.objects.create(
|
||||
student_id=1,
|
||||
grade=100,
|
||||
module_state_key=usage_key
|
||||
)
|
||||
StudentModule.objects.create(
|
||||
student_id=2,
|
||||
grade=50,
|
||||
module_state_key=usage_key
|
||||
)
|
||||
|
||||
grades = grade_histogram(usage_key)
|
||||
self.assertEqual(grades[0], (50.0, 1))
|
||||
self.assertEqual(grades[1], (100.0, 1))
|
||||
|
||||
def test_reset_entrance_exam_student_attempts_deletall(self):
|
||||
""" Make sure no one can delete all students state on entrance exam. """
|
||||
url = reverse('reset_student_attempts_for_entrance_exam',
|
||||
|
||||
@@ -107,8 +107,7 @@ class PaginateSearchResultsTestCase(TestCase):
|
||||
id_range = get_object_range(page_number, page_size)
|
||||
db_objects = [build_mock_object(obj_id) for obj_id in id_range]
|
||||
self.mock_model.objects.filter = MagicMock(return_value=db_objects)
|
||||
|
||||
page = paginate_search_results(self.mock_model, self.search_results, self.default_size, 'last')
|
||||
page = paginate_search_results(self.mock_model, self.search_results, page_size, 'last')
|
||||
|
||||
self.mock_model.objects.filter.assert_called_with(pk__in=id_range)
|
||||
self.assertEquals(db_objects, page.object_list)
|
||||
|
||||
@@ -3,8 +3,9 @@ Tests for block_cache.py
|
||||
"""
|
||||
|
||||
from django.core.cache import get_cache
|
||||
from django.conf import settings
|
||||
from mock import patch
|
||||
from unittest import TestCase
|
||||
from unittest import TestCase, skipUnless
|
||||
|
||||
from ..block_cache import get_blocks
|
||||
from ..exceptions import TransformerException
|
||||
@@ -96,6 +97,7 @@ class TestBlockCache(TestCase, ChildrenMapTestMixin):
|
||||
transformers=self.transformers,
|
||||
)
|
||||
|
||||
@skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
def test_block_caching(self, mock_available_transforms):
|
||||
mock_available_transforms.return_value = {transformer.name(): transformer for transformer in self.transformers}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ Tests for functionality in openedx/core/lib/courses.py.
|
||||
"""
|
||||
|
||||
import ddt
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
@@ -48,12 +50,16 @@ class CourseImageTestCase(ModuleStoreTestCase):
|
||||
course_image_url(course)
|
||||
)
|
||||
|
||||
@override_settings(DEFAULT_COURSE_ABOUT_IMAGE_URL='test.png')
|
||||
@override_settings(STATIC_URL='static/')
|
||||
@ddt.data(ModuleStoreEnum.Type.split, ModuleStoreEnum.Type.mongo)
|
||||
def test_empty_image_name(self, default_store):
|
||||
""" Verify that empty image names are cleaned """
|
||||
course_image = u''
|
||||
course = CourseFactory.create(course_image=course_image, default_store=default_store)
|
||||
"""
|
||||
Verify that if a course has empty `course_image`, `course_image_url` returns
|
||||
`DEFAULT_COURSE_ABOUT_IMAGE_URL` defined in the settings.
|
||||
"""
|
||||
course = CourseFactory.create(course_image='', default_store=default_store)
|
||||
self.assertEquals(
|
||||
course_image,
|
||||
'static/test.png',
|
||||
course_image_url(course),
|
||||
)
|
||||
|
||||
@@ -173,28 +173,6 @@ class TestXblockUtils(SharedModuleStoreTestCase):
|
||||
self.assertIsInstance(test_replace, Fragment)
|
||||
self.assertEqual(test_replace.content, anchor_tag)
|
||||
|
||||
@ddt.data('course_mongo', 'course_split')
|
||||
def test_grade_histogram(self, course_id):
|
||||
"""
|
||||
Verify that a histogram has been created.
|
||||
"""
|
||||
course = getattr(self, course_id)
|
||||
usage_key = course.id.make_usage_key('problem', 'first_problem')
|
||||
StudentModule.objects.create(
|
||||
student_id=1,
|
||||
grade=100,
|
||||
module_state_key=usage_key
|
||||
)
|
||||
StudentModule.objects.create(
|
||||
student_id=2,
|
||||
grade=50,
|
||||
module_state_key=usage_key
|
||||
)
|
||||
|
||||
grades = grade_histogram(usage_key)
|
||||
self.assertEqual(grades[0], (50.0, 1))
|
||||
self.assertEqual(grades[1], (100.0, 1))
|
||||
|
||||
def test_sanitize_html_id(self):
|
||||
"""
|
||||
Verify that colons and dashes are replaced.
|
||||
|
||||
@@ -150,6 +150,7 @@ class SystemTestSuite(NoseTestSuite):
|
||||
" common/djangoapps/*"
|
||||
" openedx/core/djangoapps/*"
|
||||
" openedx/tests/*"
|
||||
" openedx/core/lib/*"
|
||||
)
|
||||
|
||||
if self.root in ('lms', 'cms'):
|
||||
|
||||
Reference in New Issue
Block a user