コード例 #1
0
def test_correct_email_hash(salt_list):
    """
    Verify that get_retired_username uses the current salt and returns the expected hash.
    """
    email = '*****@*****.**'
    # Valid retired emails for the above email address when using VALID_SALT_LIST_THREE_SALTS.
    valid_retired_emails = [
        user_util.RETIRED_EMAIL_DEFAULT_FMT.format(user_util._compute_retired_hash(email.lower(), salt))
        for salt in salt_list
    ]
    retired_email = user_util.get_retired_email(email, salt_list)
    assert retired_email == valid_retired_emails[-1]
コード例 #2
0
ファイル: test_user_util.py プロジェクト: Jawayria/user-util
def test_correct_external_key_hash(salt_list):
    """
    Verify that get_retired_external_key uses the current salt and returns the expected hash.
    """
    external_key = 'S34839GEF3'
    valid_retired_external_keys = [
        user_util.RETIRED_EXTERNAL_KEY_DEFAULT_FMT.format(
            user_util._compute_retired_hash(external_key.lower(), salt))
        for salt in salt_list
    ]
    retired_email = user_util.get_retired_external_key(external_key, salt_list)
    assert retired_email == valid_retired_external_keys[-1]
コード例 #3
0
def test_correct_username_hash(salt_list):
    """
    Verify that get_retired_username uses the current salt and returns the expected hash.
    """
    username = '******'
    # Valid retired usernames for the above username when using VALID_SALT_LIST_THREE_SALTS.
    valid_retired_usernames = [
        user_util.RETIRED_USERNAME_DEFAULT_FMT.format(user_util._compute_retired_hash(username.lower(), salt))
        for salt in salt_list
    ]
    retired_username = user_util.get_retired_username(username, salt_list)
    assert retired_username == valid_retired_usernames[-1]