|
|
@ -47,16 +47,18 @@ defmodule Pleroma.Plugs.LegacyAuthenticationPlugTest do
|
|
|
|
|> assign(:auth_user, user)
|
|
|
|
|> assign(:auth_user, user)
|
|
|
|
|
|
|
|
|
|
|
|
conn =
|
|
|
|
conn =
|
|
|
|
with_mock User,
|
|
|
|
with_mocks([
|
|
|
|
|
|
|
|
{:crypt, [], [crypt: fn _password, password_hash -> password_hash end]},
|
|
|
|
|
|
|
|
{User, [],
|
|
|
|
|
|
|
|
[
|
|
|
|
reset_password: fn user, %{password: password, password_confirmation: password} ->
|
|
|
|
reset_password: fn user, %{password: password, password_confirmation: password} ->
|
|
|
|
send(self(), :reset_password)
|
|
|
|
|
|
|
|
{:ok, user}
|
|
|
|
{:ok, user}
|
|
|
|
end do
|
|
|
|
end
|
|
|
|
conn
|
|
|
|
]}
|
|
|
|
|> LegacyAuthenticationPlug.call(%{})
|
|
|
|
]) do
|
|
|
|
|
|
|
|
LegacyAuthenticationPlug.call(conn, %{})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
assert_received :reset_password
|
|
|
|
|
|
|
|
assert conn.assigns.user == user
|
|
|
|
assert conn.assigns.user == user
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|