diff --git a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py index 37b2224c8d..c3de2244fb 100644 --- a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py +++ b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py @@ -330,7 +330,8 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT ) def test_staff_can_see_writable_gradebook(self): """ - Test that, when the writable gradebook featue is enabled, a staff member can see it. + Test that, when the writable gradebook feature is enabled and + deployed in another domain, a staff member can see it. """ waffle_flag = waffle_flags()[WRITABLE_GRADEBOOK] with override_waffle_flag(waffle_flag, active=True): @@ -345,6 +346,28 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT 'of enrolled learners.' ) + @patch( + 'lms.djangoapps.instructor.views.instructor_dashboard.settings.WRITABLE_GRADEBOOK_URL', + settings.LMS_ROOT_URL + '/gradebook' + ) + def test_staff_can_see_writable_gradebook_as_subdirectory(self): + """ + Test that, when the writable gradebook feature is enabled and + deployed in a subdirectory, a staff member can see it. + """ + waffle_flag = waffle_flags()[WRITABLE_GRADEBOOK] + with override_waffle_flag(waffle_flag, active=True): + response = self.client.get(self.url) + + expected_gradebook_url = '{}/{}'.format(settings.WRITABLE_GRADEBOOK_URL, self.course.id) + self.assertContains(response, expected_gradebook_url) + self.assertContains(response, 'View Gradebook') + + GRADEBOOK_LEARNER_COUNT_MESSAGE = ( + 'Note: This feature is available only to courses with a small number ' + + 'of enrolled learners.' + ) + def test_gradebook_learner_count_message(self): """ Test that, when the writable gradebook featue is NOT enabled, there IS diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 1cf944bd51..b75acb4d06 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -573,7 +573,7 @@ def _section_student_admin(course, access): 'spoc_gradebook_url': reverse('spoc_gradebook', kwargs={'course_id': six.text_type(course_key)}), } if is_writable_gradebook_enabled(course_key) and settings.WRITABLE_GRADEBOOK_URL: - section_data['writable_gradebook_url'] = urljoin(settings.WRITABLE_GRADEBOOK_URL, '/' + text_type(course_key)) + section_data['writable_gradebook_url'] = '{}/{}'.format(settings.WRITABLE_GRADEBOOK_URL, text_type(course_key)) return section_data