diff --git a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py index 0439c25e13..2fad82fdd6 100644 --- a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py +++ b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py @@ -13,12 +13,13 @@ from courseware.tabs import get_course_tab_list from courseware.tests.factories import UserFactory from courseware.tests.helpers import LoginEnrollmentTestCase -from student.tests.factories import AdminFactory, UserFactory +from student.tests.factories import AdminFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory from shoppingcart.models import PaidCourseRegistration, Order, CourseRegCodeItem from course_modes.models import CourseMode from student.roles import CourseFinanceAdminRole +from student.models import CourseEnrollment @ddt.ddt @@ -117,10 +118,26 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertTrue('Verified' in response.content) self.assertTrue('Audit' in response.content) self.assertTrue('Honor' in response.content) + self.assertTrue('Professional' in response.content) # dashboard link hidden self.assertFalse(self.get_dashboard_enrollment_message() in response.content) + @patch.dict(settings.FEATURES, {'DISPLAY_ANALYTICS_ENROLLMENTS': True}) + @override_settings(ANALYTICS_DASHBOARD_URL='') + def test_show_enrollment_data_for_prof_ed(self): + # Create both "professional" (meaning professional + verification) + # and "no-id-professional" (meaning professional without verification) + # These should be aggregated for display purposes. + users = [UserFactory() for _ in range(2)] + CourseEnrollment.enroll(users[0], self.course.id, mode="professional") + CourseEnrollment.enroll(users[1], self.course.id, mode="no-id-professional") + + response = self.client.get(self.url) + + # Check that the number of professional enrollments is two + self.assertContains(response, "Professional2") + @patch.dict(settings.FEATURES, {'DISPLAY_ANALYTICS_ENROLLMENTS': False}) @override_settings(ANALYTICS_DASHBOARD_URL='http://example.com') @override_settings(ANALYTICS_DASHBOARD_NAME='Example') @@ -134,6 +151,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertFalse('Verified' in response.content) self.assertFalse('Audit' in response.content) self.assertFalse('Honor' in response.content) + self.assertFalse('Professional' in response.content) # link to dashboard shown expected_message = self.get_dashboard_enrollment_message() diff --git a/lms/templates/instructor/instructor_dashboard_2/course_info.html b/lms/templates/instructor/instructor_dashboard_2/course_info.html index 2a59718c2c..22cce25f6f 100644 --- a/lms/templates/instructor/instructor_dashboard_2/course_info.html +++ b/lms/templates/instructor/instructor_dashboard_2/course_info.html @@ -20,6 +20,9 @@ ${_("Honor")}${modes['honor']} + + ${_("Professional")}${modes['professional'] + modes['no-id-professional']} + ${_("Total")}${modes['total']}