Skip to content

Commit

Permalink
Merge pull request #998 from edx/bseverino/convert-onboarding-api-flag
Browse files Browse the repository at this point in the history
[MST-819] Convert onboarding profile API waffle flag to Django setting
  • Loading branch information
bseverino committed Nov 8, 2021
2 parents b530bfc + f1dfb99 commit c06b3b6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[4.7.0] - 2021-11-08
~~~~~~~~~~~~~~~~~~~~
* Convert onboarding profile API waffle flag to Django setting.

[4.6.0] - 2021-11-03
~~~~~~~~~~~~~~~~~~~~
* Remove references to "ready_to_resume" and "resumed" statuses.
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '4.6.0'
__version__ = '4.7.0'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
6 changes: 5 additions & 1 deletion edx_proctoring/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@

PING_FAILURE_PASSTHROUGH_TEMPLATE = 'edx_proctoring.{}_ping_failure_passthrough'

ONBOARDING_PROFILE_API = 'edx_proctoring.onboarding_profile_api'
ONBOARDING_PROFILE_API = (
settings.PROCTORING_SETTINGS['USE_ONBOARDING_PROFILE_API'] if
'USE_ONBOARDING_PROFILE_API' in settings.PROCTORING_SETTINGS
else getattr(settings, 'USE_ONBOARDING_PROFILE_API', False)
)

ONBOARDING_PROFILE_INSTRUCTOR_DASHBOARD_API = 'edx_proctoring.onboarding_profile_instructor_dashboard_api'

Expand Down
22 changes: 8 additions & 14 deletions edx_proctoring/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,8 @@ def test_multiple_onboarding_exams_mixed_favor_currently_available(self):
))
self.assertEqual(response_data['onboarding_release_date'], tomorrow.isoformat())

@patch('edx_proctoring.api.constants.ONBOARDING_PROFILE_API', True)
@patch('logging.Logger.warning')
@patch('edx_proctoring.views.waffle.switch_is_active')
@patch.object(TestBackendProvider, 'get_onboarding_profile_info')
@ddt.data(
(VerificientOnboardingProfileStatus.no_profile, None),
Expand All @@ -1084,8 +1084,7 @@ def test_multiple_onboarding_exams_mixed_favor_currently_available(self):
)
@ddt.unpack
def test_onboarding_with_api_endpoint(self, api_status, attempt_status, mocked_onboarding_api,
mocked_switch_is_active, mock_logger):
mocked_switch_is_active.return_value = True
mock_logger):
set_runtime_service('grades', MockGradesService(rejected_exam_overrides_grade=False))

if attempt_status:
Expand Down Expand Up @@ -1114,11 +1113,10 @@ def test_onboarding_with_api_endpoint(self, api_status, attempt_status, mocked_o
self.assertEqual(response_data['expiration_date'], '2051-05-21')
mock_logger.assert_not_called()

@patch('edx_proctoring.api.constants.ONBOARDING_PROFILE_API', True)
@patch('logging.Logger.error')
@patch('edx_proctoring.views.waffle.switch_is_active')
@patch.object(TestBackendProvider, 'get_onboarding_profile_info')
def test_onboarding_with_differing_data(self, mocked_onboarding_api, mocked_switch_is_active, mock_logger):
mocked_switch_is_active.return_value = True
def test_onboarding_with_differing_data(self, mocked_onboarding_api, mock_logger):
attempt_id = create_exam_attempt(self.onboarding_exam_id, self.user_id, True)
update_attempt_status(attempt_id, ProctoredExamStudentAttemptStatus.submitted)

Expand All @@ -1143,11 +1141,9 @@ def test_onboarding_with_differing_data(self, mocked_onboarding_api, mocked_swit
self.assertEqual(response_data['expiration_date'], '2051-05-21')
mock_logger.assert_called()

@patch('edx_proctoring.views.waffle.switch_is_active')
@patch('edx_proctoring.api.constants.ONBOARDING_PROFILE_API', True)
@patch.object(TestBackendProvider, 'get_onboarding_profile_info')
def test_onboarding_with_api_404(self, mocked_onboarding_api, mocked_switch_is_active):
mocked_switch_is_active.return_value = True

def test_onboarding_with_api_404(self, mocked_onboarding_api):
attempt_id = create_exam_attempt(self.onboarding_exam_id, self.user_id, True)
update_attempt_status(attempt_id, ProctoredExamStudentAttemptStatus.submitted)

Expand All @@ -1159,12 +1155,10 @@ def test_onboarding_with_api_404(self, mocked_onboarding_api, mocked_switch_is_a
)
self.assertEqual(response.status_code, 404)

@patch('edx_proctoring.api.constants.ONBOARDING_PROFILE_API', True)
@patch('logging.Logger.warning')
@patch('edx_proctoring.views.waffle.switch_is_active')
@patch.object(TestBackendProvider, 'get_onboarding_profile_info')
def test_onboarding_with_api_failure(self, mocked_onboarding_api, mocked_switch_is_active, mock_logger):
mocked_switch_is_active.return_value = True

def test_onboarding_with_api_failure(self, mocked_onboarding_api, mock_logger):
attempt_id = create_exam_attempt(self.onboarding_exam_id, self.user_id, True)
update_attempt_status(attempt_id, ProctoredExamStudentAttemptStatus.submitted)

Expand Down
3 changes: 1 addition & 2 deletions edx_proctoring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
update_exam_attempt
)
from edx_proctoring.constants import (
ONBOARDING_PROFILE_API,
ONBOARDING_PROFILE_INSTRUCTOR_DASHBOARD_API,
PING_FAILURE_PASSTHROUGH_TEMPLATE,
REDS_API_REDIRECT
Expand Down Expand Up @@ -602,7 +601,7 @@ def get(self, request): # pylint: disable=too-many-statements
data['onboarding_status'] = onboarding_attempt_data['onboarding_status']
data['expiration_date'] = onboarding_attempt_data['expiration_date']

if waffle.switch_is_active(ONBOARDING_PROFILE_API):
if constants.ONBOARDING_PROFILE_API:
try:
obs_user_id = obscured_user_id(user.id, onboarding_exam.backend)
onboarding_profile_data = backend.get_onboarding_profile_info(course_id, user_id=obs_user_id)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edx/edx-proctoring",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "4.6.0",
"version": "4.7.0",
"main": "edx_proctoring/static/index.js",
"scripts": {
"test": "gulp test"
Expand Down

0 comments on commit c06b3b6

Please sign in to comment.