Beispiel #1
0
 def test_name(self):
     """
     Test retrieval of the name
     """
     assert self.name
     name = get_name(self.user.id)
     assert name == self.name
Beispiel #2
0
    def _get_preferred_certificate_name(self, user):
        """
        Copy of `get_preferred_certificate_name` from utils.py - importing it here would introduce
        a circular dependency.
        """
        name_to_use = student_api.get_name(user.id)

        if should_use_verified_name_for_certs(user):
            verified_name_obj = get_verified_name(user, is_verified=True)
            if verified_name_obj:
                name_to_use = verified_name_obj.verified_name

        if not name_to_use:
            name_to_use = ''

        return name_to_use
Beispiel #3
0
def get_preferred_certificate_name(user):
    """
    If the verified name feature is enabled and the user has their preference set to use their
    verified name for certificates, return their verified name. Else, return the user's profile
    name, or an empty string if it doesn't exist.
    """
    name_to_use = student_api.get_name(user.id)

    if is_verified_name_enabled() and should_use_verified_name_for_certs(user):
        verified_name_obj = get_verified_name(user, is_verified=True)
        if verified_name_obj:
            name_to_use = verified_name_obj.verified_name

    if not name_to_use:
        name_to_use = ''

    return name_to_use
Beispiel #4
0
def send_idv_update(sender, instance, **kwargs):  # pylint: disable=unused-argument
    """
    Catches the post save signal from the SoftwareSecurePhotoVerification model, and emits
    another signal with limited information from the model. We are choosing to re-emit a signal
    as opposed to relying only on the post_save signal to avoid the chance that other apps
    import the SoftwareSecurePhotoVerification model.
    """
    # Prioritize pending name change over current profile name, if the user has one
    full_name = get_pending_name_change(instance.user) or get_name(instance.user.id)

    idv_update_signal.send(
        sender='idv_update',
        attempt_id=instance.id,
        user_id=instance.user.id,
        status=instance.status,
        photo_id_name=instance.name,
        full_name=full_name
    )
Beispiel #5
0
 def test_name_missing_profile(self):
     """
     Test retrieval of the name when the user profile doesn't exist
     """
     name = get_name(None)
     assert not name