disable escalation email requirement (#24551)
This commit is contained in:
@@ -36,7 +36,6 @@ from xmodule.fields import Date
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.tabs import InvalidTabsException
|
||||
|
||||
from .utils import AjaxEnabledTestClient, CourseTestCase
|
||||
|
||||
@@ -1386,7 +1385,8 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
'DEFAULT': 'test_proctoring_provider',
|
||||
'test_proctoring_provider': {},
|
||||
'proctortrack': {}
|
||||
}
|
||||
},
|
||||
FEATURES={'ENABLE_EXAM_SETTINGS_HTML_VIEW': True},
|
||||
)
|
||||
@override_waffle_flag(ENABLE_PROCTORING_PROVIDER_OVERRIDES, True)
|
||||
def test_validate_update_requires_escalation_email_for_proctortrack(self, include_blank_email):
|
||||
@@ -1433,7 +1433,8 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
PROCTORING_BACKENDS={
|
||||
'DEFAULT': 'proctortrack',
|
||||
'proctortrack': {}
|
||||
}
|
||||
},
|
||||
FEATURES={'ENABLE_EXAM_SETTINGS_HTML_VIEW': True},
|
||||
)
|
||||
@override_waffle_flag(ENABLE_PROCTORING_PROVIDER_OVERRIDES, True)
|
||||
def test_validate_update_cannot_unset_escalation_email_when_proctortrack_is_provider(self):
|
||||
@@ -1475,6 +1476,31 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
self.assertIn('proctoring_provider', test_model)
|
||||
self.assertIn('proctoring_escalation_email', test_model)
|
||||
|
||||
@override_settings(
|
||||
PROCTORING_BACKENDS={
|
||||
'DEFAULT': 'test_proctoring_provider',
|
||||
'proctortrack': {}
|
||||
}
|
||||
)
|
||||
@override_waffle_flag(ENABLE_PROCTORING_PROVIDER_OVERRIDES, True)
|
||||
def test_validate_update_escalation_email_not_requirement_disabled(self):
|
||||
"""
|
||||
Tests the escalation email is not required if 'ENABLED_EXAM_SETTINGS_HTML_VIEW'
|
||||
setting is not set to True
|
||||
"""
|
||||
json_data = {
|
||||
"proctoring_provider": {"value": 'proctortrack'},
|
||||
}
|
||||
did_validate, errors, test_model = CourseMetadata.validate_and_update_from_json(
|
||||
self.course,
|
||||
json_data,
|
||||
user=self.user
|
||||
)
|
||||
self.assertTrue(did_validate)
|
||||
self.assertEqual(len(errors), 0)
|
||||
self.assertIn('proctoring_provider', test_model)
|
||||
self.assertIn('proctoring_escalation_email', test_model)
|
||||
|
||||
def test_create_zendesk_tickets_present_for_edx_staff(self):
|
||||
"""
|
||||
Tests that create zendesk tickets field is not filtered out when the user is an edX staff member.
|
||||
|
||||
@@ -305,25 +305,27 @@ class CourseMetadata(object):
|
||||
errors.append({'message': message, 'model': proctoring_provider_model})
|
||||
|
||||
# Require a valid escalation email if Proctortrack is chosen as the proctoring provider
|
||||
escalation_email_model = settings_dict.get('proctoring_escalation_email')
|
||||
if escalation_email_model:
|
||||
escalation_email = escalation_email_model.get('value')
|
||||
else:
|
||||
escalation_email = descriptor.proctoring_escalation_email
|
||||
# This requirement will be disabled until release of the new exam settings view
|
||||
if settings.FEATURES.get('ENABLE_EXAM_SETTINGS_HTML_VIEW'):
|
||||
escalation_email_model = settings_dict.get('proctoring_escalation_email')
|
||||
if escalation_email_model:
|
||||
escalation_email = escalation_email_model.get('value')
|
||||
else:
|
||||
escalation_email = descriptor.proctoring_escalation_email
|
||||
|
||||
missing_escalation_email_msg = 'Provider \'{provider}\' requires an exam escalation contact.'
|
||||
if proctoring_provider_model and proctoring_provider_model.get('value') == 'proctortrack':
|
||||
if not escalation_email:
|
||||
message = missing_escalation_email_msg.format(provider=proctoring_provider_model.get('value'))
|
||||
errors.append({'message': message, 'model': proctoring_provider_model})
|
||||
missing_escalation_email_msg = 'Provider \'{provider}\' requires an exam escalation contact.'
|
||||
if proctoring_provider_model and proctoring_provider_model.get('value') == 'proctortrack':
|
||||
if not escalation_email:
|
||||
message = missing_escalation_email_msg.format(provider=proctoring_provider_model.get('value'))
|
||||
errors.append({'message': message, 'model': proctoring_provider_model})
|
||||
|
||||
if (
|
||||
escalation_email_model and not proctoring_provider_model and
|
||||
descriptor.proctoring_provider == 'proctortrack'
|
||||
):
|
||||
if not escalation_email:
|
||||
message = missing_escalation_email_msg.format(provider=descriptor.proctoring_provider)
|
||||
errors.append({'message': message, 'model': escalation_email_model})
|
||||
if (
|
||||
escalation_email_model and not proctoring_provider_model and
|
||||
descriptor.proctoring_provider == 'proctortrack'
|
||||
):
|
||||
if not escalation_email:
|
||||
message = missing_escalation_email_msg.format(provider=descriptor.proctoring_provider)
|
||||
errors.append({'message': message, 'model': escalation_email_model})
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user