summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mfa_test.exs5
-rw-r--r--test/plugs/authentication_plug_test.exs2
-rw-r--r--test/support/builders/user_builder.ex2
-rw-r--r--test/support/factory.ex2
-rw-r--r--test/web/auth/basic_auth_test.exs2
-rw-r--r--test/web/auth/pleroma_authenticator_test.exs2
-rw-r--r--test/web/auth/totp_authenticator_test.exs2
-rw-r--r--test/web/mastodon_api/controllers/timeline_controller_test.exs114
-rw-r--r--test/web/mongooseim/mongoose_im_controller_test.exs4
-rw-r--r--test/web/oauth/ldap_authorization_test.exs6
-rw-r--r--test/web/oauth/mfa_controller_test.exs4
-rw-r--r--test/web/oauth/oauth_controller_test.exs16
-rw-r--r--test/web/twitter_api/password_controller_test.exs2
-rw-r--r--test/web/twitter_api/util_controller_test.exs2
14 files changed, 82 insertions, 83 deletions
diff --git a/test/mfa_test.exs b/test/mfa_test.exs
index 94bc48c26..8875cefd9 100644
--- a/test/mfa_test.exs
+++ b/test/mfa_test.exs
@@ -6,7 +6,6 @@ defmodule Pleroma.MFATest do
use Pleroma.DataCase
import Pleroma.Factory
- alias Comeonin.Pbkdf2
alias Pleroma.MFA
describe "mfa_settings" do
@@ -31,8 +30,8 @@ defmodule Pleroma.MFATest do
{:ok, [code1, code2]} = MFA.generate_backup_codes(user)
updated_user = refresh_record(user)
[hash1, hash2] = updated_user.multi_factor_authentication_settings.backup_codes
- assert Pbkdf2.checkpw(code1, hash1)
- assert Pbkdf2.checkpw(code2, hash2)
+ assert Pbkdf2.verify_pass(code1, hash1)
+ assert Pbkdf2.verify_pass(code2, hash2)
end
end
diff --git a/test/plugs/authentication_plug_test.exs b/test/plugs/authentication_plug_test.exs
index 646bda9d3..31e20d726 100644
--- a/test/plugs/authentication_plug_test.exs
+++ b/test/plugs/authentication_plug_test.exs
@@ -16,7 +16,7 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do
user = %User{
id: 1,
name: "dude",
- password_hash: Comeonin.Pbkdf2.hashpwsalt("guy")
+ password_hash: Pbkdf2.hash_pwd_salt("guy")
}
conn =
diff --git a/test/support/builders/user_builder.ex b/test/support/builders/user_builder.ex
index 0d0490714..0c687c029 100644
--- a/test/support/builders/user_builder.ex
+++ b/test/support/builders/user_builder.ex
@@ -7,7 +7,7 @@ defmodule Pleroma.Builders.UserBuilder do
email: "test@example.org",
name: "Test Name",
nickname: "testname",
- password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
+ password_hash: Pbkdf2.hash_pwd_salt("test"),
bio: "A tester.",
ap_id: "some id",
last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second),
diff --git a/test/support/factory.ex b/test/support/factory.ex
index c8c45e2a7..d4284831c 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -29,7 +29,7 @@ defmodule Pleroma.Factory do
name: sequence(:name, &"Test ใƒ†ใ‚นใƒˆ User #{&1}"),
email: sequence(:email, &"user#{&1}@example.com"),
nickname: sequence(:nickname, &"nick#{&1}"),
- password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
+ password_hash: Pbkdf2.hash_pwd_salt("test"),
bio: sequence(:bio, &"Tester Number #{&1}"),
last_digest_emailed_at: NaiveDateTime.utc_now(),
last_refreshed_at: NaiveDateTime.utc_now(),
diff --git a/test/web/auth/basic_auth_test.exs b/test/web/auth/basic_auth_test.exs
index 64f8a6863..bf6e3d2fc 100644
--- a/test/web/auth/basic_auth_test.exs
+++ b/test/web/auth/basic_auth_test.exs
@@ -11,7 +11,7 @@ defmodule Pleroma.Web.Auth.BasicAuthTest do
conn: conn
} do
user = insert(:user)
- assert Comeonin.Pbkdf2.checkpw("test", user.password_hash)
+ assert Pbkdf2.verify_pass("test", user.password_hash)
basic_auth_contents =
(URI.encode_www_form(user.nickname) <> ":" <> URI.encode_www_form("test"))
diff --git a/test/web/auth/pleroma_authenticator_test.exs b/test/web/auth/pleroma_authenticator_test.exs
index 7125c5081..5a421e5ed 100644
--- a/test/web/auth/pleroma_authenticator_test.exs
+++ b/test/web/auth/pleroma_authenticator_test.exs
@@ -11,7 +11,7 @@ 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
diff --git a/test/web/auth/totp_authenticator_test.exs b/test/web/auth/totp_authenticator_test.exs
index e08069490..e502e0ae8 100644
--- a/test/web/auth/totp_authenticator_test.exs
+++ b/test/web/auth/totp_authenticator_test.exs
@@ -34,7 +34,7 @@ defmodule Pleroma.Web.Auth.TOTPAuthenticatorTest do
hashed_codes =
backup_codes
- |> Enum.map(&Comeonin.Pbkdf2.hashpwsalt(&1))
+ |> Enum.map(&Pbkdf2.hash_pwd_salt(&1))
user =
insert(:user,
diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs
index 6d8f81b75..f8b9289f3 100644
--- a/test/web/mastodon_api/controllers/timeline_controller_test.exs
+++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs
@@ -34,7 +34,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
conn
|> assign(:user, user)
|> get("/api/v1/timelines/home")
- |> json_response(200)
+ |> json_response_and_validate_schema(200)
assert Enum.all?(response, fn n ->
get_in(n, ["account", "pleroma", "relationship"]) == %{}
@@ -42,7 +42,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
end
test "the home timeline", %{user: user, conn: conn} do
- uri = "/api/v1/timelines/home?with_relationships=true"
+ uri = "/api/v1/timelines/home?with_relationships=1"
following = insert(:user, nickname: "followed")
third_user = insert(:user, nickname: "repeated")
@@ -53,7 +53,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
ret_conn = get(conn, uri)
- assert Enum.empty?(json_response(ret_conn, :ok))
+ assert Enum.empty?(json_response_and_validate_schema(ret_conn, :ok))
{:ok, _user} = User.follow(user, following)
@@ -78,7 +78,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
"pleroma" => %{"relationship" => %{"following" => true}}
}
}
- ] = json_response(ret_conn, :ok)
+ ] = json_response_and_validate_schema(ret_conn, :ok)
{:ok, _user} = User.follow(third_user, user)
@@ -104,7 +104,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
"pleroma" => %{"relationship" => %{"following" => true}}
}
}
- ] = json_response(ret_conn, :ok)
+ ] = json_response_and_validate_schema(ret_conn, :ok)
end
test "the home timeline when the direct messages are excluded", %{user: user, conn: conn} do
@@ -115,9 +115,9 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
{:ok, private_activity} = CommonAPI.post(user, %{status: ".", visibility: "private"})
- conn = get(conn, "/api/v1/timelines/home", %{"exclude_visibilities" => ["direct"]})
+ conn = get(conn, "/api/v1/timelines/home?exclude_visibilities[]=direct")
- assert status_ids = json_response(conn, :ok) |> Enum.map(& &1["id"])
+ assert status_ids = json_response_and_validate_schema(conn, :ok) |> Enum.map(& &1["id"])
assert public_activity.id in status_ids
assert unlisted_activity.id in status_ids
assert private_activity.id in status_ids
@@ -134,17 +134,17 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
_activity = insert(:note_activity, local: false)
- conn = get(conn, "/api/v1/timelines/public", %{"local" => "False"})
+ conn = get(conn, "/api/v1/timelines/public?local=False")
- assert length(json_response(conn, :ok)) == 2
+ assert length(json_response_and_validate_schema(conn, :ok)) == 2
- conn = get(build_conn(), "/api/v1/timelines/public", %{"local" => "True"})
+ conn = get(build_conn(), "/api/v1/timelines/public?local=True")
- assert [%{"content" => "test"}] = json_response(conn, :ok)
+ assert [%{"content" => "test"}] = json_response_and_validate_schema(conn, :ok)
- conn = get(build_conn(), "/api/v1/timelines/public", %{"local" => "1"})
+ conn = get(build_conn(), "/api/v1/timelines/public?local=1")
- assert [%{"content" => "test"}] = json_response(conn, :ok)
+ assert [%{"content" => "test"}] = json_response_and_validate_schema(conn, :ok)
end
test "the public timeline includes only public statuses for an authenticated user" do
@@ -156,7 +156,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
{:ok, _activity} = CommonAPI.post(user, %{status: "test", visibility: "direct"})
res_conn = get(conn, "/api/v1/timelines/public")
- assert length(json_response(res_conn, 200)) == 1
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 1
end
end
@@ -174,15 +174,15 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
setup do: clear_config([:restrict_unauthenticated, :timelines, :federated], true)
test "if user is unauthenticated", %{conn: conn} do
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "true"})
+ res_conn = get(conn, "/api/v1/timelines/public?local=true")
- assert json_response(res_conn, :unauthorized) == %{
+ assert json_response_and_validate_schema(res_conn, :unauthorized) == %{
"error" => "authorization required for timeline view"
}
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "false"})
+ res_conn = get(conn, "/api/v1/timelines/public?local=false")
- assert json_response(res_conn, :unauthorized) == %{
+ assert json_response_and_validate_schema(res_conn, :unauthorized) == %{
"error" => "authorization required for timeline view"
}
end
@@ -190,11 +190,11 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
test "if user is authenticated" do
%{conn: conn} = oauth_access(["read:statuses"])
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "true"})
- assert length(json_response(res_conn, 200)) == 1
+ res_conn = get(conn, "/api/v1/timelines/public?local=true")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 1
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "false"})
- assert length(json_response(res_conn, 200)) == 2
+ res_conn = get(conn, "/api/v1/timelines/public?local=false")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 2
end
end
@@ -204,24 +204,24 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
setup do: clear_config([:restrict_unauthenticated, :timelines, :local], true)
test "if user is unauthenticated", %{conn: conn} do
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "true"})
+ res_conn = get(conn, "/api/v1/timelines/public?local=true")
- assert json_response(res_conn, :unauthorized) == %{
+ assert json_response_and_validate_schema(res_conn, :unauthorized) == %{
"error" => "authorization required for timeline view"
}
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "false"})
- assert length(json_response(res_conn, 200)) == 2
+ res_conn = get(conn, "/api/v1/timelines/public?local=false")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 2
end
test "if user is authenticated", %{conn: _conn} do
%{conn: conn} = oauth_access(["read:statuses"])
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "true"})
- assert length(json_response(res_conn, 200)) == 1
+ res_conn = get(conn, "/api/v1/timelines/public?local=true")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 1
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "false"})
- assert length(json_response(res_conn, 200)) == 2
+ res_conn = get(conn, "/api/v1/timelines/public?local=false")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 2
end
end
@@ -231,12 +231,12 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
setup do: clear_config([:restrict_unauthenticated, :timelines, :federated], true)
test "if user is unauthenticated", %{conn: conn} do
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "true"})
- assert length(json_response(res_conn, 200)) == 1
+ res_conn = get(conn, "/api/v1/timelines/public?local=true")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 1
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "false"})
+ res_conn = get(conn, "/api/v1/timelines/public?local=false")
- assert json_response(res_conn, :unauthorized) == %{
+ assert json_response_and_validate_schema(res_conn, :unauthorized) == %{
"error" => "authorization required for timeline view"
}
end
@@ -244,11 +244,11 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
test "if user is authenticated", %{conn: _conn} do
%{conn: conn} = oauth_access(["read:statuses"])
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "true"})
- assert length(json_response(res_conn, 200)) == 1
+ res_conn = get(conn, "/api/v1/timelines/public?local=true")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 1
- res_conn = get(conn, "/api/v1/timelines/public", %{"local" => "false"})
- assert length(json_response(res_conn, 200)) == 2
+ res_conn = get(conn, "/api/v1/timelines/public?local=false")
+ assert length(json_response_and_validate_schema(res_conn, 200)) == 2
end
end
@@ -279,7 +279,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
# Only direct should be visible here
res_conn = get(conn_user_two, "api/v1/timelines/direct")
- [status] = json_response(res_conn, :ok)
+ assert [status] = json_response_and_validate_schema(res_conn, :ok)
assert %{"visibility" => "direct"} = status
assert status["url"] != direct.data["id"]
@@ -291,14 +291,14 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
|> assign(:token, insert(:oauth_token, user: user_one, scopes: ["read:statuses"]))
|> get("api/v1/timelines/direct")
- [status] = json_response(res_conn, :ok)
+ [status] = json_response_and_validate_schema(res_conn, :ok)
assert %{"visibility" => "direct"} = status
# Both should be visible here
res_conn = get(conn_user_two, "api/v1/timelines/home")
- [_s1, _s2] = json_response(res_conn, :ok)
+ [_s1, _s2] = json_response_and_validate_schema(res_conn, :ok)
# Test pagination
Enum.each(1..20, fn _ ->
@@ -311,13 +311,14 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
res_conn = get(conn_user_two, "api/v1/timelines/direct")
- statuses = json_response(res_conn, :ok)
+ statuses = json_response_and_validate_schema(res_conn, :ok)
assert length(statuses) == 20
- res_conn =
- get(conn_user_two, "api/v1/timelines/direct", %{max_id: List.last(statuses)["id"]})
+ max_id = List.last(statuses)["id"]
+
+ res_conn = get(conn_user_two, "api/v1/timelines/direct?max_id=#{max_id}")
- [status] = json_response(res_conn, :ok)
+ assert [status] = json_response_and_validate_schema(res_conn, :ok)
assert status["url"] != direct.data["id"]
end
@@ -342,7 +343,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
res_conn = get(conn, "api/v1/timelines/direct")
- [status] = json_response(res_conn, :ok)
+ [status] = json_response_and_validate_schema(res_conn, :ok)
assert status["id"] == direct.id
end
end
@@ -359,7 +360,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
conn = get(conn, "/api/v1/timelines/list/#{list.id}")
- assert [%{"id" => id}] = json_response(conn, :ok)
+ assert [%{"id" => id}] = json_response_and_validate_schema(conn, :ok)
assert id == to_string(activity_two.id)
end
@@ -382,7 +383,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
conn = get(conn, "/api/v1/timelines/list/#{list.id}")
- assert [%{"id" => id}] = json_response(conn, :ok)
+ assert [%{"id" => id}] = json_response_and_validate_schema(conn, :ok)
assert id == to_string(activity_one.id)
end
@@ -399,14 +400,14 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
nconn = get(conn, "/api/v1/timelines/tag/2hu")
- assert [%{"id" => id}] = json_response(nconn, :ok)
+ assert [%{"id" => id}] = json_response_and_validate_schema(nconn, :ok)
assert id == to_string(activity.id)
# works for different capitalization too
nconn = get(conn, "/api/v1/timelines/tag/2HU")
- assert [%{"id" => id}] = json_response(nconn, :ok)
+ assert [%{"id" => id}] = json_response_and_validate_schema(nconn, :ok)
assert id == to_string(activity.id)
end
@@ -418,22 +419,21 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
{:ok, activity_test1} = CommonAPI.post(user, %{status: "#test #test1"})
{:ok, activity_none} = CommonAPI.post(user, %{status: "#test #none"})
- any_test = get(conn, "/api/v1/timelines/tag/test", %{"any" => ["test1"]})
+ any_test = get(conn, "/api/v1/timelines/tag/test?any[]=test1")
- [status_none, status_test1, status_test] = json_response(any_test, :ok)
+ [status_none, status_test1, status_test] = json_response_and_validate_schema(any_test, :ok)
assert to_string(activity_test.id) == status_test["id"]
assert to_string(activity_test1.id) == status_test1["id"]
assert to_string(activity_none.id) == status_none["id"]
- restricted_test =
- get(conn, "/api/v1/timelines/tag/test", %{"all" => ["test1"], "none" => ["none"]})
+ restricted_test = get(conn, "/api/v1/timelines/tag/test?all[]=test1&none[]=none")
- assert [status_test1] == json_response(restricted_test, :ok)
+ assert [status_test1] == json_response_and_validate_schema(restricted_test, :ok)
- all_test = get(conn, "/api/v1/timelines/tag/test", %{"all" => ["none"]})
+ all_test = get(conn, "/api/v1/timelines/tag/test?all[]=none")
- assert [status_none] == json_response(all_test, :ok)
+ assert [status_none] == json_response_and_validate_schema(all_test, :ok)
end
end
end
diff --git a/test/web/mongooseim/mongoose_im_controller_test.exs b/test/web/mongooseim/mongoose_im_controller_test.exs
index 1ac2f2c27..5176cde84 100644
--- a/test/web/mongooseim/mongoose_im_controller_test.exs
+++ b/test/web/mongooseim/mongoose_im_controller_test.exs
@@ -41,13 +41,13 @@ defmodule Pleroma.Web.MongooseIMController do
end
test "/check_password", %{conn: conn} do
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt("cool"))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt("cool"))
_deactivated_user =
insert(:user,
nickname: "konata",
deactivated: true,
- password_hash: Comeonin.Pbkdf2.hashpwsalt("cool")
+ password_hash: Pbkdf2.hash_pwd_salt("cool")
)
res =
diff --git a/test/web/oauth/ldap_authorization_test.exs b/test/web/oauth/ldap_authorization_test.exs
index a8fe8a841..011642c08 100644
--- a/test/web/oauth/ldap_authorization_test.exs
+++ b/test/web/oauth/ldap_authorization_test.exs
@@ -19,7 +19,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do
@tag @skip
test "authorizes the existing user using LDAP credentials" do
password = "testpassword"
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
host = Pleroma.Config.get([:ldap, :host]) |> to_charlist
@@ -104,7 +104,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do
@tag @skip
test "falls back to the default authorization when LDAP is unavailable" do
password = "testpassword"
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
host = Pleroma.Config.get([:ldap, :host]) |> to_charlist
@@ -148,7 +148,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do
@tag @skip
test "disallow authorization for wrong LDAP credentials" do
password = "testpassword"
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
host = Pleroma.Config.get([:ldap, :host]) |> to_charlist
diff --git a/test/web/oauth/mfa_controller_test.exs b/test/web/oauth/mfa_controller_test.exs
index ce4a07320..3c341facd 100644
--- a/test/web/oauth/mfa_controller_test.exs
+++ b/test/web/oauth/mfa_controller_test.exs
@@ -20,7 +20,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do
insert(:user,
multi_factor_authentication_settings: %MFA.Settings{
enabled: true,
- backup_codes: [Comeonin.Pbkdf2.hashpwsalt("test-code")],
+ backup_codes: [Pbkdf2.hash_pwd_salt("test-code")],
totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true}
}
)
@@ -247,7 +247,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do
hashed_codes =
backup_codes
- |> Enum.map(&Comeonin.Pbkdf2.hashpwsalt(&1))
+ |> Enum.map(&Pbkdf2.hash_pwd_salt(&1))
user =
insert(:user,
diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs
index 7a107584d..d389e4ce0 100644
--- a/test/web/oauth/oauth_controller_test.exs
+++ b/test/web/oauth/oauth_controller_test.exs
@@ -311,7 +311,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
app: app,
conn: conn
} do
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt("testpassword"))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt("testpassword"))
registration = insert(:registration, user: nil)
redirect_uri = OAuthController.default_redirect_uri(app)
@@ -342,7 +342,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
app: app,
conn: conn
} do
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt("testpassword"))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt("testpassword"))
registration = insert(:registration, user: nil)
unlisted_redirect_uri = "http://cross-site-request.com"
@@ -750,7 +750,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
test "issues a token for `password` grant_type with valid credentials, with full permissions by default" do
password = "testpassword"
- user = insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
+ user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
@@ -778,7 +778,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
- password_hash: Comeonin.Pbkdf2.hashpwsalt(password),
+ password_hash: Pbkdf2.hash_pwd_salt(password),
multi_factor_authentication_settings: %MFA.Settings{
enabled: true,
totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true}
@@ -887,7 +887,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
password = "testpassword"
{:ok, user} =
- insert(:user, password_hash: Comeonin.Pbkdf2.hashpwsalt(password))
+ insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password))
|> User.confirmation_changeset(need_confirmation: true)
|> User.update_and_set_cache()
@@ -915,7 +915,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
- password_hash: Comeonin.Pbkdf2.hashpwsalt(password),
+ password_hash: Pbkdf2.hash_pwd_salt(password),
deactivated: true
)
@@ -943,7 +943,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
- password_hash: Comeonin.Pbkdf2.hashpwsalt(password),
+ password_hash: Pbkdf2.hash_pwd_salt(password),
password_reset_pending: true
)
@@ -972,7 +972,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
- password_hash: Comeonin.Pbkdf2.hashpwsalt(password),
+ password_hash: Pbkdf2.hash_pwd_salt(password),
confirmation_pending: true
)
diff --git a/test/web/twitter_api/password_controller_test.exs b/test/web/twitter_api/password_controller_test.exs
index 0a24860d3..231a46c67 100644
--- a/test/web/twitter_api/password_controller_test.exs
+++ b/test/web/twitter_api/password_controller_test.exs
@@ -54,7 +54,7 @@ defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do
assert response =~ "<h2>Password changed!</h2>"
user = refresh_record(user)
- assert Comeonin.Pbkdf2.checkpw("test", user.password_hash)
+ assert Pbkdf2.verify_pass("test", user.password_hash)
assert Enum.empty?(Token.get_user_tokens(user))
end
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs
index b701239a0..ad919d341 100644
--- a/test/web/twitter_api/util_controller_test.exs
+++ b/test/web/twitter_api/util_controller_test.exs
@@ -688,7 +688,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
assert json_response(conn, 200) == %{"status" => "success"}
fetched_user = User.get_cached_by_id(user.id)
- assert Comeonin.Pbkdf2.checkpw("newpass", fetched_user.password_hash) == true
+ assert Pbkdf2.verify_pass("newpass", fetched_user.password_hash) == true
end
end