Skip to content

Commit e359795

Browse files
committed
Remove warnings about test_chttpd_auth_lockout_warning
``` warning: function test_chttpd_auth_lockout_warning/0 is unused │ 48 │ defp test_chttpd_auth_lockout_warning do │ ~ │ └─ test/elixir/test/auth_lockout_test.exs:48:8: AuthLockoutTest (module) ```
1 parent 34af230 commit e359795

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

test/elixir/test/auth_lockout_test.exs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,51 @@ defmodule AuthLockoutTest do
2020
}
2121
]
2222

23-
run_on_modified_server(
24-
server_config,
25-
fn -> test_chttpd_auth_lockout_enforcement() end
26-
)
23+
run_on_modified_server(server_config, &test_chttpd_auth_lockout_enforcement/0)
24+
end
25+
26+
test "do not lockout after multiple failed authentications", _context do
27+
server_config = [
28+
%{
29+
:section => "chttpd_auth_lockout",
30+
:key => "mode",
31+
:value => "warn"
32+
}
33+
]
34+
35+
run_on_modified_server(server_config, &test_chttpd_auth_lockout_warning/0)
2736
end
2837

2938
defp test_chttpd_auth_lockout_enforcement do
3039
# exceed the lockout threshold
3140
for _n <- 1..5 do
3241
resp = Couch.get("/_all_dbs",
3342
no_auth: true,
34-
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
35-
)
43+
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
44+
)
45+
3646
assert resp.status_code == 401
3747
end
3848

3949
# locked out?
4050
resp = Couch.get("/_all_dbs",
4151
no_auth: true,
42-
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
52+
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
4353
)
54+
4455
assert resp.status_code == 403
4556
assert resp.body["reason"] == "Account is temporarily locked due to multiple authentication failures"
4657
end
4758

4859
defp test_chttpd_auth_lockout_warning do
4960
# exceed the lockout threshold
50-
for _n <- 1..5 do
61+
for _n <- 1..6 do
5162
resp = Couch.get("/_all_dbs",
5263
no_auth: true,
53-
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
54-
)
64+
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
65+
)
66+
5567
assert resp.status_code == 401
5668
end
57-
58-
# warning?
59-
_resp = Couch.get("/_all_dbs",
60-
no_auth: true,
61-
headers: [authorization: "Basic #{:base64.encode("chttpd_auth_lockout:baz")}"]
62-
)
6369
end
6470
end

0 commit comments

Comments
 (0)