Skip to content

Commit

Permalink
Fix the auto_grading_enabled setting get call
Browse files Browse the repository at this point in the history
Correctly pass the group parameter.
Assert the basic shape of the configuration object.
  • Loading branch information
marcospri committed Sep 3, 2024
1 parent 9c57166 commit 91a8caa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lms/resources/_js_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def enable_file_picker_mode( # noqa: PLR0913
"formFields": form_fields,
"promptForTitle": prompt_for_title,
"autoGradingEnabled": self._application_instance.settings.get(
"auto_grading_enabled", False
"hypothesis", "auto_grading_enabled", False
),
# The "content item selection" that we submit to Canvas's
# content_item_return_url is actually an LTI launch URL with
Expand Down
22 changes: 20 additions & 2 deletions tests/unit/lms/resources/_js_config/__init___test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,25 @@


class TestFilePickerMode:
def test_it(self, js_config, course):
@pytest.mark.parametrize("prompt_for_title", [True, False])
@pytest.mark.parametrize("auto_grading_setting", [True, False])
def test_it(
self,
js_config,
course,
prompt_for_title,
application_instance,
auto_grading_setting,
):
application_instance.settings.set(
"hypothesis", "auto_grading_enabled", auto_grading_setting
)

js_config.enable_file_picker_mode(
sentinel.form_action, sentinel.form_fields, course
sentinel.form_action,
sentinel.form_fields,
course,
prompt_for_title=prompt_for_title,
)
config = js_config.asdict()

Expand All @@ -40,6 +56,8 @@ def test_it(self, js_config, course):
{
"formAction": sentinel.form_action,
"formFields": sentinel.form_fields,
"promptForTitle": prompt_for_title,
"autoGradingEnabled": auto_grading_setting,
}
),
}
Expand Down

0 comments on commit 91a8caa

Please sign in to comment.