Remove the debugging IO.inspect
[akkoma] / test / plugs / basic_auth_decoder_plug_test.exs
1 defmodule Pleroma.Plugs.BasicAuthDecoderPlugTest do
2 use Pleroma.Web.ConnCase, async: true
3
4 alias Pleroma.Plugs.BasicAuthDecoderPlug
5
6 defp basic_auth_enc(username, password) do
7 "Basic " <> Base.encode64("#{username}:#{password}")
8 end
9
10 test "it puts the decoded credentials into the assigns", %{conn: conn} do
11 header = basic_auth_enc("moonman", "iloverobek")
12
13 conn =
14 conn
15 |> put_req_header("authorization", header)
16 |> BasicAuthDecoderPlug.call(%{})
17
18 assert conn.assigns[:auth_credentials] == %{
19 username: "moonman",
20 password: "iloverobek"
21 }
22 end
23
24 test "without a authorization header it doesn't do anything", %{conn: conn} do
25 ret_conn =
26 conn
27 |> BasicAuthDecoderPlug.call(%{})
28
29 assert conn == ret_conn
30 end
31 end