- test "it assigns legacy user", %{conn: conn} do
- opts = %{
- optional: true,
- fetcher: fn _ -> {:ok, @legacy} end,
- update_legacy_password: false
- }
-
- header = basic_auth_enc("dude", "password")
-
- conn =
- conn
- |> Plug.Session.call(Plug.Session.init(@session_opts))
- |> fetch_session
- |> put_req_header("authorization", header)
- |> AuthenticationPlug.call(opts)
-
- assert %{user: @legacy} == conn.assigns
- assert get_session(conn, :user_id) == @legacy.id
- assert conn.halted == false
+ assert AuthenticationPlug.checkpw("test-password", hash)
+ refute AuthenticationPlug.checkpw("test-password1", hash)