-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AccountControllerTest#test_blocked_ips — Tried setting file times more explicitly so that this test works #962
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -827,12 +827,20 @@ def test_blocked_ips | |
get(:blocked_ips, add_bad: "garbage") | ||
assert_flash_error | ||
|
||
get(:blocked_ips, add_bad: new_ip) | ||
time = 1.minute.ago | ||
File.utime(time.to_time, time.to_time, MO.blocked_ips_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use |
||
get(:blocked_ips, params: { add_bad: new_ip }) | ||
assert_no_flash | ||
assert(time < File.mtime(MO.blocked_ips_file)) | ||
IpStats.reset! | ||
assert_true(IpStats.blocked?(new_ip)) | ||
|
||
get(:blocked_ips, remove_bad: new_ip) | ||
time = 1.minute.ago | ||
File.utime(time.to_time, time.to_time, MO.blocked_ips_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use |
||
get(:blocked_ips, params: { remove_bad: new_ip }) | ||
assert_no_flash | ||
assert(time < File.mtime(MO.blocked_ips_file)) | ||
IpStats.reset! | ||
assert_false(IpStats.blocked?(new_ip)) | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use
to_time
on Date objects, because they know nothing about the time zone in use.