Merge pull request #26046 from open-craft/danielf/BB-3502
[BTR-53] [BB-3502] Misuse of urljoin in Gradebook URL from Instructor Panel
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user