X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fauth%2Fpleroma_authenticator_test.exs;h=1ba0dfecc53c8e1dfc20ff4252846880b7dcb5b9;hb=ce9514000db1e08a69b8874f21e66261b9261d86;hp=7125c5081d62f2f0eabd807d08384903d38338f0;hpb=f4c2bf0985f3d65d9caa6f02a71c89db9f070fb1;p=akkoma
diff --git a/test/web/auth/pleroma_authenticator_test.exs b/test/web/auth/pleroma_authenticator_test.exs
index 7125c5081..1ba0dfecc 100644
--- a/test/web/auth/pleroma_authenticator_test.exs
+++ b/test/web/auth/pleroma_authenticator_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do
@@ -11,15 +11,20 @@ defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do
setup do
password = "testpassword"
name = "AgentSmith"
- user = insert(:user, nickname: name, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
+ user = insert(:user, nickname: name, password_hash: Pbkdf2.hash_pwd_salt(password))
{:ok, [user: user, name: name, password: password]}
end
- test "get_user/authorization", %{user: user, name: name, password: password} do
+ test "get_user/authorization", %{name: name, password: password} do
+ name = name <> "1"
+ user = insert(:user, nickname: name, password_hash: Bcrypt.hash_pwd_salt(password))
+
params = %{"authorization" => %{"name" => name, "password" => password}}
res = PleromaAuthenticator.get_user(%Plug.Conn{params: params})
- assert {:ok, user} == res
+ assert {:ok, returned_user} = res
+ assert returned_user.id == user.id
+ assert "$pbkdf2" <> _ = returned_user.password_hash
end
test "get_user/authorization with invalid password", %{name: name} do