feat: prevent name update on photo verification if the name is already updated
MST-1015
This commit is contained in:
@@ -398,10 +398,10 @@ class PhotoVerification(IDVerificationAttempt):
|
||||
they uploaded are good. Note that we don't actually do a submission
|
||||
anywhere yet.
|
||||
"""
|
||||
# At any point prior to this, they can change their names via their
|
||||
# student dashboard. But at this point, we lock the value into the
|
||||
# attempt.
|
||||
self.name = self.user.profile.name # pylint: disable=no-member
|
||||
# If a name is not already set via the verified_name flow,
|
||||
# pick up the profile name at this time.
|
||||
if not self.name:
|
||||
self.name = self.user.profile.name # pylint: disable=no-member
|
||||
self.status = self.STATUS.ready
|
||||
self.save()
|
||||
|
||||
|
||||
@@ -185,6 +185,20 @@ class TestPhotoVerification(TestVerificationBase, MockS3BotoMixin, ModuleStoreTe
|
||||
|
||||
assert 'Clyde ƴ' == attempt.name
|
||||
|
||||
def test_name_preset(self):
|
||||
"""
|
||||
If a name was set when creating the photo verification
|
||||
(from name affirmation / verified name flow) it should not
|
||||
be overwritten by the profile name
|
||||
"""
|
||||
user = UserFactory.create()
|
||||
user.profile.name = "Profile"
|
||||
|
||||
preset_attempt = SoftwareSecurePhotoVerification(user=user)
|
||||
preset_attempt.name = "Preset"
|
||||
preset_attempt.mark_ready()
|
||||
assert "Preset" == preset_attempt.name
|
||||
|
||||
def test_submissions(self):
|
||||
"""Test that we set our status correctly after a submission."""
|
||||
# Basic case, things go well.
|
||||
|
||||
Reference in New Issue
Block a user