projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#3112] Allowed revoking same-user token from any apps. Added tests.
[akkoma]
/
test
/
pleroma
/
web
/
plugs
/
authentication_plug_test.exs
diff --git
a/test/pleroma/web/plugs/authentication_plug_test.exs
b/test/pleroma/web/plugs/authentication_plug_test.exs
index 550543ff25d7e574b5f084b2890e73678f9b39e2..3dedd38b279cb162e763a54d471d1b9946b7fc1f 100644
(file)
--- a/
test/pleroma/web/plugs/authentication_plug_test.exs
+++ b/
test/pleroma/web/plugs/authentication_plug_test.exs
@@
-5,10
+5,10
@@
defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do
use Pleroma.Web.ConnCase, async: true
defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do
use Pleroma.Web.ConnCase, async: true
- alias Pleroma.Plugs.AuthenticationPlug
- alias Pleroma.Plugs.OAuthScopesPlug
- alias Pleroma.Plugs.PlugHelper
alias Pleroma.User
alias Pleroma.User
+ alias Pleroma.Web.Plugs.AuthenticationPlug
+ alias Pleroma.Web.Plugs.OAuthScopesPlug
+ alias Pleroma.Web.Plugs.PlugHelper
import ExUnit.CaptureLog
import Pleroma.Factory
import ExUnit.CaptureLog
import Pleroma.Factory
@@
-48,6
+48,7
@@
defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do
|> AuthenticationPlug.call(%{})
assert conn.assigns.user == conn.assigns.auth_user
|> AuthenticationPlug.call(%{})
assert conn.assigns.user == conn.assigns.auth_user
+ assert conn.assigns.token == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
end
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
end
@@
-62,6
+63,7
@@
defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do
|> AuthenticationPlug.call(%{})
assert conn.assigns.user.id == conn.assigns.auth_user.id
|> AuthenticationPlug.call(%{})
assert conn.assigns.user.id == conn.assigns.auth_user.id
+ assert conn.assigns.token == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
user = User.get_by_id(user.id)
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
user = User.get_by_id(user.id)
@@
-83,6
+85,7
@@
defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do
|> AuthenticationPlug.call(%{})
assert conn.assigns.user.id == conn.assigns.auth_user.id
|> AuthenticationPlug.call(%{})
assert conn.assigns.user.id == conn.assigns.auth_user.id
+ assert conn.assigns.token == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
user = User.get_by_id(user.id)
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
user = User.get_by_id(user.id)
@@
-118,7
+121,7
@@
defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do
"psBWV8gxkGOZWBz$PmfCycChoxeJ3GgGzwvhlgacb9mUoZ.KUXNCssekER4SJ7bOK53uXrHNb2e4i8yPFgSKyzaW9CcmrDXWIEMtD1"
assert capture_log(fn ->
"psBWV8gxkGOZWBz$PmfCycChoxeJ3GgGzwvhlgacb9mUoZ.KUXNCssekER4SJ7bOK53uXrHNb2e4i8yPFgSKyzaW9CcmrDXWIEMtD1"
assert capture_log(fn ->
- refute
Pleroma.Plugs.
AuthenticationPlug.checkpw("password", hash)
+ refute AuthenticationPlug.checkpw("password", hash)
end) =~ "[error] Password hash not recognized"
end
end
end) =~ "[error] Password hash not recognized"
end
end