feat!: drop legacy course home view and related code
This was the "outline tab" view of the course. Preceded by the
course info view, succeeded by the MFE outline tab.
In addition to the course home view itself, this drops related
features:
- Legacy version of Course Goals (MFE has a newer implementation)
- Course home in-course search (MFE has no search)
The old course info view and course about views survive for now.
This also drops a few now-unused feature toggles:
- course_experience.latest_update
- course_experience.show_upgrade_msg_on_course_home
- course_experience.upgrade_deadline_message
- course_home.course_home_use_legacy_frontend
With this change, just the progress and courseware tabs are still
supported in legacy form, if you opt-in with waffle flags. The
outline and dates tabs are offered only by the MFE.
AA-798
(This is identical to previous commit be5c1a6, just reintroduced
now that the e2e tests have been fixed)
This commit is contained in:
@@ -10,6 +10,9 @@ from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import now
|
||||
from edx_toggles.toggles.testutils import override_waffle_flag
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from common.djangoapps.student.models import CourseEnrollment, FBEEnrollmentExclusion
|
||||
@@ -21,8 +24,8 @@ from common.djangoapps.student.tests.factories import InstructorFactory
|
||||
from common.djangoapps.student.tests.factories import OrgInstructorFactory
|
||||
from common.djangoapps.student.tests.factories import OrgStaffFactory
|
||||
from common.djangoapps.student.tests.factories import StaffFactory
|
||||
from lms.djangoapps.course_home_api.toggles import COURSE_HOME_USE_LEGACY_FRONTEND
|
||||
from lms.djangoapps.courseware.tests.helpers import MasqueradeMixin
|
||||
from lms.djangoapps.courseware.toggles import COURSEWARE_USE_LEGACY_FRONTEND
|
||||
from lms.djangoapps.discussion.django_comment_client.tests.factories import RoleFactory
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
from openedx.core.djangoapps.course_date_signals.utils import MAX_DURATION, MIN_DURATION
|
||||
@@ -37,14 +40,11 @@ from openedx.features.content_type_gating.helpers import CONTENT_GATING_PARTITIO
|
||||
from openedx.features.course_duration_limits.access import get_user_course_expiration_date
|
||||
from openedx.features.course_duration_limits.models import CourseDurationLimitConfig
|
||||
from openedx.features.course_experience.tests.views.helpers import add_course_mode
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
# pylint: disable=no-member
|
||||
@ddt.ddt
|
||||
@override_waffle_flag(COURSE_HOME_USE_LEGACY_FRONTEND, active=True)
|
||||
@override_waffle_flag(COURSEWARE_USE_LEGACY_FRONTEND, active=True)
|
||||
class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
"""Tests to verify the get_user_course_expiration_date function is working correctly"""
|
||||
def setUp(self):
|
||||
@@ -52,6 +52,21 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
self.course = CourseFactory(
|
||||
start=now() - timedelta(weeks=10),
|
||||
)
|
||||
self.chapter = ItemFactory.create(
|
||||
category='chapter',
|
||||
parent_location=self.course.location,
|
||||
display_name='Test Chapter'
|
||||
)
|
||||
self.sequential = ItemFactory.create(
|
||||
category='sequential',
|
||||
parent_location=self.chapter.location,
|
||||
display_name='Test Sequential'
|
||||
)
|
||||
ItemFactory.create(
|
||||
category='vertical',
|
||||
parent_location=self.sequential.location,
|
||||
display_name='Test Vertical'
|
||||
)
|
||||
self.user = UserFactory()
|
||||
self.THREE_YEARS_AGO = now() - timedelta(days=(365 * 3))
|
||||
|
||||
@@ -63,6 +78,18 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
CourseEnrollment.unenroll(self.user, self.course.id)
|
||||
super().tearDown() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def get_courseware(self):
|
||||
"""Returns a response from a GET on a courseware section"""
|
||||
courseware_url = reverse(
|
||||
'courseware_section',
|
||||
kwargs={
|
||||
'course_id': str(self.course.id),
|
||||
'chapter': self.chapter.location.block_id,
|
||||
'section': self.sequential.location.block_id,
|
||||
},
|
||||
)
|
||||
return self.client.get(courseware_url, follow=True)
|
||||
|
||||
def test_enrollment_mode(self):
|
||||
"""Tests that verified enrollments do not have an expiration"""
|
||||
CourseEnrollment.enroll(self.user, self.course.id, CourseMode.VERIFIED)
|
||||
@@ -236,8 +263,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
|
||||
self.update_masquerade(**masquerade_config)
|
||||
|
||||
course_home_url = reverse('openedx.course_experience.course_home', args=[str(self.course.id)])
|
||||
response = self.client.get(course_home_url, follow=True)
|
||||
response = self.get_courseware()
|
||||
assert response.status_code == 200
|
||||
self.assertCountEqual(response.redirect_chain, [])
|
||||
banner_text = 'You lose all access to this course, including your progress,'
|
||||
@@ -273,8 +299,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
|
||||
self.update_masquerade(username='audit')
|
||||
|
||||
course_home_url = reverse('openedx.course_experience.course_home', args=[str(self.course.id)])
|
||||
response = self.client.get(course_home_url, follow=True)
|
||||
response = self.get_courseware()
|
||||
assert response.status_code == 200
|
||||
self.assertCountEqual(response.redirect_chain, [])
|
||||
banner_text = 'You lose all access to this course, including your progress,'
|
||||
@@ -309,8 +334,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
|
||||
self.update_masquerade(username='audit')
|
||||
|
||||
course_home_url = reverse('openedx.course_experience.course_home', args=[str(self.course.id)])
|
||||
response = self.client.get(course_home_url, follow=True)
|
||||
response = self.get_courseware()
|
||||
assert response.status_code == 200
|
||||
self.assertCountEqual(response.redirect_chain, [])
|
||||
banner_text = 'This learner does not have access to this course. Their access expired on'
|
||||
@@ -360,8 +384,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
|
||||
self.update_masquerade(username=expired_staff.username)
|
||||
|
||||
course_home_url = reverse('openedx.course_experience.course_home', args=[str(self.course.id)])
|
||||
response = self.client.get(course_home_url, follow=True)
|
||||
response = self.get_courseware()
|
||||
assert response.status_code == 200
|
||||
self.assertCountEqual(response.redirect_chain, [])
|
||||
banner_text = 'This learner does not have access to this course. Their access expired on'
|
||||
@@ -409,8 +432,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin):
|
||||
|
||||
self.update_masquerade(username=expired_staff.username)
|
||||
|
||||
course_home_url = reverse('openedx.course_experience.course_home', args=[str(self.course.id)])
|
||||
response = self.client.get(course_home_url, follow=True)
|
||||
response = self.get_courseware()
|
||||
assert response.status_code == 200
|
||||
self.assertCountEqual(response.redirect_chain, [])
|
||||
banner_text = 'This learner does not have access to this course. Their access expired on'
|
||||
|
||||
Reference in New Issue
Block a user