Skip to content

Commit

Permalink
Add Plug.BasicAuth exception test (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
thymusvulgaris authored Jun 24, 2024
1 parent 58a6bff commit 27a81cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/plug/basic_auth_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ defmodule Plug.BasicAuthTest do
refute conn.halted
end

test "raises key error when no options are given" do
assert_raise KeyError, fn ->
conn(:get, "/")
|> put_req_header("authorization", encode_basic_auth("hello", "world"))
|> basic_auth()
end
end

test "refutes invalid user and password" do
for {user, pass} <- [{"hello", "wrong"}, {"wrong", "hello"}] do
conn =
Expand Down

0 comments on commit 27a81cb

Please sign in to comment.