Commit 46150800 by Zia Fazal

Merge pull request #10737 from edx/ziafazal/SOL-1433

SOL-1433:remove audit course mode
parents 6e5e185b aa529fe0
...@@ -354,9 +354,11 @@ def certificates_list_handler(request, course_key_string): ...@@ -354,9 +354,11 @@ def certificates_list_handler(request, course_key_string):
handler_name='certificates.certificate_activation_handler', handler_name='certificates.certificate_activation_handler',
course_key=course_key course_key=course_key
) )
course_modes = [mode.slug for mode in CourseMode.modes_for_course( course_modes = [
course_id=course.id, include_expired=True mode.slug for mode in CourseMode.modes_for_course(
)] course_id=course.id, include_expired=True
) if mode.slug != 'audit'
]
certificate_web_view_url = get_lms_link_for_certificate_web_view( certificate_web_view_url = get_lms_link_for_certificate_web_view(
user_id=request.user.id, user_id=request.user.id,
course_key=course_key, course_key=course_key,
......
...@@ -22,6 +22,7 @@ from xmodule.exceptions import NotFoundError ...@@ -22,6 +22,7 @@ from xmodule.exceptions import NotFoundError
from student.models import CourseEnrollment from student.models import CourseEnrollment
from student.roles import CourseInstructorRole, CourseStaffRole from student.roles import CourseInstructorRole, CourseStaffRole
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from course_modes.tests.factories import CourseModeFactory
from contentstore.views.certificates import CertificateManager from contentstore.views.certificates import CertificateManager
from django.test.utils import override_settings from django.test.utils import override_settings
from contentstore.utils import get_lms_link_for_certificate_web_view from contentstore.utils import get_lms_link_for_certificate_web_view
...@@ -326,6 +327,19 @@ class CertificatesListHandlerTestCase(EventTestMixin, CourseTestCase, Certificat ...@@ -326,6 +327,19 @@ class CertificatesListHandlerTestCase(EventTestMixin, CourseTestCase, Certificat
self.assertEqual(response.status_code, 403) self.assertEqual(response.status_code, 403)
self.assertIn("error", response.content) self.assertIn("error", response.content)
def test_audit_course_mode_is_skipped(self):
"""
Tests audit course mode is skipped when rendering certificates page.
"""
CourseModeFactory.create(course_id=self.course.id)
CourseModeFactory.create(course_id=self.course.id, mode_slug='verified')
response = self.client.get_html(
self._url(),
)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'verified')
self.assertNotContains(response, 'audit')
def test_assign_unique_identifier_to_certificates(self): def test_assign_unique_identifier_to_certificates(self):
""" """
Test certificates have unique ids Test certificates have unique ids
......
...@@ -49,7 +49,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel ...@@ -49,7 +49,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
appendSetFixtures('<div class="preview-certificate nav-actions"></div>'); appendSetFixtures('<div class="preview-certificate nav-actions"></div>');
this.view = new CertificatePreview({ this.view = new CertificatePreview({
el: $('.preview-certificate'), el: $('.preview-certificate'),
course_modes: ['test1', 'test2', 'test3', 'audit'], course_modes: ['test1', 'test2', 'test3'],
certificate_web_view_url: '/users/1/courses/orgX/009/2016?preview=test1', certificate_web_view_url: '/users/1/courses/orgX/009/2016?preview=test1',
certificate_activation_handler_url: '/certificates/activation/'+ window.course.id, certificate_activation_handler_url: '/certificates/activation/'+ window.course.id,
is_active: true is_active: true
...@@ -58,11 +58,6 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel ...@@ -58,11 +58,6 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
}); });
describe('Certificate preview', function() { describe('Certificate preview', function() {
it('course mode "audit" should not be render in preview list', function () {
expect(this.view.course_modes.indexOf('audit') < 0).toBe(true);
});
it('course mode event should call when user choose a new mode', function () { it('course mode event should call when user choose a new mode', function () {
spyOn(this.view, 'courseModeChanged'); spyOn(this.view, 'courseModeChanged');
this.view.delegateEvents(); this.view.delegateEvents();
......
...@@ -27,8 +27,6 @@ function(_, gettext, BaseView, ViewUtils, NotificationView) { ...@@ -27,8 +27,6 @@ function(_, gettext, BaseView, ViewUtils, NotificationView) {
}, },
render: function () { render: function () {
// removing the course mode 'audit' from the preview list.
this.course_modes = _.without(this.course_modes, 'audit');
this.$el.html(this.template({ this.$el.html(this.template({
course_modes: this.course_modes, course_modes: this.course_modes,
certificate_web_view_url: this.certificate_web_view_url, certificate_web_view_url: this.certificate_web_view_url,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment