show correct course info on instructor dashboard
This commit is contained in:
committed by
Jose Antonio Gonzalez
parent
699683f3f7
commit
53242fdad3
@@ -20,6 +20,7 @@ from courseware.tests.factories import StaffFactory, StudentModuleFactory, UserF
|
||||
from courseware.tests.helpers import LoginEnrollmentTestCase
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from lms.djangoapps.instructor.views.gradebook_api import calculate_page_info
|
||||
from pyquery import PyQuery as pq
|
||||
from shoppingcart.models import CourseRegCodeItem, Order, PaidCourseRegistration
|
||||
from student.models import CourseEnrollment
|
||||
from student.roles import CourseFinanceAdminRole
|
||||
@@ -66,6 +67,12 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
mode_display_name=CourseMode.DEFAULT_MODE.name,
|
||||
min_price=40
|
||||
)
|
||||
self.course_info = CourseFactory.create(
|
||||
org="ACME",
|
||||
number="001",
|
||||
run="2017",
|
||||
name="How to defeat the Road Runner"
|
||||
)
|
||||
self.course_mode.save()
|
||||
# Create instructor account
|
||||
self.instructor = AdminFactory.create()
|
||||
@@ -107,6 +114,44 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
student = UserFactory.create()
|
||||
self.assertFalse(has_instructor_tab(student, self.course))
|
||||
|
||||
@ddt.data(
|
||||
("How to defeat the Road Runner", "2017", "001", "ACME"),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_instructor_course_info(self, display_name, run, number, org):
|
||||
"""
|
||||
Verify that it shows the correct course information
|
||||
"""
|
||||
url = reverse(
|
||||
'instructor_dashboard',
|
||||
kwargs={
|
||||
'course_id': unicode(self.course_info.id)
|
||||
}
|
||||
)
|
||||
|
||||
response = self.client.get(url)
|
||||
content = pq(response.content)
|
||||
|
||||
self.assertEqual(
|
||||
display_name,
|
||||
content('#field-course-display-name b').contents()[0].strip()
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
run,
|
||||
content('#field-course-name b').contents()[0].strip()
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
number,
|
||||
content('#field-course-number b').contents()[0].strip()
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
org,
|
||||
content('#field-course-organization b').contents()[0].strip()
|
||||
)
|
||||
|
||||
def test_student_admin_staff_instructor(self):
|
||||
"""
|
||||
Verify that staff users are not able to see course-wide options, while still
|
||||
|
||||
@@ -441,7 +441,9 @@ def _section_course_info(course, access):
|
||||
'section_display_name': _('Course Info'),
|
||||
'access': access,
|
||||
'course_id': course_key,
|
||||
'course_display_name': course.display_name,
|
||||
'course_display_name': course.display_name_with_default,
|
||||
'course_org': course.display_org_with_default,
|
||||
'course_number': course.display_number_with_default,
|
||||
'has_started': course.has_started(),
|
||||
'has_ended': course.has_ended(),
|
||||
'start_date': course.start,
|
||||
|
||||
@@ -44,24 +44,24 @@ from openedx.core.djangolib.markup import HTML, Text
|
||||
<h4 class="hd hd-4">${_("Basic Course Information")}</h4>
|
||||
|
||||
<ul class="list-input">
|
||||
<li class="field text is-not-editable" id="field-course-organization">
|
||||
<label for="course-organization">${_("Organization:")}</label>
|
||||
<b>${ section_data['course_id'].org}</b>
|
||||
<li class="field text is-not-editable" id="field-course-display-name">
|
||||
<label for="course-display-name">${_("Course Name:")}</label>
|
||||
<b>${ section_data['course_display_name']}</b>
|
||||
</li>
|
||||
|
||||
<li class="field text is-not-editable" id="field-course-name">
|
||||
<label for="course-name">${_("Course Run:")}</label>
|
||||
<b>${ section_data['course_id'].run}</b>
|
||||
</li>
|
||||
|
||||
<li class="field text is-not-editable" id="field-course-number">
|
||||
<label for="course-number">${_("Course Number:")}</label>
|
||||
<b>${ section_data['course_id'].course}</b>
|
||||
<b>${ section_data['course_number']}</b>
|
||||
</li>
|
||||
|
||||
<li class="field text is-not-editable" id="field-course-name">
|
||||
<label for="course-name">${_("Course Name:")}</label>
|
||||
<b>${ section_data['course_id'].run}</b>
|
||||
</li>
|
||||
|
||||
<li class="field text is-not-editable" id="field-course-display-name">
|
||||
<label for="course-display-name">${_("Course Display Name:")}</label>
|
||||
<b>${ section_data['course_display_name']}</b>
|
||||
<li class="field text is-not-editable" id="field-course-organization">
|
||||
<label for="course-organization">${_("Organization:")}</label>
|
||||
<b>${ section_data['course_org']}</b>
|
||||
</li>
|
||||
|
||||
<li class="field text is-not-editable" id="field-course-start-date">
|
||||
|
||||
Reference in New Issue
Block a user