From 649e8b11582de101d5fe38e97dd09c53d11b3f28 Mon Sep 17 00:00:00 2001 From: Simon Chen Date: Wed, 30 Mar 2016 14:25:07 -0400 Subject: [PATCH] ECOM-3673 Update the course end date description text to remove the reference to certificate when course enrollment is in audit mode --- lms/djangoapps/courseware/date_summary.py | 6 +++++- lms/djangoapps/courseware/tests/test_date_summary.py | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/courseware/date_summary.py b/lms/djangoapps/courseware/date_summary.py index b5347d850110..4d9c1b9dc71c 100644 --- a/lms/djangoapps/courseware/date_summary.py +++ b/lms/djangoapps/courseware/date_summary.py @@ -182,7 +182,11 @@ def is_enabled(self): @property def description(self): if datetime.now(pytz.UTC) <= self.date: - return _('To earn a certificate, you must complete all requirements before this date.') + mode, is_active = CourseEnrollment.enrollment_mode_for_user(self.user, self.course.id) + if is_active and CourseMode.is_eligible_for_certificate(mode): + return _('To earn a certificate, you must complete all requirements before this date.') + else: + return _('After this date, course content will be archived.') return _('This course is archived, which means you can review course content but it is no longer active.') @property diff --git a/lms/djangoapps/courseware/tests/test_date_summary.py b/lms/djangoapps/courseware/tests/test_date_summary.py index 1a6f4bb60e34..8682749c70c1 100644 --- a/lms/djangoapps/courseware/tests/test_date_summary.py +++ b/lms/djangoapps/courseware/tests/test_date_summary.py @@ -173,7 +173,7 @@ def test_start_date_render(self): ## CourseEndDate - def test_course_end_date_during_course(self): + def test_course_end_date_for_certificate_eligible_mode(self): self.setup_course_and_user(days_till_start=-1) block = CourseEndDate(self.course, self.user) self.assertEqual( @@ -181,6 +181,14 @@ def test_course_end_date_during_course(self): 'To earn a certificate, you must complete all requirements before this date.' ) + def test_course_end_date_for_non_certificate_eligible_mode(self): + self.setup_course_and_user(days_till_start=-1, enrollment_mode=CourseMode.AUDIT) + block = CourseEndDate(self.course, self.user) + self.assertEqual( + block.description, + 'After this date, course content will be archived.' + ) + def test_course_end_date_after_course(self): self.setup_course_and_user(days_till_start=-2, days_till_end=-1) block = CourseEndDate(self.course, self.user)