コード例 #1
0
def test_hash_password_success():
    """ Test hash_password succeeds in a normal situation """

    date_time_provider_instance = FakeDateTimeProvider()
    provider = AuthenticationProvider(date_time_provider_instance)

    secret = "password"
    salt = secrets.token_hex(provider.password_salt_size)
    provider.hash_password(secret, salt, provider.password_hash_function,
                           provider.password_hash_function_parameters)
コード例 #2
0
def test_hash_password_determinist():
    """ Test hash_password returns a determinist result """

    date_time_provider_instance = FakeDateTimeProvider()
    provider = AuthenticationProvider(date_time_provider_instance)

    secret = "password"
    salt = secrets.token_hex(provider.password_salt_size)
    first_password_hash = provider.hash_password(
        secret, salt, provider.password_hash_function,
        provider.password_hash_function_parameters)
    second_password_hash = provider.hash_password(
        secret, salt, provider.password_hash_function,
        provider.password_hash_function_parameters)

    assert first_password_hash == second_password_hash