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:
Isaac Lee
2024-06-18 15:13:01 -04:00
committed by GitHub
parent 6f1701773e
commit 76fbcbe437
4 changed files with 49 additions and 5 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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