diff options
author | rinpatch <rinpatch@sdf.org> | 2020-04-16 21:58:57 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-04-16 21:58:57 +0000 |
commit | badd888ccbeed88228c0de66c068812a49139ce3 (patch) | |
tree | 8af60de490fcd43a60f35afe54820d96f86f41b4 /test/plugs/oauth_scopes_plug_test.exs | |
parent | 28bcde5d982ee0cd7bfac68585311661f19de2c4 (diff) | |
parent | bde1189c349dc114aca2e9310dda840a1007825f (diff) | |
download | pleroma-badd888ccbeed88228c0de66c068812a49139ce3.tar.gz pleroma-badd888ccbeed88228c0de66c068812a49139ce3.zip |
Merge branch 'authenticated-api-oauth-check-enforcement' into 'develop'
Enforcement of OAuth scopes check for authenticated API endpoints
See merge request pleroma/pleroma!2349
Diffstat (limited to 'test/plugs/oauth_scopes_plug_test.exs')
-rw-r--r-- | test/plugs/oauth_scopes_plug_test.exs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/plugs/oauth_scopes_plug_test.exs index e79ecf263..abab7abb0 100644 --- a/test/plugs/oauth_scopes_plug_test.exs +++ b/test/plugs/oauth_scopes_plug_test.exs @@ -7,6 +7,7 @@ defmodule Pleroma.Plugs.OAuthScopesPlugTest do alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.Plugs.OAuthScopesPlug + alias Pleroma.Plugs.PlugHelper alias Pleroma.Repo import Mock @@ -16,6 +17,18 @@ defmodule Pleroma.Plugs.OAuthScopesPlugTest do :ok end + test "is not performed if marked as skipped", %{conn: conn} do + with_mock OAuthScopesPlug, [:passthrough], perform: &passthrough([&1, &2]) do + conn = + conn + |> PlugHelper.append_to_skipped_plugs(OAuthScopesPlug) + |> OAuthScopesPlug.call(%{scopes: ["random_scope"]}) + + refute called(OAuthScopesPlug.perform(:_, :_)) + refute conn.halted + end + end + test "if `token.scopes` fulfills specified 'any of' conditions, " <> "proceeds with no op", %{conn: conn} do |