Commit 5f86df09 by Chris Dodge

allow to turn off prerequisite enforcement

parent e724f625
...@@ -1108,16 +1108,16 @@ def get_student_view(user_id, course_id, content_id, ...@@ -1108,16 +1108,16 @@ def get_student_view(user_id, course_id, content_id,
credit_state = context['credit_state'] credit_state = context['credit_state']
has_mode = _check_eligibility_of_enrollment_mode(credit_state) has_mode = _check_eligibility_of_enrollment_mode(credit_state)
has_prerequisites = False if not has_mode:
if has_mode: return None
has_prerequisites = _check_eligibility_of_prerequisites(credit_state) has_prerequisites = _check_eligibility_of_prerequisites(credit_state)
# see if the user has passed all pre-requisite credit eligibility # see if the user has passed all pre-requisite credit eligibility
# checks, otherwise just show the user the exam unproctored # checks, otherwise just show the user the exam unproctored
if not has_mode or not has_prerequisites: if not has_prerequisites and constants.ENFORCE_PREREQUISITES:
# if we are in the right mode and if we don't have # if we are in the right mode and if we don't have
# pre-requisites, then we implicitly decline the exam # pre-requisites, then we implicitly decline the exam
if has_mode:
attempt = get_exam_attempt(exam_id, user_id) attempt = get_exam_attempt(exam_id, user_id)
if not attempt: if not attempt:
# user hasn't a record of attempt, create one now # user hasn't a record of attempt, create one now
...@@ -1131,9 +1131,6 @@ def get_student_view(user_id, course_id, content_id, ...@@ -1131,9 +1131,6 @@ def get_student_view(user_id, course_id, content_id,
raise_if_not_found=False raise_if_not_found=False
) )
# don't override context, let the courseware show
return None
attempt = get_exam_attempt(exam_id, user_id) attempt = get_exam_attempt(exam_id, user_id)
# if user has declined the attempt, then we don't show the # if user has declined the attempt, then we don't show the
......
...@@ -41,3 +41,9 @@ REQUIRE_FAILURE_SECOND_REVIEWS = ( ...@@ -41,3 +41,9 @@ REQUIRE_FAILURE_SECOND_REVIEWS = (
'REQUIRE_FAILURE_SECOND_REVIEWS' in settings.PROCTORING_SETTINGS 'REQUIRE_FAILURE_SECOND_REVIEWS' in settings.PROCTORING_SETTINGS
else getattr(settings, 'REQUIRE_FAILURE_SECOND_REVIEWS', True) else getattr(settings, 'REQUIRE_FAILURE_SECOND_REVIEWS', True)
) )
ENFORCE_PREREQUISITES = (
settings.PROCTORING_SETTINGS['ENFORCE_PREREQUISITES'] if
'ENFORCE_PREREQUISITES' in settings.PROCTORING_SETTINGS
else False
)
...@@ -724,14 +724,19 @@ class ProctoredExamApiTests(LoggedInTestCase): ...@@ -724,14 +724,19 @@ class ProctoredExamApiTests(LoggedInTestCase):
self.assertIsNone(rendered_response) self.assertIsNone(rendered_response)
@ddt.data( @ddt.data(
('reverification', None, True, True, False), (True, 'reverification', None, True, True, False),
('reverification', 'failed', False, False, True), (True, 'reverification', 'failed', False, False, True),
('reverification', 'failed', False, True, False), (True, 'reverification', 'failed', True, True, False),
('reverification', 'satisfied', True, True, False), (True, 'reverification', 'satisfied', True, True, False),
('grade', 'failed', True, False, False) (True, 'grade', 'failed', True, False, False),
(False, 'reverification', None, True, True, False),
(False, 'reverification', 'failed', True, False, False),
(False, 'reverification', 'failed', True, True, False),
(False, 'reverification', 'satisfied', True, True, False),
(False, 'grade', 'failed', True, False, False),
) )
@ddt.unpack @ddt.unpack
def test_prereq_scenarios(self, namespace, req_status, show_proctored, def test_prereq_scenarios(self, enforce_prereq, namespace, req_status, show_proctored,
pre_create_attempt, mark_as_declined): pre_create_attempt, mark_as_declined):
""" """
This test asserts that proctoring will not be displayed under the following This test asserts that proctoring will not be displayed under the following
...@@ -740,6 +745,7 @@ class ProctoredExamApiTests(LoggedInTestCase): ...@@ -740,6 +745,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
- Verified student has not completed all 'reverification' requirements - Verified student has not completed all 'reverification' requirements
""" """
with patch('edx_proctoring.constants.ENFORCE_PREREQUISITES', enforce_prereq):
exam = get_exam_by_id(self.proctored_exam_id) exam = get_exam_by_id(self.proctored_exam_id)
if pre_create_attempt: if pre_create_attempt:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment