summaryrefslogtreecommitdiff
path: root/test/plugs/authentication_plug_test.exs
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-05-16 15:31:11 +0200
committerRoger Braun <roger@rogerbraun.net>2017-05-16 18:19:04 +0200
commit70024632ba32121bd63a439b2d708d4b4ff1a190 (patch)
tree7bcdcf637337997cd17d0d6d38d8bce2a77d4752 /test/plugs/authentication_plug_test.exs
parent423194520e3fd1d2b285e7cf34a8ad7476276f5d (diff)
downloadpleroma-70024632ba32121bd63a439b2d708d4b4ff1a190.tar.gz
pleroma-70024632ba32121bd63a439b2d708d4b4ff1a190.zip
AP refactoring.
Diffstat (limited to 'test/plugs/authentication_plug_test.exs')
-rw-r--r--test/plugs/authentication_plug_test.exs15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/plugs/authentication_plug_test.exs b/test/plugs/authentication_plug_test.exs
index 6f1568ec3..9d6c2cd70 100644
--- a/test/plugs/authentication_plug_test.exs
+++ b/test/plugs/authentication_plug_test.exs
@@ -2,12 +2,13 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do
use Pleroma.Web.ConnCase, async: true
alias Pleroma.Plugs.AuthenticationPlug
+ alias Pleroma.User
defp fetch_nil(_name) do
{:ok, nil}
end
- @user %{
+ @user %User{
id: 1,
name: "dude",
password_hash: Comeonin.Pbkdf2.hashpwsalt("guy")
@@ -129,6 +130,7 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do
assert conn.halted == false
end
end
+
describe "with a user_id in the session for an existing user" do
test "it assigns the user", %{conn: conn} do
opts = %{
@@ -150,4 +152,15 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do
assert conn.halted == false
end
end
+
+ describe "with an assigned user" do
+ test "it does nothing, returning the incoming conn", %{conn: conn} do
+ conn = conn
+ |> assign(:user, @user)
+
+ conn_result = AuthenticationPlug.call(conn, %{})
+
+ assert conn == conn_result
+ end
+ end
end