Skip to content

Commit

Permalink
fix: allow courses to render with invalid proctoring provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacharis278 committed Oct 1, 2024
1 parent 7443368 commit 4df00ca
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
36 changes: 36 additions & 0 deletions cms/djangoapps/contentstore/views/tests/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -3776,6 +3776,42 @@ def test_xblock_was_never_proctortrack_proctored_exam(
assert xblock_info["was_exam_ever_linked_with_external"] is False
assert mock_get_exam_by_content_id.call_count == 1

@patch_get_exam_configuration_dashboard_url
@patch_does_backend_support_onboarding
@patch_get_exam_by_content_id_success
def test_special_exam_xblock_info_get_dashboard_error(
self,
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=True,
is_time_limited=True,
default_time_limit_minutes=100,
is_onboarding_exam=False,
)
sequential = modulestore().get_item(sequential.location)
mock_get_exam_configuration_dashboard_url.side_effect = Exception("proctoring error")
xblock_info = create_xblock_info(
sequential,
include_child_info=True,
include_children_predicate=ALWAYS,
)

# no errors should be raised and proctoring_exam_configuration_link is None
assert xblock_info["is_proctored_exam"] is True
assert xblock_info["was_exam_ever_linked_with_external"] is True
assert xblock_info["is_time_limited"] is True
assert xblock_info["default_time_limit_minutes"] == 100
assert xblock_info["proctoring_exam_configuration_link"] == None
assert xblock_info["supports_onboarding"] is True
assert xblock_info["is_onboarding_exam"] is False


class TestLibraryXBlockInfo(ModuleStoreTestCase):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1162,11 +1162,16 @@ def create_xblock_info( # lint-amnesty, pylint: disable=too-many-statements

# only call get_exam_configuration_dashboard_url if not using an LTI proctoring provider
if xblock.is_proctored_exam and (course.proctoring_provider != 'lti_external'):
proctoring_exam_configuration_link = (
get_exam_configuration_dashboard_url(
course.id, xblock_info["id"]
try:
proctoring_exam_configuration_link = (
get_exam_configuration_dashboard_url(
course.id, xblock_info["id"]
)
)
except Exception as e:
log.error(
f"Error while getting proctoring exam configuration link: {e}"
)
)

if course.proctoring_provider == "proctortrack":
show_review_rules = SHOW_REVIEW_RULES_FLAG.is_enabled(
Expand Down

0 comments on commit 4df00ca

Please sign in to comment.