aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Suprunenko <suprunenko.s@gmail.com>2019-04-05 22:40:30 +0200
committerSergey Suprunenko <suprunenko.s@gmail.com>2019-04-05 22:48:11 +0200
commite9c075d05c2f11b905d40ed86dd19818acf310ec (patch)
treebe9115012562f6f9d1ad1d2c460a24ce8244329a
parente3ca9f708fdb004771708c06095ed7b7e4cfce4d (diff)
downloadpleroma-e9c075d05c2f11b905d40ed86dd19818acf310ec.tar.gz
Mock :crypt.crypt/2 because otherwise the test fails on Mac OS
-rw-r--r--test/plugs/legacy_authentication_plug_test.exs18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/plugs/legacy_authentication_plug_test.exs b/test/plugs/legacy_authentication_plug_test.exs
index 302662797..8b0b06772 100644
--- a/test/plugs/legacy_authentication_plug_test.exs
+++ b/test/plugs/legacy_authentication_plug_test.exs
@@ -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