fix: also filter for show_dashboard for instructor (#34949)
* fix: also filter for show_dashboard for instructor * temp: attempting to craft tests * chore: lint * test: fixed xblock tests
This commit is contained in:
@@ -100,7 +100,6 @@ def register_special_exams(course_key):
|
||||
except ProctoredExamNotFoundException:
|
||||
exam_metadata['course_id'] = str(course_key)
|
||||
exam_metadata['content_id'] = str(timed_exam.location)
|
||||
|
||||
exam_id = create_exam(**exam_metadata)
|
||||
msg = f'Created new timed exam {exam_id}'
|
||||
log.info(msg)
|
||||
|
||||
@@ -3665,6 +3665,47 @@ class TestSpecialExamXBlockInfo(ItemTest):
|
||||
self.course.id, xblock_info["id"]
|
||||
)
|
||||
|
||||
@patch_get_exam_configuration_dashboard_url
|
||||
@patch_does_backend_support_onboarding
|
||||
@patch_get_exam_by_content_id_success
|
||||
@ddt.data(
|
||||
("lti_external", False),
|
||||
("other_proctoring_backend", True),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_support_onboarding_is_correct_depending_on_lti_external(
|
||||
self,
|
||||
external_id,
|
||||
expected_value,
|
||||
mock_get_exam_by_content_id,
|
||||
mock_does_backend_support_onboarding,
|
||||
_mock_get_exam_configuration_dashboard_url,
|
||||
):
|
||||
sequential = BlockFactory.create(
|
||||
parent_location=self.chapter.location,
|
||||
category="sequential",
|
||||
display_name="Test Lesson 1",
|
||||
user_id=self.user.id,
|
||||
is_proctored_enabled=False,
|
||||
is_time_limited=False,
|
||||
is_onboarding_exam=False,
|
||||
)
|
||||
|
||||
# set course.proctoring_provider to lti_external
|
||||
self.course.proctoring_provider = external_id
|
||||
mock_get_exam_by_content_id.return_value = {"external_id": external_id}
|
||||
|
||||
# mock_does_backend_support_onboarding returns True
|
||||
mock_does_backend_support_onboarding.return_value = True
|
||||
sequential = modulestore().get_item(sequential.location)
|
||||
xblock_info = create_xblock_info(
|
||||
sequential,
|
||||
include_child_info=True,
|
||||
include_children_predicate=ALWAYS,
|
||||
course=self.course,
|
||||
)
|
||||
assert xblock_info["supports_onboarding"] is expected_value
|
||||
|
||||
@patch_get_exam_configuration_dashboard_url
|
||||
@patch_does_backend_support_onboarding
|
||||
@patch_get_exam_by_content_id_success
|
||||
|
||||
@@ -1146,7 +1146,7 @@ def create_xblock_info( # lint-amnesty, pylint: disable=too-many-statements
|
||||
"online_proctoring_rules", ""
|
||||
)
|
||||
|
||||
# Only call does_backend_support_onboarding if not using an LTI proctoring provider
|
||||
# Only call does_backend_support_onboarding if not using an LTI proctoring provider
|
||||
if course.proctoring_provider != 'lti_external':
|
||||
supports_onboarding = does_backend_support_onboarding(
|
||||
course.proctoring_provider
|
||||
|
||||
@@ -302,16 +302,20 @@ def _section_special_exams(course, access):
|
||||
proctoring_provider = course.proctoring_provider
|
||||
escalation_email = None
|
||||
mfe_view_url = None
|
||||
show_dashboard = None
|
||||
if proctoring_provider == 'lti_external':
|
||||
mfe_view_url = f'{settings.EXAMS_DASHBOARD_MICROFRONTEND_URL}/course/{course_key}/exams/embed'
|
||||
# NOTE: LTI proctoring doesn't support onboarding. If that changes, this value should change to True.
|
||||
show_onboarding = False
|
||||
# Dashboard should always appear with LTI proctoring
|
||||
show_dashboard = True
|
||||
else:
|
||||
# Only call does_backend_support_onboarding if not using an LTI proctoring provider
|
||||
# Only call does_backend_support_onboarding if not using an LTI proctoring provider
|
||||
show_onboarding = does_backend_support_onboarding(course.proctoring_provider)
|
||||
if proctoring_provider == 'proctortrack':
|
||||
escalation_email = course.proctoring_escalation_email
|
||||
from edx_proctoring.api import is_backend_dashboard_available
|
||||
from edx_proctoring.api import is_backend_dashboard_available
|
||||
show_dashboard = is_backend_dashboard_available(course_key)
|
||||
|
||||
section_data = {
|
||||
'section_key': 'special_exams',
|
||||
@@ -319,7 +323,7 @@ def _section_special_exams(course, access):
|
||||
'access': access,
|
||||
'course_id': course_key,
|
||||
'escalation_email': escalation_email,
|
||||
'show_dashboard': is_backend_dashboard_available(course_key),
|
||||
'show_dashboard': show_dashboard,
|
||||
'show_onboarding': show_onboarding,
|
||||
'mfe_view_url': mfe_view_url,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user