summaryrefslogtreecommitdiff
path: root/test/plugs/ensure_authenticated_plug_test.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-04-29 11:09:30 +0000
committerlain <lain@soykaf.club>2020-04-29 11:09:30 +0000
commit58fded9858edbeb318dc011cb313e82a86fbafcb (patch)
tree90539822a02e9ff1de91969ad179da907c031b4d /test/plugs/ensure_authenticated_plug_test.exs
parent699fc9569fa06278baaec6804348375cb9891185 (diff)
parent4c0e53367acd74de04de070a5e33380f5e457163 (diff)
downloadpleroma-58fded9858edbeb318dc011cb313e82a86fbafcb.tar.gz
pleroma-58fded9858edbeb318dc011cb313e82a86fbafcb.zip
Merge branch 'automatic-authentication-and-instance-publicity-checks' into 'develop'
Automatic checks of authentication / authorization / instance publicity See merge request pleroma/pleroma!2409
Diffstat (limited to 'test/plugs/ensure_authenticated_plug_test.exs')
-rw-r--r--test/plugs/ensure_authenticated_plug_test.exs16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/plugs/ensure_authenticated_plug_test.exs b/test/plugs/ensure_authenticated_plug_test.exs
index 7f3559b83..689fe757f 100644
--- a/test/plugs/ensure_authenticated_plug_test.exs
+++ b/test/plugs/ensure_authenticated_plug_test.exs
@@ -20,7 +20,7 @@ defmodule Pleroma.Plugs.EnsureAuthenticatedPlugTest do
conn = assign(conn, :user, %User{})
ret_conn = EnsureAuthenticatedPlug.call(conn, %{})
- assert ret_conn == conn
+ refute ret_conn.halted
end
end
@@ -34,20 +34,22 @@ defmodule Pleroma.Plugs.EnsureAuthenticatedPlugTest do
test "it continues if a user is assigned", %{conn: conn, true_fn: true_fn, false_fn: false_fn} do
conn = assign(conn, :user, %User{})
- assert EnsureAuthenticatedPlug.call(conn, if_func: true_fn) == conn
- assert EnsureAuthenticatedPlug.call(conn, if_func: false_fn) == conn
- assert EnsureAuthenticatedPlug.call(conn, unless_func: true_fn) == conn
- assert EnsureAuthenticatedPlug.call(conn, unless_func: false_fn) == conn
+ refute EnsureAuthenticatedPlug.call(conn, if_func: true_fn).halted
+ refute EnsureAuthenticatedPlug.call(conn, if_func: false_fn).halted
+ refute EnsureAuthenticatedPlug.call(conn, unless_func: true_fn).halted
+ refute EnsureAuthenticatedPlug.call(conn, unless_func: false_fn).halted
end
test "it continues if a user is NOT assigned but :if_func evaluates to `false`",
%{conn: conn, false_fn: false_fn} do
- assert EnsureAuthenticatedPlug.call(conn, if_func: false_fn) == conn
+ ret_conn = EnsureAuthenticatedPlug.call(conn, if_func: false_fn)
+ refute ret_conn.halted
end
test "it continues if a user is NOT assigned but :unless_func evaluates to `true`",
%{conn: conn, true_fn: true_fn} do
- assert EnsureAuthenticatedPlug.call(conn, unless_func: true_fn) == conn
+ ret_conn = EnsureAuthenticatedPlug.call(conn, unless_func: true_fn)
+ refute ret_conn.halted
end
test "it halts if a user is NOT assigned and :if_func evaluates to `true`",