diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/mfa_test.exs | 5 | ||||
| -rw-r--r-- | test/plugs/authentication_plug_test.exs | 2 | ||||
| -rw-r--r-- | test/support/builders/user_builder.ex | 2 | ||||
| -rw-r--r-- | test/support/factory.ex | 2 | ||||
| -rw-r--r-- | test/web/auth/basic_auth_test.exs | 2 | ||||
| -rw-r--r-- | test/web/auth/pleroma_authenticator_test.exs | 2 | ||||
| -rw-r--r-- | test/web/auth/totp_authenticator_test.exs | 2 | ||||
| -rw-r--r-- | test/web/mongooseim/mongoose_im_controller_test.exs | 4 | ||||
| -rw-r--r-- | test/web/oauth/ldap_authorization_test.exs | 6 | ||||
| -rw-r--r-- | test/web/oauth/mfa_controller_test.exs | 4 | ||||
| -rw-r--r-- | test/web/oauth/oauth_controller_test.exs | 16 | ||||
| -rw-r--r-- | test/web/twitter_api/password_controller_test.exs | 2 | ||||
| -rw-r--r-- | test/web/twitter_api/util_controller_test.exs | 2 | 
13 files changed, 25 insertions, 26 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/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 | 
