diff --git a/cms/djangoapps/contentstore/tests/test_course_create_rerun.py b/cms/djangoapps/contentstore/tests/test_course_create_rerun.py index a7c5df8bc7..4db95d3bed 100644 --- a/cms/djangoapps/contentstore/tests/test_course_create_rerun.py +++ b/cms/djangoapps/contentstore/tests/test_course_create_rerun.py @@ -1,11 +1,15 @@ """ Test view handler for rerun (and eventually create) """ +import ddt + from django.test.client import RequestFactory from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +from xmodule.modulestore import ModuleStoreEnum +from xmodule.modulestore.django import modulestore from student.roles import CourseInstructorRole, CourseStaffRole from student.tests.factories import UserFactory from contentstore.tests.utils import AjaxEnabledTestClient, parse_json @@ -13,6 +17,7 @@ from datetime import datetime from xmodule.course_module import CourseFields +@ddt.ddt class TestCourseListing(ModuleStoreTestCase): """ Unit tests for getting the list of courses for a logged in user @@ -64,3 +69,21 @@ class TestCourseListing(ModuleStoreTestCase): self.assertEqual(dest_course_key.run, 'copy') dest_course = self.store.get_course(dest_course_key) self.assertEqual(dest_course.start, CourseFields.start.default) + + @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) + def test_newly_created_course_has_web_certs_enabled(self, store): + """ + Tests newly created course has web certs enabled by default. + """ + with modulestore().default_store(store): + response = self.client.ajax_post('/course/', { + 'org': 'orgX', + 'number': 'CS101', + 'display_name': 'Course with web certs enabled', + 'run': '2015_T2' + }) + self.assertEqual(response.status_code, 200) + data = parse_json(response) + new_course_key = CourseKey.from_string(data['course_key']) + course = self.store.get_course(new_course_key) + self.assertTrue(course.cert_html_view_enabled) diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 6d4dba3649..80d65cc3ff 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -741,8 +741,11 @@ def create_new_course_in_store(store, user, org, number, run, fields): Separated out b/c command line course creation uses this as well as the web interface. """ - # Set default language from settings - fields.update({'language': getattr(settings, 'DEFAULT_COURSE_LANGUAGE', 'en')}) + # Set default language from settings and enable web certs + fields.update({ + 'language': getattr(settings, 'DEFAULT_COURSE_LANGUAGE', 'en'), + 'cert_html_view_enabled': True, + }) with modulestore().default_store(store): # Creating the course raises DuplicateCourseError if an existing course with this org/name is found