Change URL patterns for instructor dashboard
Fix acceptance and unit tests LMS-1296
This commit is contained in:
@@ -38,6 +38,12 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
|
||||
self.client.login(username=self.student.username, password="test")
|
||||
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id})
|
||||
self.success_content = {
|
||||
'course_id': self.course.id,
|
||||
'success': True,
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Undo all patches.
|
||||
@@ -48,18 +54,12 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
"""Navigate to the instructor dash's email view"""
|
||||
# Pull up email view on instructor dashboard
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
# Response loads the whole instructor dashboard, so no need to explicitly
|
||||
# navigate to a particular email section
|
||||
response = self.client.get(url)
|
||||
email_link = '<a href="#" onclick="goto(\'Email\')" class="None">Email</a>'
|
||||
email_section = '<div class="vert-left send-email" id="section-send-email">'
|
||||
# If this fails, it is likely because ENABLE_INSTRUCTOR_EMAIL is set to False
|
||||
self.assertTrue(email_link in response.content)
|
||||
|
||||
# Select the Email view of the instructor dash
|
||||
session = self.client.session
|
||||
session[u'idash_mode:{0}'.format(self.course.location.course_id)] = 'Email'
|
||||
session.save()
|
||||
response = self.client.get(url)
|
||||
selected_email_link = '<a href="#" onclick="goto(\'Email\')" class="selectedmode">Email</a>'
|
||||
self.assertTrue(selected_email_link in response.content)
|
||||
self.assertTrue(email_section in response.content)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
|
||||
def test_optout_course(self):
|
||||
@@ -77,15 +77,14 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
self.client.login(username=self.instructor.username, password="test")
|
||||
self.navigate_to_email_view()
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': 'test message for all'
|
||||
}
|
||||
response = self.client.post(url, test_email)
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
# Assert that self.student.email not in mail.to, outbox should be empty
|
||||
self.assertEqual(len(mail.outbox), 0)
|
||||
@@ -106,16 +105,14 @@ class TestOptoutCourseEmails(ModuleStoreTestCase):
|
||||
self.client.login(username=self.instructor.username, password="test")
|
||||
self.navigate_to_email_view()
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': 'test message for all'
|
||||
}
|
||||
response = self.client.post(url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
# Assert that self.student.email in mail.to
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
"""
|
||||
Unit tests for sending course email
|
||||
"""
|
||||
import json
|
||||
|
||||
from mock import patch
|
||||
|
||||
from django.conf import settings
|
||||
@@ -70,18 +72,17 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
|
||||
# Pull up email view on instructor dashboard
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
# Response loads the whole instructor dashboard, so no need to explicitly
|
||||
# navigate to a particular email section
|
||||
response = self.client.get(self.url)
|
||||
email_link = '<a href="#" onclick="goto(\'Email\')" class="None">Email</a>'
|
||||
email_section = '<div class="vert-left send-email" id="section-send-email">'
|
||||
# If this fails, it is likely because ENABLE_INSTRUCTOR_EMAIL is set to False
|
||||
self.assertTrue(email_link in response.content)
|
||||
|
||||
# Select the Email view of the instructor dash
|
||||
session = self.client.session
|
||||
session[u'idash_mode:{0}'.format(self.course.location.course_id)] = 'Email'
|
||||
session.save()
|
||||
response = self.client.get(self.url)
|
||||
selected_email_link = '<a href="#" onclick="goto(\'Email\')" class="selectedmode">Email</a>'
|
||||
self.assertTrue(selected_email_link in response.content)
|
||||
self.assertTrue(email_section in response.content)
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id})
|
||||
self.success_content = {
|
||||
'course_id': self.course.id,
|
||||
'success': True,
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
@@ -96,12 +97,13 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
"""
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'myself',
|
||||
'send_to': 'myself',
|
||||
'subject': 'test subject for myself',
|
||||
'message': 'test message for myself'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
self.assertContains(response, "Email is not enabled for this course.")
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
# We should get back a HttpResponseForbidden (status code 403)
|
||||
self.assertContains(response, "Email is not enabled for this course.", status_code=403)
|
||||
|
||||
def test_send_to_self(self):
|
||||
"""
|
||||
@@ -110,15 +112,16 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
# Now we know we have pulled up the instructor dash's email view
|
||||
# (in the setUp method), we can test sending an email.
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'myself',
|
||||
'action': 'send',
|
||||
'send_to': 'myself',
|
||||
'subject': 'test subject for myself',
|
||||
'message': 'test message for myself'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
# Check that outbox is as expected
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
self.assertEqual(len(mail.outbox[0].to), 1)
|
||||
self.assertEquals(mail.outbox[0].to[0], self.instructor.email)
|
||||
@@ -135,13 +138,13 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
# (in the setUp method), we can test sending an email.
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'staff',
|
||||
'send_to': 'staff',
|
||||
'subject': 'test subject for staff',
|
||||
'message': 'test message for subject'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
# the 1 is for the instructor in this test and others
|
||||
self.assertEquals(len(mail.outbox), 1 + len(self.staff))
|
||||
@@ -159,13 +162,13 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': 'test message for all'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertEquals(len(mail.outbox), 1 + len(self.staff) + len(self.students))
|
||||
self.assertItemsEqual(
|
||||
@@ -183,13 +186,13 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
uni_subject = u'téśt śúbjéćt főŕ áĺĺ'
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': uni_subject,
|
||||
'message': 'test message for all'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertEquals(len(mail.outbox), 1 + len(self.staff) + len(self.students))
|
||||
self.assertItemsEqual(
|
||||
@@ -211,13 +214,13 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
uni_message = u'ẗëṡẗ ṁëṡṡäġë ḟöṛ äḷḷ イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ fоѓ аll'
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': uni_message
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertEquals(len(mail.outbox), 1 + len(self.staff) + len(self.students))
|
||||
self.assertItemsEqual(
|
||||
@@ -242,13 +245,13 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': 'test message for all'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertEquals(len(mail.outbox), 1 + len(self.staff) + len(self.students))
|
||||
|
||||
@@ -280,12 +283,14 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
|
||||
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': 'test message for all'
|
||||
}
|
||||
response = self.client.post(self.url, test_email)
|
||||
self.assertContains(response, "Your email was successfully queued for sending.")
|
||||
# Post the email to the instructor dashboard API
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertEquals(mock_factory.emails_sent,
|
||||
1 + len(self.staff) + len(self.students) + LARGE_NUM_EMAILS - len(optouts))
|
||||
outbox_contents = [e.to[0] for e in mail.outbox]
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
"""
|
||||
Unit tests for handling email sending errors
|
||||
"""
|
||||
import json
|
||||
|
||||
from itertools import cycle
|
||||
from mock import patch
|
||||
from smtplib import SMTPDataError, SMTPServerDisconnected, SMTPConnectError
|
||||
@@ -53,6 +55,11 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
# load initial content (since we don't run migrations as part of tests):
|
||||
call_command("loaddata", "course_email_template.json")
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
self.send_mail_url = reverse('send_email', kwargs={'course_id': self.course.id})
|
||||
self.success_content = {
|
||||
'course_id': self.course.id,
|
||||
'success': True,
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
patch.stopall()
|
||||
@@ -66,15 +73,16 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
get_conn.return_value.send_messages.side_effect = SMTPDataError(455, "Throttling: Sending rate exceeded")
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'myself',
|
||||
'send_to': 'myself',
|
||||
'subject': 'test subject for myself',
|
||||
'message': 'test message for myself'
|
||||
}
|
||||
self.client.post(self.url, test_email)
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
# Test that we retry upon hitting a 4xx error
|
||||
self.assertTrue(retry.called)
|
||||
(_, kwargs) = retry.call_args
|
||||
(__, kwargs) = retry.call_args
|
||||
exc = kwargs['exc']
|
||||
self.assertIsInstance(exc, SMTPDataError)
|
||||
|
||||
@@ -94,11 +102,12 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'all',
|
||||
'send_to': 'all',
|
||||
'subject': 'test subject for all',
|
||||
'message': 'test message for all'
|
||||
}
|
||||
self.client.post(self.url, test_email)
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
# We shouldn't retry when hitting a 5xx error
|
||||
self.assertFalse(retry.called)
|
||||
@@ -118,14 +127,15 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
get_conn.return_value.open.side_effect = SMTPServerDisconnected(425, "Disconnecting")
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'myself',
|
||||
'send_to': 'myself',
|
||||
'subject': 'test subject for myself',
|
||||
'message': 'test message for myself'
|
||||
}
|
||||
self.client.post(self.url, test_email)
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertTrue(retry.called)
|
||||
(_, kwargs) = retry.call_args
|
||||
(__, kwargs) = retry.call_args
|
||||
exc = kwargs['exc']
|
||||
self.assertIsInstance(exc, SMTPServerDisconnected)
|
||||
|
||||
@@ -139,14 +149,15 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
|
||||
test_email = {
|
||||
'action': 'Send email',
|
||||
'to_option': 'myself',
|
||||
'send_to': 'myself',
|
||||
'subject': 'test subject for myself',
|
||||
'message': 'test message for myself'
|
||||
}
|
||||
self.client.post(self.url, test_email)
|
||||
response = self.client.post(self.send_mail_url, test_email)
|
||||
self.assertEquals(json.loads(response.content), self.success_content)
|
||||
|
||||
self.assertTrue(retry.called)
|
||||
(_, kwargs) = retry.call_args
|
||||
(__, kwargs) = retry.call_args
|
||||
exc = kwargs['exc']
|
||||
self.assertIsInstance(exc, SMTPConnectError)
|
||||
|
||||
@@ -162,7 +173,7 @@ class TestEmailErrors(ModuleStoreTestCase):
|
||||
task_input = {"email_id": -1}
|
||||
with self.assertRaises(CourseEmail.DoesNotExist):
|
||||
perform_delegate_email_batches(entry.id, course_id, task_input, "action_name") # pylint: disable=E1101
|
||||
((log_str, _, email_id), _) = mock_log.warning.call_args
|
||||
((log_str, __, email_id), __) = mock_log.warning.call_args
|
||||
self.assertTrue(mock_log.warning.called)
|
||||
self.assertIn('Failed to get CourseEmail with id', log_str)
|
||||
self.assertEqual(email_id, -1)
|
||||
|
||||
@@ -253,17 +253,6 @@ class TestGetProblemGradeDistribution(ModuleStoreTestCase):
|
||||
b_section_has_problem = get_array_section_has_problem(self.course.id)
|
||||
self.assertEquals(b_section_has_problem[0], True)
|
||||
|
||||
def test_dashboard(self):
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
response = self.client.post(
|
||||
url,
|
||||
{
|
||||
'idash_mode': 'Metrics'
|
||||
}
|
||||
)
|
||||
self.assertContains(response, '<h2>Course Statistics At A Glance</h2>')
|
||||
|
||||
def test_has_instructor_access_for_class(self):
|
||||
"""
|
||||
Test for instructor access
|
||||
@@ -1,5 +1,6 @@
|
||||
# pylint: disable=C0111
|
||||
# pylint: disable=W0621
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
from lettuce import world, step
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ Feature: LMS.LTI component
|
||||
Then I see text "Problem Scores: 8/10"
|
||||
And I see graph with total progress "8%"
|
||||
Then I click on the "Instructor" tab
|
||||
And I click on the "Gradebook" tab
|
||||
And I click on the "Student Admin" tab
|
||||
And I click on the "View Gradebook" link
|
||||
And I see in the gradebook table that "HW" is "80"
|
||||
And I see in the gradebook table that "Total" is "8"
|
||||
And I visit the LTI component
|
||||
@@ -114,7 +115,8 @@ Feature: LMS.LTI component
|
||||
Then I see text "Problem Scores: 0/10"
|
||||
And I see graph with total progress "0%"
|
||||
Then I click on the "Instructor" tab
|
||||
And I click on the "Gradebook" tab
|
||||
And I click on the "Student Admin" tab
|
||||
And I click on the "View Gradebook" link
|
||||
And I see in the gradebook table that "HW" is "0"
|
||||
And I see in the gradebook table that "Total" is "0"
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ def when_i_send_an_email(step, recipient): # pylint: disable=unused-argument
|
||||
# Go to the email section of the instructor dash
|
||||
world.visit('/courses/edx/888/Bulk_Email_Test_Course')
|
||||
world.css_click('a[href="/courses/edx/888/Bulk_Email_Test_Course/instructor"]')
|
||||
world.css_click('div.beta-button-wrapper>a.beta-button')
|
||||
world.css_click('a[data-section="send_email"]')
|
||||
|
||||
# Select the recipient
|
||||
|
||||
@@ -77,7 +77,6 @@ def go_to_section(section_name):
|
||||
# course_info, membership, student_admin, data_download, analytics, send_email
|
||||
world.visit('/courses/edx/999/Test_Course')
|
||||
world.css_click('a[href="/courses/edx/999/Test_Course/instructor"]')
|
||||
world.css_click('div.beta-button-wrapper>a.beta-button')
|
||||
world.css_click('a[data-section="{0}"]'.format(section_name))
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
|
||||
self.client.login(username=instructor.username, password="test")
|
||||
|
||||
# URL for instructor dash
|
||||
self.url = reverse('instructor_dashboard_2', kwargs={'course_id': self.course.id})
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
# URL for email view
|
||||
self.email_link = '<a href="" data-section="send_email">Email</a>'
|
||||
|
||||
@@ -122,7 +122,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase):
|
||||
self.client.login(username=instructor.username, password="test")
|
||||
|
||||
# URL for instructor dash
|
||||
self.url = reverse('instructor_dashboard_2', kwargs={'course_id': self.course_name})
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course_name})
|
||||
# URL for email view
|
||||
self.email_link = '<a href="" data-section="send_email">Email</a>'
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestInstructorDashboardAnonCSV(ModuleStoreTestCase, LoginEnrollmentTestCas
|
||||
|
||||
def test_download_anon_csv(self):
|
||||
course = self.toy
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
|
||||
with patch('instructor.views.legacy.unique_id_for_user') as mock_unique:
|
||||
mock_unique.return_value = 42
|
||||
|
||||
@@ -49,7 +49,7 @@ class TestInstructorDashboardGradeDownloadCSV(ModuleStoreTestCase, LoginEnrollme
|
||||
|
||||
def test_download_grades_csv(self):
|
||||
course = self.toy
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
msg = "url = {0}\n".format(url)
|
||||
response = self.client.post(url, {'action': 'Download CSV of all student grades for this course'})
|
||||
msg += "instructor dashboard download csv grades: response = '{0}'\n".format(response)
|
||||
|
||||
@@ -32,7 +32,7 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase):
|
||||
self.client.login(username=instructor.username, password="test")
|
||||
|
||||
# URL for instructor dash
|
||||
self.url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
self.url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id})
|
||||
# URL for email view
|
||||
self.email_link = '<a href="#" onclick="goto(\'Email\')" class="None">Email</a>'
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
course = self.course
|
||||
|
||||
# Run the Un-enroll students command
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(
|
||||
url,
|
||||
{
|
||||
@@ -84,7 +84,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
course = self.course
|
||||
|
||||
# Run the Enroll students command
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student1_1@test.com, student1_2@test.com', 'auto_enroll': 'on'})
|
||||
|
||||
# Check the page output
|
||||
@@ -129,7 +129,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
|
||||
course = self.course
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student0@test.com', 'auto_enroll': 'on'})
|
||||
self.assertContains(response, '<td>student0@test.com</td>')
|
||||
self.assertContains(response, '<td>already enrolled</td>')
|
||||
@@ -142,7 +142,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
course = self.course
|
||||
|
||||
# Run the Enroll students command
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student2_1@test.com, student2_2@test.com'})
|
||||
|
||||
# Check the page output
|
||||
@@ -199,7 +199,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
# Create activated, but not enrolled, user
|
||||
UserFactory.create(username="student3_0", email="student3_0@test.com", first_name='Autoenrolled')
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student3_0@test.com, student3_1@test.com, student3_2@test.com', 'auto_enroll': 'on', 'email_students': 'on'})
|
||||
|
||||
# Check the page output
|
||||
@@ -254,7 +254,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
cea = CourseEnrollmentAllowed(email='student4_0@test.com', course_id=course.id)
|
||||
cea.save()
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(url, {'action': 'Unenroll multiple students', 'multiple_students': 'student4_0@test.com, student2@test.com, student3@test.com', 'email_students': 'on'})
|
||||
|
||||
# Check the page output
|
||||
@@ -301,7 +301,7 @@ class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
# Create activated, but not enrolled, user
|
||||
UserFactory.create(username="student5_0", email="student5_0@test.com", first_name="ShibTest", last_name="Enrolled")
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
response = self.client.post(url, {'action': 'Enroll multiple students', 'multiple_students': 'student5_0@test.com, student5_1@test.com', 'auto_enroll': 'on', 'email_students': 'on'})
|
||||
|
||||
# Check the page output
|
||||
|
||||
@@ -67,7 +67,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
|
||||
def test_add_forum_admin_users_for_unknown_user(self):
|
||||
course = self.toy
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'unknown'
|
||||
for action in ['Add', 'Remove']:
|
||||
for rolename in FORUM_ROLES:
|
||||
@@ -76,7 +76,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
|
||||
def test_add_forum_admin_users_for_missing_roles(self):
|
||||
course = self.toy
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'u1'
|
||||
for action in ['Add', 'Remove']:
|
||||
for rolename in FORUM_ROLES:
|
||||
@@ -86,7 +86,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_remove_forum_admin_users_for_missing_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'u1'
|
||||
action = 'Remove'
|
||||
for rolename in FORUM_ROLES:
|
||||
@@ -96,7 +96,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_add_and_remove_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'u2'
|
||||
for rolename in FORUM_ROLES:
|
||||
response = self.client.post(url, {'action': action_name('Add', rolename), FORUM_ADMIN_USER[rolename]: username})
|
||||
@@ -109,7 +109,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_add_and_read_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'u2'
|
||||
for rolename in FORUM_ROLES:
|
||||
# perform an add, and follow with a second identical add:
|
||||
@@ -121,7 +121,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_add_nonstaff_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'u1'
|
||||
rolename = FORUM_ROLE_ADMINISTRATOR
|
||||
response = self.client.post(url, {'action': action_name('Add', rolename), FORUM_ADMIN_USER[rolename]: username})
|
||||
@@ -130,7 +130,7 @@ class TestInstructorDashboardForumAdmin(ModuleStoreTestCase, LoginEnrollmentTest
|
||||
def test_list_forum_admin_users(self):
|
||||
course = self.toy
|
||||
self.initialize_roles(course.id)
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': course.id})
|
||||
username = 'u2'
|
||||
added_roles = [FORUM_ROLE_STUDENT] # u2 is already added as a student to the discussion forums
|
||||
self.assertTrue(has_forum_access(username, course.id, 'Student'))
|
||||
|
||||
@@ -67,7 +67,7 @@ class TestGradebook(ModuleStoreTestCase):
|
||||
module_state_key=Location(item.location).url()
|
||||
)
|
||||
|
||||
self.response = self.client.get(reverse('gradebook', args=(self.course.id,)))
|
||||
self.response = self.client.get(reverse('gradebook_legacy', args=(self.course.id,)))
|
||||
|
||||
def test_response_code(self):
|
||||
self.assertEquals(self.response.status_code, 200)
|
||||
|
||||
@@ -45,7 +45,7 @@ class TestRawGradeCSV(TestSubmittingProblems):
|
||||
resp = self.submit_question_answer('p2', {'2_1': 'Correct'})
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id})
|
||||
msg = "url = {0}\n".format(url)
|
||||
response = self.client.post(url, {'action': 'Download CSV of all RAW grades'})
|
||||
msg += "instructor dashboard download raw csv grades: response = '{0}'\n".format(response)
|
||||
|
||||
@@ -53,7 +53,7 @@ class InstructorResetStudentStateTest(ModuleStoreTestCase, LoginEnrollmentTestCa
|
||||
sub_api.set_score(submission['uuid'], 1, 2)
|
||||
|
||||
# Delete student state using the instructor dash
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': self.course.id})
|
||||
url = reverse('instructor_dashboard_legacy', kwargs={'course_id': self.course.id})
|
||||
response = self.client.post(url, {
|
||||
'action': 'Delete student state for module',
|
||||
'unique_student_identifier': self.student.email,
|
||||
|
||||
@@ -1053,7 +1053,10 @@ def send_email(request, course_id):
|
||||
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
|
||||
instructor_task.api.submit_bulk_course_email(request, course_id, email.id) # pylint: disable=E1101
|
||||
|
||||
response_payload = {'course_id': course_id}
|
||||
response_payload = {
|
||||
'course_id': course_id,
|
||||
'success': True,
|
||||
}
|
||||
return JsonResponse(response_payload)
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ def instructor_dashboard_2(request, course_id):
|
||||
|
||||
context = {
|
||||
'course': course,
|
||||
'old_dashboard_url': reverse('instructor_dashboard_2', kwargs={'course_id': course_id}),
|
||||
'old_dashboard_url': reverse('instructor_dashboard_legacy', kwargs={'course_id': course_id}),
|
||||
'studio_url': studio_url,
|
||||
'sections': sections,
|
||||
'disable_buttons': disable_buttons,
|
||||
@@ -257,6 +257,7 @@ def _section_metrics(course_id, access):
|
||||
}
|
||||
return section_data
|
||||
|
||||
|
||||
#---- Gradebook (shown to small courses only) ----
|
||||
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
|
||||
def spoc_gradebook(request, course_id):
|
||||
|
||||
@@ -949,7 +949,7 @@ def instructor_dashboard(request, course_id):
|
||||
'metrics_results': metrics_results,
|
||||
}
|
||||
|
||||
context['beta_dashboard_url'] = reverse('instructor_dashboard', kwargs={'course_id': course_id})
|
||||
context['standard_dashboard_url'] = reverse('instructor_dashboard', kwargs={'course_id': course_id})
|
||||
|
||||
return render_to_response('courseware/instructor_dashboard.html', context)
|
||||
|
||||
|
||||
@@ -120,21 +120,12 @@ function goto( mode)
|
||||
<section class="container">
|
||||
<div class="instructor-dashboard-wrapper">
|
||||
|
||||
<div class="beta-button-wrapper"><a href="${ beta_dashboard_url }">${_("Back To Standard Dashboard")}</a></div>
|
||||
|
||||
%if studio_url:
|
||||
## not checking access because if user can see this, they are at least course staff (with studio edit access)
|
||||
<div class="studio-edit-link"><a href="${studio_url}" target="_blank">${_('Edit Course In Studio')}</a></div>
|
||||
%endif
|
||||
|
||||
<section class="instructor-dashboard-content" id="instructor-dashboard-content">
|
||||
<div class="wrap-instructor-info studio-view beta-button-wrapper">
|
||||
%if studio_url:
|
||||
<a class="instructor-info-action" href="${studio_url}">${_("View Course in Studio")}</a>
|
||||
%endif
|
||||
%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'):
|
||||
<a class="instructor-info-action beta-button" href="${ beta_dashboard_url }">${_("Try New Beta Dashboard")}</a>
|
||||
%endif
|
||||
<a class="instructor-info-action beta-button" href="${ standard_dashboard_url }">${_("Back To Standard Dashboard")}</a>
|
||||
</div>
|
||||
|
||||
<h1>${_("Instructor Dashboard")}</h1>
|
||||
@@ -142,7 +133,7 @@ function goto( mode)
|
||||
<div class="wrapper-msg urgency-low warning">
|
||||
<div class="msg""
|
||||
<p>${_("You are using the legacy instructor dashboard, which will be going away in the near future. Please use the Standard Dashboard. If it is missing functionality, please let us know.")}
|
||||
<a href="${ beta_dashboard_url }">${_("Return to the Standard Dashboard")} <i class="icon-angle-right"></i></a></p>
|
||||
<a href="${ standard_dashboard_url }">${_("Return to the Standard Dashboard")} <i class="icon-angle-right"></i></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -204,11 +195,11 @@ function goto( mode)
|
||||
% endif
|
||||
|
||||
<p>
|
||||
<a href="${reverse('gradebook', kwargs=dict(course_id=course.id))}" class="${'is-disabled' if disable_buttons else ''}">${_("Gradebook")}</a>
|
||||
<a href="${reverse('gradebook_legacy', kwargs=dict(course_id=course.id))}" class="${'is-disabled' if disable_buttons else ''}">${_("Gradebook")}</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="${reverse('grade_summary', kwargs=dict(course_id=course.id))}" class="${'is-disabled' if disable_buttons else ''}">${_("Grade summary")}</a>
|
||||
<a href="${reverse('grade_summary_legacy', kwargs=dict(course_id=course.id))}" class="${'is-disabled' if disable_buttons else ''}">${_("Grade summary")}</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
16
lms/urls.py
16
lms/urls.py
@@ -269,9 +269,9 @@ if settings.COURSEWARE_ENABLED:
|
||||
'courseware.views.progress', name="student_progress"),
|
||||
|
||||
# For the instructor
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/instructor_dashboard$',
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/instructor$',
|
||||
'instructor.views.instructor_dashboard.instructor_dashboard_2', name="instructor_dashboard"),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/instructor_dashboard/api/',
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/instructor/api/',
|
||||
include('instructor.views.api_urls')),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/gradebook$',
|
||||
'instructor.views.instructor_dashboard.spoc_gradebook', name='spoc_gradebook'),
|
||||
@@ -367,12 +367,12 @@ if settings.COURSEWARE_ENABLED:
|
||||
|
||||
if settings.COURSEWARE_ENABLED and settings.FEATURES.get('ENABLE_INSTRUCTOR_LEGACY_DASHBOARD'):
|
||||
urlpatterns += (
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/gradebook$',
|
||||
'instructor.views.legacy.gradebook', name='gradebook'),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/grade_summary$',
|
||||
'instructor.views.legacy.grade_summary', name='grade_summary'),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/instructor$',
|
||||
'instructor.views.legacy.instructor_dashboard', name="instructor_dashboard_2"),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/legacy_gradebook$',
|
||||
'instructor.views.legacy.gradebook', name='gradebook_legacy'),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/legacy_grade_summary$',
|
||||
'instructor.views.legacy.grade_summary', name='grade_summary_legacy'),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/legacy_instructor_dash$',
|
||||
'instructor.views.legacy.instructor_dashboard', name="instructor_dashboard_legacy"),
|
||||
)
|
||||
|
||||
if settings.FEATURES.get('CLASS_DASHBOARD'):
|
||||
|
||||
Reference in New Issue
Block a user