Last active
July 20, 2024 20:02
-
-
Save njwest/5a74aee8846873608b4dbda826e952cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ...code omitted | |
import ExUnit.CaptureLog | |
# ...code omitted | |
test "allow_login_attempt?/2 returns false with a warning log when over the login attempt limit" do | |
assert RateLimiter.allow_login_attempt?(@test_email, @limit) == true | |
assert RateLimiter.allow_login_attempt?(@test_email, @limit) == true | |
log = capture_log(fn -> | |
assert RateLimiter.allow_login_attempt?(@test_email, @limit) == false | |
end) | |
assert log =~ "Login attempt limit exceeded for email: #{@test_email}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment