def test_hash_token_success(): """ Test hash_token succeeds in a normal situation """ date_time_provider_instance = FakeDateTimeProvider() provider = AuthenticationProvider(date_time_provider_instance) secret = secrets.token_hex(provider.token_size) provider.hash_token(secret, provider.token_hash_function, provider.token_hash_function_parameters)
def test_hash_token_determinist(): """ Test hash_token returns a determinist result """ date_time_provider_instance = FakeDateTimeProvider() provider = AuthenticationProvider(date_time_provider_instance) secret = secrets.token_hex(provider.token_size) first_token_hash = provider.hash_token( secret, provider.token_hash_function, provider.token_hash_function_parameters) second_token_hash = provider.hash_token( secret, provider.token_hash_function, provider.token_hash_function_parameters) assert first_token_hash == second_token_hash