Skip to content

Commit fc55b6e

Browse files
committed
Merge branch 'master' into 'ttqureshi/enable-html'
2 parents ff1d7e9 + 0481d9a commit fc55b6e

File tree

30 files changed

+388
-163
lines changed

30 files changed

+388
-163
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ swagger: ## generate the swagger.yaml file
3535
extract_translations: ## extract localizable strings from sources
3636
i18n_tool extract --no-segment -v
3737
cd conf/locale/en/LC_MESSAGES && msgcat djangojs.po underscore.po -o djangojs.po
38-
cd conf/locale/en/LC_MESSAGES && msgcat django.po wiki.po edx_proctoring_proctortrack.po mako.po -o django.po
39-
cd conf/locale/en/LC_MESSAGES && rm wiki.po edx_proctoring_proctortrack.po mako.po underscore.po
4038

4139
pull_plugin_translations: ## Pull translations for edx_django_utils.plugins for both lms and cms
4240
python manage.py lms pull_plugin_translations --verbose $(ATLAS_OPTIONS)

cms/djangoapps/contentstore/api/tests/test_validation.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121

2222

2323
@ddt.ddt
24-
@override_settings(PROCTORING_BACKENDS={'DEFAULT': 'proctortrack', 'proctortrack': {}})
24+
@override_settings(
25+
PROCTORING_BACKENDS={
26+
"DEFAULT": "test_proctoring_provider",
27+
"test_proctoring_provider": {"requires_escalation_email": True},
28+
}
29+
)
2530
class CourseValidationViewTest(SharedModuleStoreTestCase, APITestCase):
2631
"""
2732
Test course validation view via a RESTful API
@@ -33,7 +38,7 @@ def setUpClass(cls):
3338
cls.course = CourseFactory.create(
3439
display_name='test course',
3540
run="Testing_course",
36-
proctoring_provider='proctortrack',
41+
proctoring_provider='test_proctoring_provider',
3742
proctoring_escalation_email='[email protected]',
3843
)
3944
cls.course_key = cls.course.id

cms/djangoapps/contentstore/api/views/course_validation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from cms.djangoapps.contentstore.course_info_model import get_course_updates
1010
from cms.djangoapps.contentstore.views.certificates import CertificateManager
11+
from common.djangoapps.util.proctoring import requires_escalation_email
1112
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes
1213
from xmodule.course_metadata_utils import DEFAULT_GRADING_POLICY # lint-amnesty, pylint: disable=wrong-import-order
1314
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
@@ -340,8 +341,8 @@ def _has_grading_policy(self, course): # lint-amnesty, pylint: disable=missing-
340341
return False
341342

342343
def _proctoring_validation(self, course):
343-
# A proctoring escalation email is currently only required for courses using Proctortrack
344+
# A proctoring escalation email is required if 'required_escalation_email' is set on the proctoring backend
344345
return dict(
345-
needs_proctoring_escalation_email=course.proctoring_provider == 'proctortrack',
346+
needs_proctoring_escalation_email=requires_escalation_email(course.proctoring_provider),
346347
has_proctoring_escalation_email=bool(course.proctoring_escalation_email)
347348
)

cms/djangoapps/contentstore/config/waffle.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
f'{WAFFLE_NAMESPACE}.enable_checklists_quality', __name__, LOG_PREFIX
2323
)
2424

25-
SHOW_REVIEW_RULES_FLAG = CourseWaffleFlag( # lint-amnesty, pylint: disable=toggle-missing-annotation
26-
f'{WAFFLE_NAMESPACE}.show_review_rules', __name__, LOG_PREFIX
27-
)
28-
2925

3026
# .. toggle_name: studio.custom_relative_dates
3127
# .. toggle_implementation: CourseWaffleFlag

cms/djangoapps/contentstore/rest_api/v1/serializers/proctoring.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from rest_framework import serializers
66

77
from cms.djangoapps.contentstore.rest_api.serializers.common import ProctoringErrorListSerializer
8-
from xmodule.course_block import get_available_providers
8+
from xmodule.course_block import get_available_providers, get_requires_escalation_email_providers
99

1010

1111
class ProctoredExamSettingsSerializer(serializers.Serializer):
@@ -29,6 +29,9 @@ class ProctoredExamConfigurationSerializer(serializers.Serializer):
2929
""" Serializer for various metadata associated with proctored exam settings. """
3030
proctored_exam_settings = ProctoredExamSettingsSerializer()
3131
available_proctoring_providers = serializers.ChoiceField(get_available_providers())
32+
requires_escalation_email_providers = serializers.ChoiceField(
33+
get_requires_escalation_email_providers()
34+
)
3235
course_start_date = serializers.DateTimeField()
3336

3437

cms/djangoapps/contentstore/rest_api/v1/views/proctoring.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
from cms.djangoapps.contentstore.utils import get_proctored_exam_settings_url
1515
from cms.djangoapps.models.settings.course_metadata import CourseMetadata
1616
from common.djangoapps.student.auth import has_studio_advanced_settings_access
17-
from xmodule.course_block import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order
17+
from xmodule.course_block import (
18+
get_available_providers,
19+
get_requires_escalation_email_providers,
20+
) # lint-amnesty, pylint: disable=wrong-import-order
1821
from openedx.core.djangoapps.course_apps.toggles import exams_ida_enabled
1922
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, verify_course_exists, view_auth_classes
2023
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
@@ -49,7 +52,8 @@ class ProctoredExamSettingsView(APIView):
4952
5053
**Response**
5154
52-
In the case of a 200 response code, the response will proctored exam settings data
55+
In the case of a 200 response code, the response will proctored exam settings data,
56+
list of proctoring backends that have 'requires_escalation_email' set to 'True'
5357
as well as other metadata about the course or the requesting user that are necessary
5458
for rendering the settings page.
5559
@@ -65,7 +69,10 @@ class ProctoredExamSettingsView(APIView):
6569
},
6670
"available_proctoring_providers": [
6771
"mockprock",
68-
"proctortrack"
72+
"software_secure",
73+
],
74+
"requires_escalation_email_providers": [
75+
"software_secure"
6976
],
7077
"course_start_date": "2013-02-05T05:00:00Z",
7178
}
@@ -108,10 +115,15 @@ def get(self, request, course_id):
108115
data['course_start_date'] = course_metadata['start'].get('value')
109116

110117
available_providers = get_available_providers()
118+
requires_escalation_email_providers = (
119+
get_requires_escalation_email_providers()
120+
)
111121
if not exams_ida_enabled(CourseKey.from_string(course_id)):
112122
available_providers.remove('lti_external')
123+
requires_escalation_email_providers.remove('lti_external')
113124

114125
data['available_proctoring_providers'] = available_providers
126+
data['requires_escalation_email_providers'] = requires_escalation_email_providers
115127

116128
serializer = ProctoredExamConfigurationSerializer(data)
117129

cms/djangoapps/contentstore/rest_api/v1/views/tests/test_proctoring.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def get_expected_response_data(
6262
},
6363
"course_start_date": "2030-01-01T00:00:00Z",
6464
"available_proctoring_providers": ["null"],
65+
"requires_escalation_email_providers": [],
6566
}
6667

6768
def make_request(self, course_id=None, data=None):
@@ -100,6 +101,7 @@ def test_providers_with_disabled_lti(self):
100101
},
101102
"course_start_date": "2030-01-01T00:00:00Z",
102103
"available_proctoring_providers": ["null"],
104+
"requires_escalation_email_providers": [],
103105
}
104106
assert response.data == expected_data
105107

@@ -122,6 +124,7 @@ def test_providers_with_enabled_lti(self):
122124
},
123125
"course_start_date": "2030-01-01T00:00:00Z",
124126
"available_proctoring_providers": ["lti_external", "null"],
127+
"requires_escalation_email_providers": ["lti_external"],
125128
}
126129
assert response.data == expected_data
127130

@@ -162,14 +165,17 @@ def test_course_instructor(self, expect_status=status.HTTP_403_FORBIDDEN):
162165
return super().test_course_instructor(expect_status=expect_status)
163166

164167
@override_settings(
165-
PROCTORING_BACKENDS={"DEFAULT": "proctortrack", "proctortrack": {}},
168+
PROCTORING_BACKENDS={
169+
"DEFAULT": "test_proctoring_provider",
170+
"test_proctoring_provider": {"requires_escalation_email": True},
171+
},
166172
)
167173
def test_update_exam_settings_200_escalation_email(self):
168-
"""update exam settings for provider that requires an escalation email (proctortrack)"""
174+
"""update exam settings for provider that requires an escalation email"""
169175
self.client.login(username=self.global_staff.username, password=self.password)
170176
data = self.get_request_data(
171177
enable_proctored_exams=True,
172-
proctoring_provider="proctortrack",
178+
proctoring_provider="test_proctoring_provider",
173179
proctoring_escalation_email="[email protected]",
174180
)
175181
response = self.make_request(data=data)
@@ -182,7 +188,7 @@ def test_update_exam_settings_200_escalation_email(self):
182188
"proctored_exam_settings": {
183189
"enable_proctored_exams": True,
184190
"allow_proctoring_opt_out": True,
185-
"proctoring_provider": "proctortrack",
191+
"proctoring_provider": "test_proctoring_provider",
186192
"proctoring_escalation_email": "[email protected]",
187193
"create_zendesk_tickets": True,
188194
}
@@ -192,7 +198,7 @@ def test_update_exam_settings_200_escalation_email(self):
192198
# course settings have been updated
193199
updated = modulestore().get_item(self.course.location)
194200
assert updated.enable_proctored_exams is True
195-
assert updated.proctoring_provider == "proctortrack"
201+
assert updated.proctoring_provider == "test_proctoring_provider"
196202
assert updated.proctoring_escalation_email == "[email protected]"
197203

198204
@override_settings(
@@ -299,14 +305,17 @@ def test_403_if_instructor_request_includes_opting_out(self):
299305
assert response.status_code == status.HTTP_403_FORBIDDEN
300306

301307
@override_settings(
302-
PROCTORING_BACKENDS={"DEFAULT": "proctortrack", "proctortrack": {}},
308+
PROCTORING_BACKENDS={
309+
"DEFAULT": "test_proctoring_provider",
310+
"test_proctoring_provider": {"requires_escalation_email": True},
311+
},
303312
)
304313
def test_200_for_instructor_request_compatibility(self):
305314
self.client.login(username=self.course_instructor, password=self.password)
306315
data = {
307316
"proctored_exam_settings": {
308317
"enable_proctored_exams": True,
309-
"proctoring_provider": "proctortrack",
318+
"proctoring_provider": "test_proctoring_provider",
310319
"proctoring_escalation_email": "[email protected]",
311320
}
312321
}
@@ -315,16 +324,13 @@ def test_200_for_instructor_request_compatibility(self):
315324

316325
@override_settings(
317326
PROCTORING_BACKENDS={
318-
"DEFAULT": "proctortrack",
319-
"proctortrack": {},
327+
"DEFAULT": "software_secure",
320328
"software_secure": {},
321329
},
322330
)
323331
@patch("logging.Logger.info")
324332
@ddt.data(
325-
("proctortrack", False, False),
326333
("software_secure", True, False),
327-
("proctortrack", True, True),
328334
("software_secure", False, True),
329335
)
330336
@ddt.unpack

0 commit comments

Comments
 (0)