From 028dab150040396435018a4a8e25922223859331 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Thu, 14 Jul 2016 17:25:21 -0400 Subject: [PATCH 01/33] Update django-cas dependency to support Django 1.8 --- requirements/edx/github.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt index 3bc7b7cf4d..71b768f36e 100644 --- a/requirements/edx/github.txt +++ b/requirements/edx/github.txt @@ -53,7 +53,7 @@ git+https://github.com/edx/nltk.git@2.0.6#egg=nltk==2.0.6 -e git+https://github.com/appliedsec/pygeoip.git@95e69341cebf5a6a9fbf7c4f5439d458898bdc3b#egg=pygeoip -e git+https://github.com/jazkarta/edx-jsme.git@c5bfa5d361d6685d8c643838fc0055c25f8b7999#egg=edx-jsme git+https://github.com/edx/django-pyfs.git@1.0.3#egg=django-pyfs==1.0.3 -git+https://github.com/mitocw/django-cas.git@60a5b8e5a62e63e0d5d224a87f0b489201a0c695#egg=django-cas +git+https://github.com/mitodl/django-cas.git@v2.1.1#egg=django-cas -e git+https://github.com/dgrtwo/ParsePy.git@7949b9f754d1445eff8e8f20d0e967b9a6420639#egg=parse_rest # Master pyfs has a bug working with VPC auth. This is a fix. We should switch # back to master when and if this fix is merged back. From 0390294d3c977ff064dcb8f9f80ec13132f2d19a Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Tue, 5 Jul 2016 14:03:54 +0930 Subject: [PATCH 02/33] Uses http or https appropriately in bulk email urls and adds system tests for affected methods. --- lms/djangoapps/bulk_email/tasks.py | 23 +++-- lms/djangoapps/bulk_email/tests/test_email.py | 91 ++++++++++++++++++- lms/djangoapps/instructor_task/api.py | 2 +- .../instructor_task/tests/test_api.py | 21 ++++- 4 files changed, 124 insertions(+), 13 deletions(-) diff --git a/lms/djangoapps/bulk_email/tasks.py b/lms/djangoapps/bulk_email/tasks.py index ac5475d213..f7be9c2450 100644 --- a/lms/djangoapps/bulk_email/tasks.py +++ b/lms/djangoapps/bulk_email/tasks.py @@ -97,25 +97,31 @@ BULK_EMAIL_FAILURE_ERRORS = ( ) -def _get_course_email_context(course): +def _get_course_email_context(course, is_secure): """ Returns context arguments to apply to all emails, independent of recipient. + + Inputs are: + * `course`: Course related to the current email + * `is_secure`: Set to True to return https URLs, False to use http. """ course_id = course.id.to_deprecated_string() course_title = course.display_name course_end_date = get_default_time_display(course.end) - course_url = 'https://{}{}'.format( - settings.SITE_NAME, + scheme = u'https' if is_secure else u'http' + base_url = '{}://{}'.format(scheme, settings.SITE_NAME) + course_url = '{}{}'.format( + base_url, reverse('course_root', kwargs={'course_id': course_id}) ) - image_url = u'https://{}{}'.format(settings.SITE_NAME, course_image_url(course)) + image_url = u'{}{}'.format(base_url, course_image_url(course)) email_context = { 'course_title': course_title, 'course_url': course_url, 'course_image_url': image_url, 'course_end_date': course_end_date, - 'account_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('account_settings')), - 'email_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('dashboard')), + 'account_settings_url': '{}{}'.format(base_url, reverse('account_settings')), + 'email_settings_url': '{}{}'.format(base_url, reverse('dashboard')), 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), } return email_context @@ -170,9 +176,12 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name) # Fetch the course object. course = get_course(course_id) + # Emails use https URLs by default, to maintain backwards compatibility. + is_secure = task_input.get('is_secure', True) + # Get arguments that will be passed to every subtask. targets = email_obj.targets.all() - global_email_context = _get_course_email_context(course) + global_email_context = _get_course_email_context(course, is_secure) recipient_qsets = [ target.get_users(course_id, user_id) diff --git a/lms/djangoapps/bulk_email/tests/test_email.py b/lms/djangoapps/bulk_email/tests/test_email.py index 062da01ad9..be33e2b94f 100644 --- a/lms/djangoapps/bulk_email/tests/test_email.py +++ b/lms/djangoapps/bulk_email/tests/test_email.py @@ -3,24 +3,25 @@ Unit tests for sending course email """ import json +import ddt from markupsafe import escape from mock import patch, Mock from nose.plugins.attrib import attr import os from unittest import skipIf -from django.conf import settings from django.core import mail from django.core.mail.message import forbid_multi_line_headers from django.core.urlresolvers import reverse from django.core.management import call_command from django.test.utils import override_settings -from bulk_email.models import Optout, BulkEmailFlag -from bulk_email.tasks import _get_source_address +from bulk_email.models import Optout, BulkEmailFlag, CourseEmail, SEND_TO_MYSELF +from bulk_email.tasks import _get_source_address, _get_course_email_context, perform_delegate_email_batches from openedx.core.djangoapps.course_groups.models import CourseCohort from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort from courseware.tests.factories import StaffFactory, InstructorFactory +from instructor_task.models import InstructorTask from instructor_task.subtasks import update_subtask_status from student.roles import CourseStaffRole from student.models import CourseEnrollment @@ -476,3 +477,87 @@ class TestEmailSendFromDashboard(EmailSendFromDashboardTestCase): message_body = mail.outbox[0].body self.assertIn(uni_message, message_body) + + +@ddt.ddt +class TestCourseEmailContext(SharedModuleStoreTestCase): + """ + Test the course email context hash used to send bulk emails. + """ + + @classmethod + def setUpClass(cls): + """ + Create a course, InstructorTask, and CourseEmail shared by all tests. + """ + super(TestCourseEmailContext, cls).setUpClass() + cls.course_title = u"Финансовое программирование и политика, часть 1: макроэкономические счета и анализ" + cls.course_org = 'IMF' + cls.course_number = "FPP.1x" + cls.course_run = "2016" + cls.course = CourseFactory.create( + display_name=cls.course_title, + org=cls.course_org, + number=cls.course_number, + run=cls.course_run, + ) + cls.user = UserFactory() + cls.course_email = CourseEmail.create( + course_id=cls.course.id, + sender=cls.user, + targets=[SEND_TO_MYSELF], + subject='subject', + html_message='message', + ) + cls.email_task = InstructorTask.create( + course_id=cls.course.id, + task_type='bulk_course_email', + task_key='key', + task_input={}, + requester=cls.user, + ) + + @ddt.data( + (False, 'http'), + (True, 'https'), + ) + @ddt.unpack + def test_context_urls(self, is_secure, scheme): + """ + This test tests that the bulk email context uses http or https urls as appropriate. + """ + email_context = _get_course_email_context(self.course, is_secure) + self.assertEquals(email_context['platform_name'], 'edX') + self.assertEquals(email_context['course_title'], self.course_title) + self.assertEquals(email_context['course_url'], + '{}://edx.org/courses/{}/{}/{}/'.format(scheme, + self.course_org, + self.course_number, + self.course_run)) + self.assertEquals(email_context['course_image_url'], + '{}://edx.org/c4x/{}/{}/asset/images_course_image.jpg'.format(scheme, + self.course_org, + self.course_number)) + self.assertEquals(email_context['email_settings_url'], '{}://edx.org/dashboard'.format(scheme)) + self.assertEquals(email_context['account_settings_url'], '{}://edx.org/account/settings'.format(scheme)) + + @ddt.data( + None, + False, + True, + ) + @patch('bulk_email.tasks._get_course_email_context') + def test_task_input_is_secure(self, is_secure, get_course_email_context): + """ + Test the effect of different task_input hashes on perform_delegate_email_batches, + to ensure that the correct http or https URL schemes are used in generated emails. + """ + task_input = {'email_id': self.course_email.id} + if is_secure is not None: + task_input['is_secure'] = is_secure + else: + # https URLs used by default to maintain backwards compatibility + is_secure = True + + perform_delegate_email_batches(self.email_task.id, self.course.id, task_input, 'emailed') + get_course_email_context.assert_called_with(self.course, is_secure) diff --git a/lms/djangoapps/instructor_task/api.py b/lms/djangoapps/instructor_task/api.py index 6301b49bf0..6d1c8e6c8c 100644 --- a/lms/djangoapps/instructor_task/api.py +++ b/lms/djangoapps/instructor_task/api.py @@ -290,7 +290,7 @@ def submit_bulk_course_email(request, course_key, email_id): task_type = 'bulk_course_email' task_class = send_bulk_course_email - task_input = {'email_id': email_id, 'to_option': targets} + task_input = {'email_id': email_id, 'to_option': targets, 'is_secure': request.is_secure()} task_key_stub = str(email_id) # create the key value by using MD5 hash: task_key = hashlib.md5(task_key_stub).hexdigest() diff --git a/lms/djangoapps/instructor_task/tests/test_api.py b/lms/djangoapps/instructor_task/tests/test_api.py index 51ec2b5dff..84bc65ea63 100644 --- a/lms/djangoapps/instructor_task/tests/test_api.py +++ b/lms/djangoapps/instructor_task/tests/test_api.py @@ -1,7 +1,7 @@ """ Test for LMS instructor background task queue management """ -from mock import patch, Mock, MagicMock +from mock import patch, Mock, MagicMock, ANY from nose.plugins.attrib import attr from bulk_email.models import CourseEmail, SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS from courseware.tests.factories import UserFactory @@ -30,7 +30,7 @@ from instructor_task.api import ( from instructor_task.api_helper import AlreadyRunningError from instructor_task.models import InstructorTask, PROGRESS -from instructor_task.tasks import export_ora2_data +from instructor_task.tasks import export_ora2_data, send_bulk_course_email from instructor_task.tests.test_base import ( InstructorTaskTestCase, InstructorTaskCourseTestCase, @@ -221,6 +221,23 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa ) self._test_resubmission(api_call) + def test_submit_bulk_email_task_input(self): + """ + Tests the task_input hash created by submit_bulk_course_email. + """ + request = self.create_task_request(self.instructor) + email_id = self._define_course_email() + task_input = dict(email_id=email_id, + to_option=[SEND_TO_MYSELF, SEND_TO_LEARNERS, SEND_TO_STAFF], + is_secure=request.is_secure()) + + with patch('instructor_task.api.submit_task') as mock_submit_task: + mock_submit_task.return_value = MagicMock() + submit_bulk_course_email(request, self.course.id, email_id) + + mock_submit_task.assert_called_once_with( + request, 'bulk_course_email', send_bulk_course_email, self.course.id, task_input, ANY) + def test_submit_calculate_problem_responses(self): api_call = lambda: submit_calculate_problem_responses_csv( self.create_task_request(self.instructor), From f28cca00f33cd0f7f62d0228d7b59d9a1122024e Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Thu, 7 Jul 2016 11:20:41 +0930 Subject: [PATCH 03/33] Uses settings.HTTPS to determine appropriate URL scheme for bulk emails --- lms/djangoapps/bulk_email/tasks.py | 13 +--- lms/djangoapps/bulk_email/tests/test_email.py | 61 +++++-------------- lms/djangoapps/instructor_task/api.py | 2 +- .../instructor_task/tests/test_api.py | 21 +------ 4 files changed, 22 insertions(+), 75 deletions(-) diff --git a/lms/djangoapps/bulk_email/tasks.py b/lms/djangoapps/bulk_email/tasks.py index f7be9c2450..ace9f1a3b5 100644 --- a/lms/djangoapps/bulk_email/tasks.py +++ b/lms/djangoapps/bulk_email/tasks.py @@ -97,18 +97,14 @@ BULK_EMAIL_FAILURE_ERRORS = ( ) -def _get_course_email_context(course, is_secure): +def _get_course_email_context(course): """ Returns context arguments to apply to all emails, independent of recipient. - - Inputs are: - * `course`: Course related to the current email - * `is_secure`: Set to True to return https URLs, False to use http. """ course_id = course.id.to_deprecated_string() course_title = course.display_name course_end_date = get_default_time_display(course.end) - scheme = u'https' if is_secure else u'http' + scheme = u'https' if settings.HTTPS == "on" else u'http' base_url = '{}://{}'.format(scheme, settings.SITE_NAME) course_url = '{}{}'.format( base_url, @@ -176,12 +172,9 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name) # Fetch the course object. course = get_course(course_id) - # Emails use https URLs by default, to maintain backwards compatibility. - is_secure = task_input.get('is_secure', True) - # Get arguments that will be passed to every subtask. targets = email_obj.targets.all() - global_email_context = _get_course_email_context(course, is_secure) + global_email_context = _get_course_email_context(course) recipient_qsets = [ target.get_users(course_id, user_id) diff --git a/lms/djangoapps/bulk_email/tests/test_email.py b/lms/djangoapps/bulk_email/tests/test_email.py index be33e2b94f..2835a6959d 100644 --- a/lms/djangoapps/bulk_email/tests/test_email.py +++ b/lms/djangoapps/bulk_email/tests/test_email.py @@ -3,7 +3,6 @@ Unit tests for sending course email """ import json -import ddt from markupsafe import escape from mock import patch, Mock from nose.plugins.attrib import attr @@ -16,12 +15,11 @@ from django.core.urlresolvers import reverse from django.core.management import call_command from django.test.utils import override_settings -from bulk_email.models import Optout, BulkEmailFlag, CourseEmail, SEND_TO_MYSELF -from bulk_email.tasks import _get_source_address, _get_course_email_context, perform_delegate_email_batches +from bulk_email.models import Optout, BulkEmailFlag +from bulk_email.tasks import _get_source_address, _get_course_email_context from openedx.core.djangoapps.course_groups.models import CourseCohort from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort from courseware.tests.factories import StaffFactory, InstructorFactory -from instructor_task.models import InstructorTask from instructor_task.subtasks import update_subtask_status from student.roles import CourseStaffRole from student.models import CourseEnrollment @@ -479,7 +477,6 @@ class TestEmailSendFromDashboard(EmailSendFromDashboardTestCase): self.assertIn(uni_message, message_body) -@ddt.ddt class TestCourseEmailContext(SharedModuleStoreTestCase): """ Test the course email context hash used to send bulk emails. @@ -488,7 +485,7 @@ class TestCourseEmailContext(SharedModuleStoreTestCase): @classmethod def setUpClass(cls): """ - Create a course, InstructorTask, and CourseEmail shared by all tests. + Create a course shared by all tests. """ super(TestCourseEmailContext, cls).setUpClass() cls.course_title = u"Финансовое программирование и политика, часть 1: макроэкономические счета и анализ" @@ -501,32 +498,11 @@ class TestCourseEmailContext(SharedModuleStoreTestCase): number=cls.course_number, run=cls.course_run, ) - cls.user = UserFactory() - cls.course_email = CourseEmail.create( - course_id=cls.course.id, - sender=cls.user, - targets=[SEND_TO_MYSELF], - subject='subject', - html_message='message', - ) - cls.email_task = InstructorTask.create( - course_id=cls.course.id, - task_type='bulk_course_email', - task_key='key', - task_input={}, - requester=cls.user, - ) - @ddt.data( - (False, 'http'), - (True, 'https'), - ) - @ddt.unpack - def test_context_urls(self, is_secure, scheme): + def verify_email_context(self, email_context, scheme): """ This test tests that the bulk email context uses http or https urls as appropriate. """ - email_context = _get_course_email_context(self.course, is_secure) self.assertEquals(email_context['platform_name'], 'edX') self.assertEquals(email_context['course_title'], self.course_title) self.assertEquals(email_context['course_url'], @@ -541,23 +517,18 @@ class TestCourseEmailContext(SharedModuleStoreTestCase): self.assertEquals(email_context['email_settings_url'], '{}://edx.org/dashboard'.format(scheme)) self.assertEquals(email_context['account_settings_url'], '{}://edx.org/account/settings'.format(scheme)) - @ddt.data( - None, - False, - True, - ) - @patch('bulk_email.tasks._get_course_email_context') - def test_task_input_is_secure(self, is_secure, get_course_email_context): + @override_settings(HTTPS="off") + def test_insecure_email_context(self): """ - Test the effect of different task_input hashes on perform_delegate_email_batches, - to ensure that the correct http or https URL schemes are used in generated emails. + This test tests that the bulk email context uses http urls """ - task_input = {'email_id': self.course_email.id} - if is_secure is not None: - task_input['is_secure'] = is_secure - else: - # https URLs used by default to maintain backwards compatibility - is_secure = True + email_context = _get_course_email_context(self.course) + self.verify_email_context(email_context, 'http') - perform_delegate_email_batches(self.email_task.id, self.course.id, task_input, 'emailed') - get_course_email_context.assert_called_with(self.course, is_secure) + @override_settings(HTTPS="on") + def test_secure_email_context(self): + """ + This test tests that the bulk email context uses https urls + """ + email_context = _get_course_email_context(self.course) + self.verify_email_context(email_context, 'https') diff --git a/lms/djangoapps/instructor_task/api.py b/lms/djangoapps/instructor_task/api.py index 6d1c8e6c8c..6301b49bf0 100644 --- a/lms/djangoapps/instructor_task/api.py +++ b/lms/djangoapps/instructor_task/api.py @@ -290,7 +290,7 @@ def submit_bulk_course_email(request, course_key, email_id): task_type = 'bulk_course_email' task_class = send_bulk_course_email - task_input = {'email_id': email_id, 'to_option': targets, 'is_secure': request.is_secure()} + task_input = {'email_id': email_id, 'to_option': targets} task_key_stub = str(email_id) # create the key value by using MD5 hash: task_key = hashlib.md5(task_key_stub).hexdigest() diff --git a/lms/djangoapps/instructor_task/tests/test_api.py b/lms/djangoapps/instructor_task/tests/test_api.py index 84bc65ea63..51ec2b5dff 100644 --- a/lms/djangoapps/instructor_task/tests/test_api.py +++ b/lms/djangoapps/instructor_task/tests/test_api.py @@ -1,7 +1,7 @@ """ Test for LMS instructor background task queue management """ -from mock import patch, Mock, MagicMock, ANY +from mock import patch, Mock, MagicMock from nose.plugins.attrib import attr from bulk_email.models import CourseEmail, SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS from courseware.tests.factories import UserFactory @@ -30,7 +30,7 @@ from instructor_task.api import ( from instructor_task.api_helper import AlreadyRunningError from instructor_task.models import InstructorTask, PROGRESS -from instructor_task.tasks import export_ora2_data, send_bulk_course_email +from instructor_task.tasks import export_ora2_data from instructor_task.tests.test_base import ( InstructorTaskTestCase, InstructorTaskCourseTestCase, @@ -221,23 +221,6 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa ) self._test_resubmission(api_call) - def test_submit_bulk_email_task_input(self): - """ - Tests the task_input hash created by submit_bulk_course_email. - """ - request = self.create_task_request(self.instructor) - email_id = self._define_course_email() - task_input = dict(email_id=email_id, - to_option=[SEND_TO_MYSELF, SEND_TO_LEARNERS, SEND_TO_STAFF], - is_secure=request.is_secure()) - - with patch('instructor_task.api.submit_task') as mock_submit_task: - mock_submit_task.return_value = MagicMock() - submit_bulk_course_email(request, self.course.id, email_id) - - mock_submit_task.assert_called_once_with( - request, 'bulk_course_email', send_bulk_course_email, self.course.id, task_input, ANY) - def test_submit_calculate_problem_responses(self): api_call = lambda: submit_calculate_problem_responses_csv( self.create_task_request(self.instructor), From cf8e0e44648774a6e8fa8031e0b16dc17ff5f847 Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Tue, 2 Aug 2016 04:05:23 +0930 Subject: [PATCH 04/33] Uses new settings.LMS_ROOT_URL as email base url instead of constructing it from settings.HTTPS and settings.SITE_NAME --- lms/djangoapps/bulk_email/tasks.py | 10 ++++------ lms/djangoapps/bulk_email/tests/test_email.py | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lms/djangoapps/bulk_email/tasks.py b/lms/djangoapps/bulk_email/tasks.py index ace9f1a3b5..dbb140723b 100644 --- a/lms/djangoapps/bulk_email/tasks.py +++ b/lms/djangoapps/bulk_email/tasks.py @@ -104,20 +104,18 @@ def _get_course_email_context(course): course_id = course.id.to_deprecated_string() course_title = course.display_name course_end_date = get_default_time_display(course.end) - scheme = u'https' if settings.HTTPS == "on" else u'http' - base_url = '{}://{}'.format(scheme, settings.SITE_NAME) course_url = '{}{}'.format( - base_url, + settings.LMS_ROOT_URL, reverse('course_root', kwargs={'course_id': course_id}) ) - image_url = u'{}{}'.format(base_url, course_image_url(course)) + image_url = u'{}{}'.format(settings.LMS_ROOT_URL, course_image_url(course)) email_context = { 'course_title': course_title, 'course_url': course_url, 'course_image_url': image_url, 'course_end_date': course_end_date, - 'account_settings_url': '{}{}'.format(base_url, reverse('account_settings')), - 'email_settings_url': '{}{}'.format(base_url, reverse('dashboard')), + 'account_settings_url': '{}{}'.format(settings.LMS_ROOT_URL, reverse('account_settings')), + 'email_settings_url': '{}{}'.format(settings.LMS_ROOT_URL, reverse('dashboard')), 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), } return email_context diff --git a/lms/djangoapps/bulk_email/tests/test_email.py b/lms/djangoapps/bulk_email/tests/test_email.py index 2835a6959d..9d01324e24 100644 --- a/lms/djangoapps/bulk_email/tests/test_email.py +++ b/lms/djangoapps/bulk_email/tests/test_email.py @@ -517,7 +517,7 @@ class TestCourseEmailContext(SharedModuleStoreTestCase): self.assertEquals(email_context['email_settings_url'], '{}://edx.org/dashboard'.format(scheme)) self.assertEquals(email_context['account_settings_url'], '{}://edx.org/account/settings'.format(scheme)) - @override_settings(HTTPS="off") + @override_settings(LMS_ROOT_URL="http://edx.org") def test_insecure_email_context(self): """ This test tests that the bulk email context uses http urls @@ -525,7 +525,7 @@ class TestCourseEmailContext(SharedModuleStoreTestCase): email_context = _get_course_email_context(self.course) self.verify_email_context(email_context, 'http') - @override_settings(HTTPS="on") + @override_settings(LMS_ROOT_URL="https://edx.org") def test_secure_email_context(self): """ This test tests that the bulk email context uses https urls From aaef18ecd721f1ecd9aa3d095ec1b842284421a2 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 5 Aug 2016 10:42:40 -0400 Subject: [PATCH 05/33] Remove obsolete scripts --- scripts/create-dev-env.sh | 528 ---------------------------------- scripts/install-system-req.sh | 101 ------- 2 files changed, 629 deletions(-) delete mode 100755 scripts/create-dev-env.sh delete mode 100755 scripts/install-system-req.sh diff --git a/scripts/create-dev-env.sh b/scripts/create-dev-env.sh deleted file mode 100755 index 75b32feacc..0000000000 --- a/scripts/create-dev-env.sh +++ /dev/null @@ -1,528 +0,0 @@ -#!/usr/bin/env bash - -#Exit if any commands return a non-zero status -set -e - -# posix compliant sanity check -if [ -z $BASH ] || [ $BASH = "/bin/sh" ]; then - echo "Please use the bash interpreter to run this script" - exit 1 -fi - -trap "ouch" ERR - -ouch() { - printf '\E[31m' - - cat</dev/null) 2>/dev/null) || - echo -n "" - - if [[ "x$this_repo" = "xedx-platform.git" ]]; then - # We are in the edx repo and already have git installed. Let git do the - # work of finding base dir: - echo "$(dirname $(git rev-parse --show-toplevel))" - else - echo "$HOME/edx_all" - fi -} - - -### START - -PROG=${0##*/} - -# Adjust this to wherever you'd like to place the codebase -BASE="${PROJECT_HOME:-$(set_base_default)}" - -# Use a sensible default (~/.virtualenvs) for your Python virtualenvs -# unless you've already got one set up with virtualenvwrapper. -PYTHON_DIR=${WORKON_HOME:-"$HOME/.virtualenvs"} - -# Find rbenv root (~/.rbenv by default) -if [ -z "${RBENV_ROOT}" ]; then - RBENV_ROOT="${HOME}/.rbenv" -else - RBENV_ROOT="${RBENV_ROOT%/}" -fi -# Let the repo override the version of Ruby to install -if [[ -r $BASE/edx-platform/.ruby-version ]]; then - RUBY_VER=`cat $BASE/edx-platform/.ruby-version` -fi - -LOG="/var/tmp/install-$(date +%Y%m%d-%H%M%S).log" - -# Make sure the user's not about to do anything dumb -if [[ $EUID -eq 0 ]]; then - error "This script should not be run using sudo or as the root user" - usage - exit 1 -fi - -# If in an existing virtualenv, bail -if [[ "x$VIRTUAL_ENV" != "x" ]]; then - envname=`basename $VIRTUAL_ENV` - error "Looks like you're already in the \"$envname\" virtual env." - error "Run \`deactivate\` and then re-run this script." - usage - exit 1 -fi - -# Read arguments -ARGS=$(getopt "cvhsynq" "$*") -if [[ $? != 0 ]]; then - usage - exit 1 -fi -eval set -- "$ARGS" -while true; do - case $1 in - -c) - compile=true - shift - ;; - -s) - systempkgs=true - shift - ;; - -v) - set -x - verbose=true - shift - ;; - -y) - noninteractive=true - shift - ;; - -q) - quiet=true - shift - ;; - -n) - nopull=true - shift - ;; - -h) - usage - exit 0 - ;; - --) - shift - break - ;; - esac -done - -if [[ ! $quiet ]]; then - cat< >(tee $LOG) -exec 2>&1 - - -# Install basic system requirements - -mkdir -p $BASE -case `uname -s` in - [Ll]inux) - command -v lsb_release &>/dev/null || { - error "Please install lsb-release." - exit 1 - } - - distro=`lsb_release -cs` - case $distro in - wheezy|jessie|maya|olivia|nadia|precise|quantal) - if [[ ! $noninteractive ]]; then - warning " - Debian support is not fully debugged. Assuming you have standard - development packages already working like scipy, the - installation should go fine, but this is still a work in progress. - - Please report issues you have and let us know if you are able to figure - out any workarounds or solutions - - Press return to continue or control-C to abort" - - read dummy - fi - sudo apt-get install -yq git ;; - squeeze|lisa|katya|oneiric|natty|raring) - if [[ ! $noninteractive ]]; then - warning " - It seems like you're using $distro which has been deprecated. - While we don't technically support this release, the install - script will probably still work. - - Press return to continue or control-C to abort" - read dummy - fi - sudo apt-get install -yq git - ;; - - *) - error "Unsupported distribution - $distro" - exit 1 - ;; - esac - ;; - - Darwin) - if [[ ! -w /usr/local ]]; then - cat</dev/null || { - output "Installing brew" - /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" - } - command -v git &>/dev/null || { - output "Installing git" - brew install git - } - - ;; - *) - error "Unsupported platform. Try switching to either Mac or a Debian-based linux distribution (Ubuntu, Debian, or Mint)" - exit 1 - ;; -esac - - -# Clone edx repositories - -clone_repos - -# Sanity check to make sure the repo layout hasn't changed -if [[ -d $BASE/edx-platform/scripts ]]; then - output "Installing system-level dependencies" - bash $BASE/edx-platform/scripts/install-system-req.sh -else - error "It appears that our directory structure has changed and somebody failed to update this script. - raise an issue on Github and someone should fix it." - exit 1 -fi - -# Install system-level dependencies -if [[ ! -d $RBENV_ROOT ]]; then - output "Installing rbenv" - git clone https://github.com/sstephenson/rbenv.git $RBENV_ROOT -fi -if [[ ! -d $RBENV_ROOT/plugins/ruby-build ]]; then - output "Installing ruby-build" - git clone https://github.com/sstephenson/ruby-build.git $RBENV_ROOT/plugins/ruby-build -fi -shelltype=$(basename $SHELL) -if ! hash rbenv 2>/dev/null; then - output "Adding rbenv to \$PATH in ~/.${shelltype}rc" - echo "export PATH=\"$RBENV_ROOT/bin:\$PATH\"" >> $HOME/.${shelltype}rc - echo 'eval "$(rbenv init -)"' >> $HOME/.${shelltype}rc - export PATH="$RBENV_ROOT/bin:$PATH" - eval "$(rbenv init -)" -fi - -if [[ ! -d $RBENV_ROOT/versions/$RUBY_VER ]]; then - output "Installing Ruby $RUBY_VER" - rbenv install $RUBY_VER - rbenv global $RUBY_VER -fi - -if ! hash bundle 2>/dev/null; then - output "Installing gem bundler" - gem install bundler -fi -rbenv rehash - -output "Installing ruby packages" -bundle install --gemfile $BASE/edx-platform/Gemfile - -# Install Python virtualenv -output "Installing python virtualenv" - -case `uname -s` in - Darwin) - # Add brew's path - PATH=/usr/local/share/python:/usr/local/bin:$PATH - ;; -esac - -# virtualenvwrapper uses the $WORKON_HOME env var to determine where to place -# virtualenv directories. Make sure it matches the selected $PYTHON_DIR. -export WORKON_HOME=$PYTHON_DIR - -# Load in the mkvirtualenv function if needed -if [[ `type -t mkvirtualenv` != "function" ]]; then - case `uname -s` in - Darwin) - VEWRAPPER=`which virtualenvwrapper.sh` - ;; - - [Ll]inux) - if [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then - VEWRAPPER=/etc/bash_completion.d/virtualenvwrapper - else - error "Could not find virtualenvwrapper" - exit 1 - fi - ;; - esac -fi - -source $VEWRAPPER -# Create edX virtualenv and link it to repo -# virtualenvwrapper automatically sources the activation script -if [[ $systempkgs ]]; then - mkvirtualenv -q -a "$WORKON_HOME" --system-site-packages edx-platform || { - error "mkvirtualenv exited with a non-zero error" - return 1 - } -else - # default behavior for virtualenv>1.7 is - # --no-site-packages - mkvirtualenv -q -a "$WORKON_HOME" edx-platform || { - error "mkvirtualenv exited with a non-zero error" - return 1 - } -fi - - -# compile numpy and scipy if requested - -NUMPY_VER="1.6.2" -SCIPY_VER="0.10.1" - -if [[ -n $compile ]]; then - output "Downloading numpy and scipy" - curl -sSL -o numpy.tar.gz http://downloads.sourceforge.net/project/numpy/NumPy/${NUMPY_VER}/numpy-${NUMPY_VER}.tar.gz - curl -sSL -o scipy.tar.gz http://downloads.sourceforge.net/project/scipy/scipy/${SCIPY_VER}/scipy-${SCIPY_VER}.tar.gz - tar xf numpy.tar.gz - tar xf scipy.tar.gz - rm -f numpy.tar.gz scipy.tar.gz - output "Compiling numpy" - cd "$BASE/numpy-${NUMPY_VER}" - python setup.py install - output "Compiling scipy" - cd "$BASE/scipy-${SCIPY_VER}" - python setup.py install - cd "$BASE" - rm -rf numpy-${NUMPY_VER} scipy-${SCIPY_VER} -fi - -case `uname -s` in - Darwin) - # on mac os x get the latest distribute and pip - pip install -U pip - # need latest pytz before compiling numpy and scipy - pip install -U pytz - pip install numpy - # scipy needs cython - pip install cython - # fixes problem with scipy on 10.8 - pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev - ;; -esac - -output "Installing edX pre-requirements" -pip install -r $BASE/edx-platform/requirements/edx/pre.txt - -output "Installing edX paver-requirements" -pip install -r $BASE/edx-platform/requirements/edx/paver.txt - - -output "Installing edX requirements" -# Install prereqs -cd $BASE/edx-platform -paver install_prereqs - -# Final dependecy -output "Finishing Touches" -cd $BASE -pip install argcomplete -cd $BASE/edx-platform -bundle install -paver install_prereqs - -mkdir -p "$BASE/log" -mkdir -p "$BASE/db" -mkdir -p "$BASE/data" - -./manage.py lms syncdb --noinput --migrate -./manage.py cms syncdb --noinput --migrate - -# Configure Git - -output "Fixing your git default settings" -git config --global push.default current - - -### DONE - -if [[ ! $quiet ]]; then - cat< - - $ ./manage.py lms runserver - - If the Django development server starts properly you - should see: - - Development server is running at http://127.0.0.1:/ - Quit the server with CONTROL-C. - - Connect your browser to http://127.0.0.1: to - view the Django site. - - -END -fi - -exit 0 diff --git a/scripts/install-system-req.sh b/scripts/install-system-req.sh deleted file mode 100755 index b4e5bb04e8..0000000000 --- a/scripts/install-system-req.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash - -# posix compliant sanity check -if [ -z $BASH ] || [ $BASH = "/bin/sh" ]; then - echo "Please use the bash interpreter to run this script" - exit 1 -fi - -error() { - printf '\E[31m'; echo "$@"; printf '\E[0m' -} -output() { - printf '\E[36m'; echo "$@"; printf '\E[0m' -} - - -### START - -SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -REQUIREMENTS_DIR="$SELF_DIR/../requirements/system" -APT_REPOS_FILE=$REQUIREMENTS_DIR/"ubuntu/apt-repos.txt" -APT_PKGS_FILE=$REQUIREMENTS_DIR/"ubuntu/apt-packages.txt" - -case `uname -s` in - [Ll]inux) - command -v lsb_release &>/dev/null || { - error "Please install lsb-release." - exit 1 - } - - distro=`lsb_release -cs` - case $distro in - #Tries to install the same - squeeze|wheezy|jessie|maya|lisa|olivia|nadia|natty|oneiric|precise|quantal|raring) - output "Installing Debian family requirements" - - # add repositories - cat $APT_REPOS_FILE | xargs -n 1 sudo add-apt-repository -y - sudo apt-get -yq update - sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install gfortran graphviz \ - libgraphviz-dev graphviz-dev libatlas-dev libblas-dev - # install packages listed in APT_PKGS_FILE - cat $APT_PKGS_FILE | xargs sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install - ;; - *) - error "Unsupported distribution - $distro" - exit 1 - ;; - esac - ;; - Darwin) - - if [[ ! -w /usr/local ]]; then - cat</dev/null || { - output "Installing pip" - easy_install pip - } - - if ! grep -Eq ^1.7 <(virtualenv --version 2>/dev/null); then - output "Installing virtualenv >1.7" - pip install 'virtualenv>1.7' virtualenvwrapper - fi - - command -v coffee &>/dev/null || { - output "Installing coffee script" - curl --insecure https://npmjs.org/install.sh | sh - npm install -g coffee-script - } - ;; - *) - error "Unsupported platform" - exit 1 - ;; -esac From 46b94ec6be9d157ebb962e90cb9dfb143e4c1134 Mon Sep 17 00:00:00 2001 From: alisan617 Date: Wed, 3 Aug 2016 10:59:36 -0400 Subject: [PATCH 06/33] remove dropdown menu class that has pseudo border that double arrows --- cms/templates/widgets/user_dropdown.html | 2 +- lms/templates/user_dropdown.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/templates/widgets/user_dropdown.html b/cms/templates/widgets/user_dropdown.html index bebc2e21d0..f1ae8ee0c4 100644 --- a/cms/templates/widgets/user_dropdown.html +++ b/cms/templates/widgets/user_dropdown.html @@ -12,7 +12,7 @@ ${_("Currently signed in as:")} - From 1182ae6c5486d356111c44306129ca713f6e2df2 Mon Sep 17 00:00:00 2001 From: Brian Beggs Date: Tue, 2 Aug 2016 18:06:22 -0400 Subject: [PATCH 07/33] Adding edx-django-release-util to LMS and CMS --- cms/envs/common.py | 3 +++ lms/envs/common.py | 3 +++ requirements/edx/base.txt | 3 +++ 3 files changed, 9 insertions(+) diff --git a/cms/envs/common.py b/cms/envs/common.py index 09b8f2648b..bc648be115 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -933,6 +933,9 @@ INSTALLED_APPS = ( # Enables default site and redirects 'django_sites_extensions', + + # additional release utilities to ease automation + 'release_util' ) diff --git a/lms/envs/common.py b/lms/envs/common.py index 6ad6d8934a..4f971bece1 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2078,6 +2078,9 @@ INSTALLED_APPS = ( # Email marketing integration 'email_marketing', + + # additional release utilities to ease automation + 'release_util', ) # Migrations which are not in the standard module "migrations" diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index cb79d955e5..a21cf677f8 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -183,3 +183,6 @@ pynliner==0.5.2 # for sailthru integration sailthru-client==2.2.3 + +# Release utils for the edx release pipeline +edx-django-release-util==0.0.4 \ No newline at end of file From ae8bc20b363475ae9ba79c5857db6f9561cd5f80 Mon Sep 17 00:00:00 2001 From: Brian Jacobel Date: Fri, 5 Aug 2016 12:30:32 -0400 Subject: [PATCH 08/33] Run eslint autofixer on /lms --- .../static/support/js/certificates_factory.js | 6 +- .../support/js/collections/certificate.js | 4 +- .../support/js/collections/enrollment.js | 4 +- .../static/support/js/enrollment_factory.js | 6 +- .../static/support/js/models/certificate.js | 4 +- .../static/support/js/models/enrollment.js | 8 +- .../js/spec/collections/enrollment_spec.js | 10 +- .../support/js/spec/models/enrollment_spec.js | 12 +- .../js/spec/views/certificates_spec.js | 145 ++- .../js/spec/views/enrollment_modal_spec.js | 31 +- .../support/js/spec/views/enrollment_spec.js | 18 +- .../js/spec_helpers/enrollment_helpers.js | 34 +- .../static/support/js/views/certificates.js | 13 +- .../static/support/js/views/enrollment.js | 20 +- .../support/js/views/enrollment_modal.js | 24 +- .../teams/static/teams/js/collections/base.js | 12 +- .../static/teams/js/collections/my_teams.js | 10 +- .../teams/static/teams/js/collections/team.js | 16 +- .../static/teams/js/collections/topic.js | 6 +- .../teams/static/teams/js/models/team.js | 4 +- .../static/teams/js/models/team_membership.js | 6 +- .../teams/static/teams/js/models/topic.js | 4 +- .../spec/collections/topic_collection_spec.js | 18 +- .../teams/js/spec/teams_tab_factory_spec.js | 2 +- .../js/spec/views/edit_team_members_spec.js | 44 +- .../teams/js/spec/views/edit_team_spec.js | 51 +- .../js/spec/views/instructor_tools_spec.js | 28 +- .../teams/js/spec/views/my_teams_spec.js | 22 +- .../teams/js/spec/views/team_card_spec.js | 48 +- .../js/spec/views/team_discussion_spec.js | 24 +- .../views/team_profile_header_actions_spec.js | 51 +- .../teams/js/spec/views/team_profile_spec.js | 29 +- .../static/teams/js/spec/views/teams_spec.js | 8 +- .../teams/js/spec/views/teams_tab_spec.js | 28 +- .../teams/js/spec/views/topic_card_spec.js | 11 +- .../teams/js/spec/views/topic_teams_spec.js | 24 +- .../static/teams/js/spec/views/topics_spec.js | 14 +- .../js/spec_helpers/team_spec_helpers.js | 112 +- .../static/teams/js/teams_tab_factory.js | 8 +- .../static/teams/js/utils/team_analytics.js | 6 +- .../teams/static/teams/js/views/edit_team.js | 32 +- .../teams/js/views/edit_team_members.js | 20 +- .../static/teams/js/views/instructor_tools.js | 16 +- .../teams/static/teams/js/views/my_teams.js | 4 +- .../teams/static/teams/js/views/team_card.js | 34 +- .../static/teams/js/views/team_discussion.js | 10 +- .../static/teams/js/views/team_profile.js | 44 +- .../js/views/team_profile_header_actions.js | 34 +- .../teams/static/teams/js/views/team_utils.js | 25 +- .../teams/static/teams/js/views/teams.js | 6 +- .../teams/static/teams/js/views/teams_tab.js | 94 +- .../teams/js/views/teams_tabbed_view.js | 6 +- .../teams/static/teams/js/views/topic_card.js | 24 +- .../static/teams/js/views/topic_teams.js | 124 +- .../teams/static/teams/js/views/topics.js | 8 +- lms/static/js/Markdown.Converter.js | 348 +++--- lms/static/js/Markdown.Editor.js | 1087 ++++++++--------- lms/static/js/Markdown.Sanitizer.js | 51 +- lms/static/js/ajax-error.js | 10 +- .../js/api_admin/catalog_preview_factory.js | 8 +- .../js/api_admin/views/catalog_preview.js | 24 +- .../js/bookmarks/collections/bookmarks.js | 35 +- lms/static/js/bookmarks/models/bookmark.js | 8 +- .../js/bookmarks/views/bookmark_button.js | 195 ++- .../js/bookmarks/views/bookmarks_list.js | 189 ++- .../bookmarks/views/bookmarks_list_button.js | 67 +- lms/static/js/ccx/schedule.js | 884 +++++++------- lms/static/js/certificates/certificates.js | 8 +- .../certificate_invalidation_collection.js | 6 +- .../collections/certificate_whitelist.js | 37 +- .../certificate_invalidation_factory.js | 8 +- .../certificate_whitelist_factory.js | 28 +- .../models/certificate_exception.js | 24 +- .../models/certificate_invalidation.js | 9 +- .../views/certificate_bulk_whitelist.js | 94 +- .../views/certificate_invalidation_view.js | 31 +- .../views/certificate_whitelist.js | 62 +- .../views/certificate_whitelist_editor.js | 71 +- lms/static/js/commerce/credit.js | 8 +- lms/static/js/commerce/views/receipt_view.js | 80 +- lms/static/js/components/card/views/card.js | 26 +- .../js/components/header/models/header.js | 26 +- .../js/components/header/views/header.js | 8 +- lms/static/js/course_info.js | 16 +- lms/static/js/course_survey.js | 39 +- lms/static/js/courseware/accordion_events.js | 14 +- lms/static/js/courseware/certificates_api.js | 12 +- .../js/courseware/course_home_events.js | 10 +- .../js/courseware/courseware_factory.js | 12 +- lms/static/js/courseware/credit_progress.js | 4 +- .../courseware/toggle_element_visibility.js | 13 +- lms/static/js/dashboard/credit.js | 34 +- lms/static/js/dashboard/donation.js | 47 +- lms/static/js/dashboard/dropdown.js | 49 +- lms/static/js/dashboard/legacy.js | 233 ++-- lms/static/js/dashboard/track_events.js | 23 +- lms/static/js/discovery/collection.js | 196 ++- .../js/discovery/collections/filters.js | 27 +- lms/static/js/discovery/discovery_factory.js | 31 +- lms/static/js/discovery/models/course_card.js | 43 +- .../js/discovery/models/course_discovery.js | 110 +- .../js/discovery/models/facet_option.js | 27 +- lms/static/js/discovery/models/filter.js | 25 +- .../js/discovery/models/search_state.js | 245 ++-- lms/static/js/discovery/views/course_card.js | 69 +- .../js/discovery/views/courses_listing.js | 100 +- lms/static/js/discovery/views/facet.js | 53 +- lms/static/js/discovery/views/facets.js | 73 +- lms/static/js/discovery/views/filter_bar.js | 127 +- lms/static/js/discovery/views/filter_label.js | 53 +- .../js/discovery/views/refine_sidebar.js | 141 ++- lms/static/js/discovery/views/search_form.js | 101 +- lms/static/js/edxnotes/collections/notes.js | 86 +- lms/static/js/edxnotes/collections/tabs.js | 20 +- lms/static/js/edxnotes/models/note.js | 98 +- lms/static/js/edxnotes/models/tab.js | 70 +- .../js/edxnotes/plugins/accessibility.js | 374 +++--- .../js/edxnotes/plugins/caret_navigation.js | 156 +-- lms/static/js/edxnotes/plugins/events.js | 212 ++-- lms/static/js/edxnotes/plugins/scroller.js | 88 +- .../edxnotes/plugins/store_error_handler.js | 38 +- lms/static/js/edxnotes/utils/logger.js | 174 +-- lms/static/js/edxnotes/utils/template.js | 30 +- lms/static/js/edxnotes/utils/utils.js | 20 +- lms/static/js/edxnotes/views/note_group.js | 134 +- lms/static/js/edxnotes/views/note_item.js | 138 +-- lms/static/js/edxnotes/views/notes_factory.js | 118 +- lms/static/js/edxnotes/views/notes_page.js | 98 +- .../views/notes_visibility_factory.js | 195 ++- lms/static/js/edxnotes/views/page_factory.js | 42 +- lms/static/js/edxnotes/views/search_box.js | 244 ++-- lms/static/js/edxnotes/views/shim.js | 306 ++--- lms/static/js/edxnotes/views/tab_item.js | 20 +- lms/static/js/edxnotes/views/tab_panel.js | 22 +- lms/static/js/edxnotes/views/tab_view.js | 192 +-- .../edxnotes/views/tabs/course_structure.js | 100 +- .../js/edxnotes/views/tabs/recent_activity.js | 58 +- .../js/edxnotes/views/tabs/search_results.js | 274 ++--- lms/static/js/edxnotes/views/tabs/tags.js | 192 +-- lms/static/js/edxnotes/views/tabs_list.js | 66 +- .../js/edxnotes/views/visibility_decorator.js | 56 +- .../financial_assistance_form_factory.js | 6 +- .../models/financial_assistance_model.js | 4 +- .../views/financial_assistance_form_view.js | 194 +-- lms/static/js/footer-edx.js | 18 +- lms/static/js/form.ext.js | 75 +- lms/static/js/groups/collections/cohort.js | 7 +- lms/static/js/groups/models/cohort.js | 3 +- .../js/groups/models/cohort_discussions.js | 2 +- lms/static/js/groups/models/content_group.js | 2 +- .../groups/models/course_cohort_settings.js | 5 +- .../groups/models/verified_track_settings.js | 2 +- .../js/groups/views/cohort_discussions.js | 25 +- .../views/cohort_discussions_course_wide.js | 26 +- .../groups/views/cohort_discussions_inline.js | 28 +- lms/static/js/groups/views/cohort_editor.js | 42 +- lms/static/js/groups/views/cohort_form.js | 13 +- lms/static/js/groups/views/cohorts.js | 31 +- .../groups/views/cohorts_dashboard_factory.js | 7 +- .../course_cohort_settings_notification.js | 5 +- .../verified_track_settings_notification.js | 29 +- lms/static/js/header_factory.js | 4 +- .../js/instructor_dashboard/certificates.js | 45 +- .../instructor_dashboard/cohort_management.js | 15 +- .../js/instructor_dashboard/ecommerce.js | 100 +- .../js/instructor_dashboard/proctoring.js | 16 +- .../collections/course_card_collection.js | 20 +- .../collections/program_collection.js | 20 +- .../program_progress_collection.js | 14 +- .../models/course_card_model.js | 176 +-- .../models/course_enroll_model.js | 8 +- .../learner_dashboard/models/program_model.js | 52 +- .../program_details_factory.js | 4 +- .../learner_dashboard/program_list_factory.js | 12 +- .../views/certificate_status_view.js | 30 +- .../views/certificate_view.js | 36 +- .../views/collection_list_view.js | 16 +- .../views/course_card_view.js | 92 +- .../views/course_enroll_view.js | 143 ++- .../views/explore_new_programs_view.js | 36 +- .../views/program_card_view.js | 162 +-- .../views/program_details_view.js | 62 +- .../views/program_header_view.js | 74 +- .../learner_dashboard/views/sidebar_view.js | 42 +- .../views/upgrade_message_view.js | 30 +- lms/static/js/logout.js | 6 +- lms/static/js/models/notification.js | 10 +- lms/static/js/my_courses_dropdown.js | 108 +- lms/static/js/pdf-analytics.js | 134 +- lms/static/js/pending_tasks.js | 19 +- .../base/collections/search_collection.js | 182 ++- .../js/search/base/models/search_result.js | 25 +- .../js/search/base/routers/search_router.js | 25 +- .../js/search/base/views/search_form.js | 115 +- .../js/search/base/views/search_item_view.js | 111 +- .../search/base/views/search_results_view.js | 173 ++- .../js/search/course/course_search_factory.js | 29 +- .../js/search/course/views/search_form.js | 19 +- .../search/course/views/search_item_view.js | 19 +- .../course/views/search_results_view.js | 58 +- .../dashboard/dashboard_search_factory.js | 29 +- .../js/search/dashboard/views/search_form.js | 19 +- .../dashboard/views/search_item_view.js | 19 +- .../dashboard/views/search_results_view.js | 50 +- lms/static/js/shoppingcart/shoppingcart.js | 20 +- .../js/spec/api_admin/catalog_preview_spec.js | 16 +- lms/static/js/spec/ccx/schedule_spec.js | 117 +- .../js/spec/commerce/receipt_view_spec.js | 153 ++- .../js/spec/components/card/card_spec.js | 49 +- .../js/spec/components/header/header_spec.js | 19 +- .../courseware/bookmark_button_view_spec.js | 19 +- .../courseware/bookmarks_list_view_spec.js | 67 +- .../courseware/course_home_events_spec.js | 14 +- .../courseware/link_clicked_events_spec.js | 20 +- .../courseware/updates_visibility_spec.js | 13 +- lms/static/js/spec/dashboard/donation.js | 95 +- lms/static/js/spec/dashboard/dropdown_spec.js | 35 +- .../js/spec/dashboard/track_events_spec.js | 5 +- .../discovery/collections/filters_spec.js | 13 +- .../spec/discovery/discovery_factory_spec.js | 132 +- .../spec/discovery/models/course_card_spec.js | 9 +- .../discovery/models/course_directory_spec.js | 117 +- .../discovery/models/facet_option_spec.js | 9 +- .../js/spec/discovery/models/filter_spec.js | 7 +- .../discovery/models/search_state_spec.js | 55 +- .../spec/discovery/views/course_card_spec.js | 41 +- .../discovery/views/courses_listing_spec.js | 49 +- .../spec/discovery/views/filter_bar_spec.js | 17 +- .../spec/discovery/views/filter_label_spec.js | 13 +- .../discovery/views/refine_sidebar_spec.js | 30 +- .../spec/discovery/views/search_form_spec.js | 17 +- .../spec/edxnotes/collections/notes_spec.js | 10 +- lms/static/js/spec/edxnotes/helpers.js | 37 +- .../js/spec/edxnotes/models/note_spec.js | 8 +- .../js/spec/edxnotes/models/tab_spec.js | 8 +- .../edxnotes/plugins/accessibility_spec.js | 86 +- .../edxnotes/plugins/caret_navigation_spec.js | 57 +- .../js/spec/edxnotes/plugins/events_spec.js | 24 +- .../js/spec/edxnotes/plugins/scroller_spec.js | 2 +- .../plugins/store_error_handler_spec.js | 60 +- .../js/spec/edxnotes/utils/logger_spec.js | 4 +- .../js/spec/edxnotes/views/note_item_spec.js | 24 +- .../spec/edxnotes/views/notes_factory_spec.js | 6 +- .../views/notes_visibility_factory_spec.js | 2 +- .../js/spec/edxnotes/views/search_box_spec.js | 28 +- .../js/spec/edxnotes/views/shim_spec.js | 40 +- .../js/spec/edxnotes/views/tab_item_spec.js | 8 +- .../js/spec/edxnotes/views/tab_view_spec.js | 24 +- .../views/tabs/course_structure_spec.js | 12 +- .../views/tabs/recent_activity_spec.js | 80 +- .../views/tabs/search_results_spec.js | 84 +- .../js/spec/edxnotes/views/tabs/tags_spec.js | 14 +- .../js/spec/edxnotes/views/tabs_list_spec.js | 8 +- .../views/visibility_decorator_spec.js | 4 +- .../financial_assistance_form_view_spec.js | 415 ++++--- .../js/spec/groups/views/cohorts_spec.js | 215 ++-- .../certificates_bulk_exception_spec.js | 45 +- .../certificates_exception_spec.js | 217 ++-- .../certificates_invalidation_spec.js | 164 ++- .../instructor_dashboard/certificates_spec.js | 39 +- .../data_download_spec.js | 10 +- .../instructor_dashboard/ecommerce_spec.js | 14 +- .../student_admin_spec.js | 88 +- .../certificate_view_spec.js | 117 +- .../collection_list_view_spec.js | 279 +++-- .../course_card_view_spec.js | 287 +++-- .../course_enroll_view_spec.js | 469 ++++--- .../program_card_view_spec.js | 230 ++-- .../program_details_header_spec.js | 107 +- .../learner_dashboard/sidebar_view_spec.js | 122 +- lms/static/js/spec/markdown_editor_spec.js | 22 +- lms/static/js/spec/navigation_spec.js | 8 +- lms/static/js/spec/search/search_spec.js | 177 ++- .../js/spec/shoppingcart/shoppingcart_spec.js | 12 +- .../js/spec/staff_debug_actions_spec.js | 65 +- .../js/spec/student_account/access_spec.js | 292 +++-- .../account_settings_factory_spec.js | 30 +- .../account_settings_fields_helpers.js | 4 +- .../account_settings_fields_spec.js | 25 +- .../account_settings_view_spec.js | 33 +- .../js/spec/student_account/account_spec.js | 128 +- .../spec/student_account/emailoptin_spec.js | 9 +- .../spec/student_account/enrollment_spec.js | 27 +- .../spec/student_account/finish_auth_spec.js | 241 ++-- lms/static/js/spec/student_account/helpers.js | 16 +- .../spec/student_account/hinted_login_spec.js | 139 ++- .../student_account/institution_login_spec.js | 128 +- .../js/spec/student_account/login_spec.js | 409 ++++--- .../logistration_factory_spec.js | 143 ++- .../student_account/password_reset_spec.js | 169 ++- .../js/spec/student_account/register_spec.js | 539 ++++---- .../spec/student_account/shoppingcart_spec.js | 27 +- .../badge_list_container_spec.js | 32 +- .../student_profile/badge_list_view_spec.js | 46 +- .../spec/student_profile/badge_view_spec.js | 44 +- lms/static/js/spec/student_profile/helpers.js | 65 +- .../learner_profile_factory_spec.js | 36 +- .../learner_profile_fields_spec.js | 44 +- .../learner_profile_view_spec.js | 49 +- .../student_profile/section_two_tab_spec.js | 65 +- .../student_profile/share_modal_view_spec.js | 27 +- .../spec/verify_student/image_input_spec.js | 109 +- .../make_payment_step_view_ab_testing_spec.js | 149 ++- .../make_payment_step_view_spec.js | 194 ++- .../pay_and_verify_view_spec.js | 55 +- .../spec/verify_student/reverify_view_spec.js | 33 +- .../review_photos_step_view_spec.js | 90 +- .../verify_student/webcam_photo_view_spec.js | 118 +- lms/static/js/spec/views/fields_helpers.js | 79 +- lms/static/js/spec/views/fields_spec.js | 58 +- .../js/spec/views/file_uploader_spec.js | 108 +- .../js/spec/views/message_banner_spec.js | 9 +- lms/static/js/spec/views/notification_spec.js | 44 +- lms/static/js/split.js | 34 +- lms/static/js/staff_debug_actions.js | 199 ++- lms/static/js/sticky_filter.js | 22 +- lms/static/js/student_account/account.js | 19 +- lms/static/js/student_account/emailoptin.js | 5 +- lms/static/js/student_account/enrollment.js | 21 +- .../student_account/logistration_factory.js | 8 +- .../js/student_account/models/LoginModel.js | 13 +- .../models/PasswordResetModel.js | 59 +- .../student_account/models/RegisterModel.js | 83 +- .../models/user_account_model.js | 25 +- .../models/user_preferences_model.js | 5 +- .../js/student_account/password_reset.js | 8 +- lms/static/js/student_account/shoppingcart.js | 15 +- .../js/student_account/views/AccessView.js | 406 +++--- .../student_account/views/FinishAuthView.js | 53 +- .../js/student_account/views/FormView.js | 400 +++--- .../student_account/views/HintedLoginView.js | 51 +- .../views/InstitutionLoginView.js | 35 +- .../js/student_account/views/LoginView.js | 194 +-- .../views/PasswordResetView.js | 65 +- .../js/student_account/views/RegisterView.js | 131 +- .../views/account_section_view.js | 9 +- .../views/account_settings_factory.js | 17 +- .../views/account_settings_fields.js | 57 +- .../views/account_settings_view.js | 21 +- .../views/finish_auth_factory.js | 6 +- .../js/student_profile/models/badges_model.js | 3 +- .../views/badge_list_container.js | 6 +- .../student_profile/views/badge_list_view.js | 28 +- .../js/student_profile/views/badge_view.js | 7 +- .../views/learner_profile_factory.js | 26 +- .../views/learner_profile_fields.js | 37 +- .../views/learner_profile_view.js | 224 ++-- .../student_profile/views/section_two_tab.js | 13 +- .../student_profile/views/share_modal_view.js | 21 +- lms/static/js/toggle_login_modal.js | 191 ++- lms/static/js/utils/facebook.js | 16 +- lms/static/js/utils/navigation.js | 8 +- .../js/verify_student/incourse_reverify.js | 31 +- .../models/verification_model.js | 87 +- .../js/verify_student/pay_and_verify.js | 12 +- lms/static/js/verify_student/reverify.js | 58 +- .../enrollment_confirmation_step_view.js | 3 +- .../js/verify_student/views/error_view.js | 61 +- .../views/face_photo_step_view.js | 19 +- .../views/id_photo_step_view.js | 17 +- .../verify_student/views/image_input_view.js | 155 ++- .../views/incourse_reverify_view.js | 128 +- .../verify_student/views/intro_step_view.js | 9 +- .../views/make_payment_step_view.js | 142 ++- .../views/pay_and_verify_view.js | 43 +- .../views/payment_confirmation_step_view.js | 55 +- .../views/reverify_success_step_view.js | 11 +- .../js/verify_student/views/reverify_view.js | 143 ++- .../views/review_photos_step_view.js | 63 +- .../js/verify_student/views/step_view.js | 99 +- .../verify_student/views/webcam_photo_view.js | 489 ++++---- lms/static/js/views/fields.js | 120 +- lms/static/js/views/file_uploader.js | 34 +- lms/static/js/views/image_field.js | 89 +- lms/static/js/views/message_banner.js | 13 +- lms/static/js/views/notification.js | 20 +- lms/static/js/wiki/CodeMirror.init.js | 36 +- lms/static/js/wiki/accessible.js | 12 +- lms/static/karma_lms.conf.js | 2 +- lms/static/karma_lms_coffee.conf.js | 2 +- lms/static/lms/js/build.js | 3 +- lms/static/lms/js/preview/preview_factory.js | 3 +- lms/static/lms/js/require-config.js | 20 +- lms/static/lms/js/spec/main.js | 2 +- .../lms/js/spec/main_requirejs_coffee.js | 35 +- lms/static/lms/js/xblock/lms.runtime.v1.js | 2 - 386 files changed, 13004 insertions(+), 13520 deletions(-) diff --git a/lms/djangoapps/support/static/support/js/certificates_factory.js b/lms/djangoapps/support/static/support/js/certificates_factory.js index 753e4e1c5e..9f9c60fd95 100644 --- a/lms/djangoapps/support/static/support/js/certificates_factory.js +++ b/lms/djangoapps/support/static/support/js/certificates_factory.js @@ -1,9 +1,9 @@ -;(function (define) { +(function(define) { 'use strict'; define(['jquery', 'underscore', 'support/js/views/certificates'], - function ($, _, CertificatesView) { - return function (options) { + function($, _, CertificatesView) { + return function(options) { options = _.extend(options, { el: $('.certificates-content') }); diff --git a/lms/djangoapps/support/static/support/js/collections/certificate.js b/lms/djangoapps/support/static/support/js/collections/certificate.js index 4d2260ad30..d56236d167 100644 --- a/lms/djangoapps/support/static/support/js/collections/certificate.js +++ b/lms/djangoapps/support/static/support/js/collections/certificate.js @@ -1,4 +1,4 @@ -;(function (define) { +(function(define) { 'use strict'; define(['backbone', 'support/js/models/certificate'], function(Backbone, CertModel) { @@ -26,5 +26,5 @@ return url; } }); - }); + }); }).call(this, define || RequireJS.define); diff --git a/lms/djangoapps/support/static/support/js/collections/enrollment.js b/lms/djangoapps/support/static/support/js/collections/enrollment.js index 5a8491a02b..300c95df45 100644 --- a/lms/djangoapps/support/static/support/js/collections/enrollment.js +++ b/lms/djangoapps/support/static/support/js/collections/enrollment.js @@ -1,4 +1,4 @@ -;(function (define) { +(function(define) { 'use strict'; define(['backbone', 'support/js/models/enrollment'], function(Backbone, EnrollmentModel) { @@ -14,5 +14,5 @@ return this.baseUrl + this.user; } }); - }); + }); }).call(this, define || RequireJS.define); diff --git a/lms/djangoapps/support/static/support/js/enrollment_factory.js b/lms/djangoapps/support/static/support/js/enrollment_factory.js index 9e285b6b3b..202edf540c 100644 --- a/lms/djangoapps/support/static/support/js/enrollment_factory.js +++ b/lms/djangoapps/support/static/support/js/enrollment_factory.js @@ -1,11 +1,11 @@ -;(function (define) { +(function(define) { 'use strict'; define([ 'underscore', 'support/js/views/enrollment' - ], function (_, EnrollmentView) { - return function (options) { + ], function(_, EnrollmentView) { + return function(options) { options = _.extend({el: '.enrollment-content'}, options); return new EnrollmentView(options).render(); }; diff --git a/lms/djangoapps/support/static/support/js/models/certificate.js b/lms/djangoapps/support/static/support/js/models/certificate.js index 7cb7d02eda..da7322ff0a 100644 --- a/lms/djangoapps/support/static/support/js/models/certificate.js +++ b/lms/djangoapps/support/static/support/js/models/certificate.js @@ -1,6 +1,6 @@ -(function (define) { +(function(define) { 'use strict'; - define(['backbone'], function (Backbone) { + define(['backbone'], function(Backbone) { return Backbone.Model.extend({ defaults: { username: null, diff --git a/lms/djangoapps/support/static/support/js/models/enrollment.js b/lms/djangoapps/support/static/support/js/models/enrollment.js index 1fb8ead6a8..5bfa2f7d1b 100644 --- a/lms/djangoapps/support/static/support/js/models/enrollment.js +++ b/lms/djangoapps/support/static/support/js/models/enrollment.js @@ -1,8 +1,8 @@ -(function (define) { +(function(define) { 'use strict'; - define(['backbone', 'underscore'], function (Backbone, _) { + define(['backbone', 'underscore'], function(Backbone, _) { return Backbone.Model.extend({ - updateEnrollment: function (new_mode, reason) { + updateEnrollment: function(new_mode, reason) { return $.ajax({ url: this.url(), type: 'POST', @@ -13,7 +13,7 @@ old_mode: this.get('mode'), reason: reason }), - success: _.bind(function (response) { + success: _.bind(function(response) { this.set('manual_enrollment', response); this.set('mode', new_mode); }, this) diff --git a/lms/djangoapps/support/static/support/js/spec/collections/enrollment_spec.js b/lms/djangoapps/support/static/support/js/spec/collections/enrollment_spec.js index aaef20f179..fcb8db90bc 100644 --- a/lms/djangoapps/support/static/support/js/spec/collections/enrollment_spec.js +++ b/lms/djangoapps/support/static/support/js/spec/collections/enrollment_spec.js @@ -1,21 +1,21 @@ define([ 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'support/js/spec_helpers/enrollment_helpers', - 'support/js/collections/enrollment', -], function (AjaxHelpers, EnrollmentHelpers, EnrollmentCollection) { + 'support/js/collections/enrollment' +], function(AjaxHelpers, EnrollmentHelpers, EnrollmentCollection) { 'use strict'; - describe('EnrollmentCollection', function () { + describe('EnrollmentCollection', function() { var enrollmentCollection; - beforeEach(function () { + beforeEach(function() { enrollmentCollection = new EnrollmentCollection([EnrollmentHelpers.mockEnrollmentData], { user: 'test-user', baseUrl: '/support/enrollment/' }); }); - it('sets its URL based on the user', function () { + it('sets its URL based on the user', function() { expect(enrollmentCollection.url()).toEqual('/support/enrollment/test-user'); }); }); diff --git a/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js b/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js index cd280bd6e3..9f81994a78 100644 --- a/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js +++ b/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js @@ -2,20 +2,20 @@ define([ 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'support/js/spec_helpers/enrollment_helpers', 'support/js/models/enrollment' -], function (AjaxHelpers, EnrollmentHelpers, EnrollmentModel) { +], function(AjaxHelpers, EnrollmentHelpers, EnrollmentModel) { 'use strict'; - describe('EnrollmentModel', function () { + describe('EnrollmentModel', function() { var enrollment; - beforeEach(function () { + beforeEach(function() { enrollment = new EnrollmentModel(EnrollmentHelpers.mockEnrollmentData); - enrollment.url = function () { + enrollment.url = function() { return '/support/enrollment/test-user'; }; }); - it('can save an enrollment to the server and updates itself on success', function () { + it('can save an enrollment to the server and updates itself on success', function() { var requests = AjaxHelpers.requests(this), manual_enrollment = { 'enrolled_by': 'staff@edx.org', @@ -33,7 +33,7 @@ define([ expect(enrollment.get('manual_enrollment')).toEqual(manual_enrollment); }); - it('does not update itself on a server error', function () { + it('does not update itself on a server error', function() { var requests = AjaxHelpers.requests(this); enrollment.updateEnrollment('verified', 'Financial Assistance'); AjaxHelpers.respondWithError(requests, 500); diff --git a/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js b/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js index 7080d77944..87eee9f3ea 100644 --- a/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js +++ b/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js @@ -6,91 +6,90 @@ define([ 'use strict'; describe('CertificatesView', function() { - var view = null, - REGENERATE_SEARCH_RESULTS = [ - { - 'username': 'student', - 'status': 'notpassing', - 'created': '2015-08-05T17:32:25+00:00', - 'grade': '0.0', - 'type': 'honor', - 'course_key': 'course-v1:edX+DemoX+Demo_Course', - 'download_url': null, - 'modified': '2015-08-06T19:47:07+00:00', - 'regenerate': true - }, - { - 'username': 'student', - 'status': 'downloadable', - 'created': '2015-08-05T17:53:33+00:00', - 'grade': '1.0', - 'type': 'verified', - 'course_key': 'edx/test/2015', - 'download_url': 'http://www.example.com/certificate.pdf', - 'modified': '2015-08-06T19:47:05+00:00', - 'regenerate': true - } - ], + REGENERATE_SEARCH_RESULTS = [ + { + 'username': 'student', + 'status': 'notpassing', + 'created': '2015-08-05T17:32:25+00:00', + 'grade': '0.0', + 'type': 'honor', + 'course_key': 'course-v1:edX+DemoX+Demo_Course', + 'download_url': null, + 'modified': '2015-08-06T19:47:07+00:00', + 'regenerate': true + }, + { + 'username': 'student', + 'status': 'downloadable', + 'created': '2015-08-05T17:53:33+00:00', + 'grade': '1.0', + 'type': 'verified', + 'course_key': 'edx/test/2015', + 'download_url': 'http://www.example.com/certificate.pdf', + 'modified': '2015-08-06T19:47:05+00:00', + 'regenerate': true + } + ], - GENERATE_SEARCH_RESULTS = [ - { - 'username': 'student', - 'status': '', - 'created': '', - 'grade': '', - 'type': '', - 'course_key': 'edx/test1/2016', - 'download_url': null, - 'modified': '', - 'regenerate': false - } - ], + GENERATE_SEARCH_RESULTS = [ + { + 'username': 'student', + 'status': '', + 'created': '', + 'grade': '', + 'type': '', + 'course_key': 'edx/test1/2016', + 'download_url': null, + 'modified': '', + 'regenerate': false + } + ], - getSearchResults = function() { - var results = []; + getSearchResults = function() { + var results = []; - $('.certificates-results tr').each(function(rowIndex, rowValue) { - var columns = []; - $(rowValue).children('td').each(function(colIndex, colValue) { - columns[colIndex] = $(colValue).html(); + $('.certificates-results tr').each(function(rowIndex, rowValue) { + var columns = []; + $(rowValue).children('td').each(function(colIndex, colValue) { + columns[colIndex] = $(colValue).html(); + }); + + if (columns.length > 0) { + results.push(columns); + } }); - if (columns.length > 0) { - results.push(columns); - } - }); + return results; + }, - return results; - }, - - searchFor = function(user_filter, course_filter, requests, response) { + searchFor = function(user_filter, course_filter, requests, response) { // Enter the search term and submit - var url = '/certificates/search?user=' + user_filter; - view.setUserFilter(user_filter); - if (course_filter) { - view.setCourseFilter(course_filter); - url += '&course_id=' + course_filter; - } - view.triggerSearch(); + var url = '/certificates/search?user=' + user_filter; + view.setUserFilter(user_filter); + if (course_filter) { + view.setCourseFilter(course_filter); + url += '&course_id=' + course_filter; + } + view.triggerSearch(); // Simulate a response from the server - AjaxHelpers.expectJsonRequest(requests, 'GET', url); - AjaxHelpers.respondWithJson(requests, response); - }, + AjaxHelpers.expectJsonRequest(requests, 'GET', url); + AjaxHelpers.respondWithJson(requests, response); + }, - regenerateCerts = function(username, courseKey) { - var sel = '.btn-cert-regenerate[data-course-key="' + courseKey + '"]'; - $(sel).click(); - }, + regenerateCerts = function(username, courseKey) { + var sel = '.btn-cert-regenerate[data-course-key="' + courseKey + '"]'; + $(sel).click(); + }, - generateCerts = function(username, courseKey) { - var sel = '.btn-cert-generate[data-course-key="' + courseKey + '"]'; - $(sel).click(); - }; + generateCerts = function(username, courseKey) { + var sel = '.btn-cert-generate[data-course-key="' + courseKey + '"]'; + $(sel).click(); + }; - beforeEach(function () { + beforeEach(function() { spyOn(window.history, 'pushState'); setFixtures('
'); view = new CertificatesView({ @@ -142,7 +141,6 @@ define([ expect(results[0][3]).toContain('Not available'); expect(results[0][4]).toEqual(GENERATE_SEARCH_RESULTS[0].grade); expect(results[0][5]).toEqual(GENERATE_SEARCH_RESULTS[0].modified); - }); it('searches for certificates and displays a message when there are no results', function() { @@ -201,7 +199,7 @@ define([ AjaxHelpers.respondWithJson(requests, ''); }); - it('generate a certificate for a student', function() { + it('generate a certificate for a student', function() { var requests = AjaxHelpers.requests(this); // Trigger a search @@ -223,6 +221,5 @@ define([ // Respond with success AjaxHelpers.respondWithJson(requests, ''); }); - }); }); diff --git a/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js b/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js index 8411babf9f..f942d43764 100644 --- a/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js +++ b/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js @@ -4,16 +4,15 @@ define([ 'support/js/spec_helpers/enrollment_helpers', 'support/js/models/enrollment', 'support/js/views/enrollment_modal' -], function (_, AjaxHelpers, EnrollmentHelpers, EnrollmentModel, EnrollmentModal) { +], function(_, AjaxHelpers, EnrollmentHelpers, EnrollmentModel, EnrollmentModal) { 'use strict'; - describe('EnrollmentModal', function () { - + describe('EnrollmentModal', function() { var modal; - beforeEach(function () { + beforeEach(function() { var enrollment = new EnrollmentModel(EnrollmentHelpers.mockEnrollmentData); - enrollment.url = function () { + enrollment.url = function() { return '/support/enrollment/test-user'; }; setFixtures(''); @@ -23,53 +22,53 @@ define([ modes: ['verified', 'audit'], reasons: _.reduce( ['Financial Assistance', 'Stampeding Buffalo', 'Angry Customer'], - function (acc, x) { acc[x] = x; return acc; }, + function(acc, x) { acc[x] = x; return acc; }, {} ) }).render(); }); - it('can render itself', function () { + it('can render itself', function() { expect($('.enrollment-modal h1').text()).toContain( 'Change enrollment for ' + EnrollmentHelpers.TEST_COURSE ); expect($('.enrollment-change-field p').first().text()).toContain('Current enrollment mode: audit'); - _.each(['verified', 'audit'], function (mode) { + _.each(['verified', 'audit'], function(mode) { expect($('.enrollment-new-mode').html()).toContain('