feat: only show IDV panel until honor code replaces it
the integrity flag is a course waffle flag so until it's on for everyone this will not be triggered - that's OK and expected MST-1153
This commit is contained in:
@@ -346,6 +346,29 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
|
||||
attempt.save()
|
||||
self._assert_course_verification_status(None)
|
||||
|
||||
@ddt.data(True, False)
|
||||
def test_integrity_disables_sidebar(self, integrity_flag):
|
||||
self._setup_mode_and_enrollment(None, "verified")
|
||||
|
||||
#no sidebar when no IDV yet
|
||||
response = self.client.get(self.dashboard_url)
|
||||
self.assertNotContains(response, "profile-sidebar")
|
||||
|
||||
# The student has an approved verification
|
||||
attempt = SoftwareSecurePhotoVerification.objects.create(user=self.user)
|
||||
attempt.mark_ready()
|
||||
attempt.submit()
|
||||
attempt.approve()
|
||||
|
||||
# sidebar only appears after IDV if integrity is not on
|
||||
with patch('common.djangoapps.student.views.dashboard.is_integrity_signature_enabled',
|
||||
return_value=integrity_flag):
|
||||
response = self.client.get(self.dashboard_url)
|
||||
if integrity_flag:
|
||||
self.assertNotContains(response, "profile-sidebar")
|
||||
else:
|
||||
self.assertContains(response, "profile-sidebar")
|
||||
|
||||
def _setup_mode_and_enrollment(self, deadline, enrollment_mode):
|
||||
"""Create a course mode and enrollment.
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ from lms.djangoapps.commerce.utils import EcommerceService
|
||||
from lms.djangoapps.courseware.access import has_access
|
||||
from lms.djangoapps.experiments.utils import get_dashboard_course_info, get_experiment_user_metadata_context
|
||||
from lms.djangoapps.verify_student.services import IDVerificationService
|
||||
from openedx.core.djangoapps.agreements.toggles import is_integrity_signature_enabled
|
||||
from openedx.core.djangoapps.catalog.utils import (
|
||||
get_programs,
|
||||
get_pseudo_session_for_entitlement,
|
||||
@@ -748,8 +749,17 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem
|
||||
else:
|
||||
redirect_message = ''
|
||||
|
||||
all_integrity_enabled = True
|
||||
if not course_enrollments:
|
||||
all_integrity_enabled = is_integrity_signature_enabled(None)
|
||||
for enrollment in course_enrollments:
|
||||
if not is_integrity_signature_enabled(enrollment.course_id):
|
||||
all_integrity_enabled = False
|
||||
break
|
||||
|
||||
valid_verification_statuses = ['approved', 'must_reverify', 'pending', 'expired']
|
||||
display_sidebar_on_dashboard = verification_status['status'] in valid_verification_statuses and \
|
||||
display_sidebar_on_dashboard = not all_integrity_enabled and \
|
||||
verification_status['status'] in valid_verification_statuses and \
|
||||
verification_status['should_display']
|
||||
|
||||
# Filter out any course enrollment course cards that are associated with fulfilled entitlements
|
||||
|
||||
Reference in New Issue
Block a user