mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-20 08:30:59 +00:00
Merge branch 'fix/failed-legacy-test' into 'develop'
Mock :crypt.crypt/2 to pass LegacyAuthenticationPlugTest on Mac OS See merge request pleroma/pleroma!1030
This commit is contained in:
commit
876965a7e7
1 changed files with 10 additions and 8 deletions
|
@ -47,16 +47,18 @@ defmodule Pleroma.Plugs.LegacyAuthenticationPlugTest do
|
|||
|> assign(:auth_user, user)
|
||||
|
||||
conn =
|
||||
with_mock User,
|
||||
reset_password: fn user, %{password: password, password_confirmation: password} ->
|
||||
send(self(), :reset_password)
|
||||
{:ok, user}
|
||||
end do
|
||||
conn
|
||||
|> LegacyAuthenticationPlug.call(%{})
|
||||
with_mocks([
|
||||
{:crypt, [], [crypt: fn _password, password_hash -> password_hash end]},
|
||||
{User, [],
|
||||
[
|
||||
reset_password: fn user, %{password: password, password_confirmation: password} ->
|
||||
{:ok, user}
|
||||
end
|
||||
]}
|
||||
]) do
|
||||
LegacyAuthenticationPlug.call(conn, %{})
|
||||
end
|
||||
|
||||
assert_received :reset_password
|
||||
assert conn.assigns.user == user
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue