Skip to content

Commit

Permalink
Merge pull request #991 from edx/mroytman/MST-1130-remove-verified-na…
Browse files Browse the repository at this point in the history
…me-waffle-flag

feat: Remove Use of Verified Name Enabled Flag
  • Loading branch information
MichaelRoytman authored Nov 1, 2021
2 parents 6612915 + f1b3526 commit 2ace350
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 37 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.5.0] - 2021-11-01
~~~~~~~~~~~~~~~~~~~~
* Remove references to VERIFIED_NAME_FLAG Django waffle flag.

[4.4.1] - 2021-11-01
~~~~~~~~~~~~~~~~~~~~
* Fix version number for previous release
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.4.1'
__version__ = '4.5.0'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
6 changes: 1 addition & 5 deletions edx_proctoring/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,14 +1023,10 @@ def _register_proctored_exam_attempt(user_id, exam_id, exam, attempt_code, revie

def _get_verified_name(user_id, name_affirmation_service):
"""
Get the user's verified name if name affirmation is enabled
and one exists.
Get the user's verified name if one exists.
Returns a verified name object (or None)
"""
if not name_affirmation_service.is_verified_name_enabled():
return None

verified_name = None

user = USER_MODEL.objects.get(id=user_id)
Expand Down
34 changes: 9 additions & 25 deletions edx_proctoring/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,14 +939,8 @@ def test_create_an_exam_attempt(self):
attempt_id = create_exam_attempt(self.proctored_exam_id, self.user_id)
self.assertGreater(attempt_id, 0)

@ddt.data(
(False, False),
(True, False),
(False, True),
(True, True)
)
@ddt.unpack
def test_register_exam_attempt_context(self, verified_name_enabled, has_verified_name):
@ddt.data(True, False)
def test_register_exam_attempt_context(self, has_verified_name):
"""
Test that the backend provider is called with the correct context when
creating an exam attempt.
Expand All @@ -960,12 +954,9 @@ def test_register_exam_attempt_context(self, verified_name_enabled, has_verified
self.user, verified_name='Verified Name', profile_name='Profile Name', status='approved',
)

if verified_name_enabled:
# Verified name should only be used if the feature is enabled
name_affirmation_service.enabled = True
verified_name_obj = name_affirmation_service.get_verified_name(self.user)
if verified_name_obj:
verified_name = verified_name_obj.verified_name
verified_name_obj = name_affirmation_service.get_verified_name(self.user)
if verified_name_obj:
verified_name = verified_name_obj.verified_name

proctored_exam = get_exam_by_id(self.proctored_exam_id)

Expand Down Expand Up @@ -2492,16 +2483,10 @@ def test_update_exam_attempt_resumed(self, from_status):
attempt = get_exam_attempt_by_id(exam_attempt.id)
self.assertEqual(attempt['status'], ProctoredExamStudentAttemptStatus.resumed)

@ddt.data(
(True, True),
(False, True),
(True, False),
(False, False)
)
@ddt.unpack
@ddt.data(True, False)
@patch('edx_proctoring.api.exam_attempt_status_signal.send')
def test_create_and_update_exam_attempt_signal_verified_name(
self, has_verified_name, verified_name_enabled, mock_signal):
self, has_verified_name, mock_signal):
"""
Test that creating and updating a proctored exam attempt status will trigger
a signal emission with correct data
Expand All @@ -2516,9 +2501,8 @@ def test_create_and_update_exam_attempt_signal_verified_name(
name_affirmation_service.create_verified_name(
self.user, verified_name='John Doe', profile_name='Old Name', status='created',
)
if verified_name_enabled:
name_affirmation_service.enabled = True
if has_verified_name and verified_name_enabled:

if has_verified_name:
full_name = 'John Doe'

# Check that signal is sent with verified name when attempt is created
Expand Down
5 changes: 0 additions & 5 deletions edx_proctoring/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,6 @@ class MockNameAffirmationService:
"""Mock Name Affirmation Service"""
def __init__(self):
self.verified_name = None
self.enabled = False

def is_verified_name_enabled(self):
""" Return Mock Enabled Flag"""
return self.enabled

def get_verified_name(self, user, is_verified=False):
""" Return mock VerifiedName """
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.4.1",
"version": "4.5.0",
"main": "edx_proctoring/static/index.js",
"scripts": {
"test": "gulp test"
Expand Down

0 comments on commit 2ace350

Please sign in to comment.