X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fplugs%2Foauth_scopes_plug_test.exs;h=edbc942273ef1c54a4d235141deca37ee37b7c37;hb=bb5d0eafa437c9d32cdd8ccdb92b2eabb8ccccf1;hp=1b3aa85b6e3eee68c72d1823b80257cf66101db5;hpb=e8493431bfc16977e43715bf8bdb09ac46580028;p=akkoma diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/plugs/oauth_scopes_plug_test.exs index 1b3aa85b6..edbc94227 100644 --- a/test/plugs/oauth_scopes_plug_test.exs +++ b/test/plugs/oauth_scopes_plug_test.exs @@ -16,6 +16,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 + |> OAuthScopesPlug.skip_plug() + |> 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 @@ -193,7 +205,7 @@ defmodule Pleroma.Plugs.OAuthScopesPlugTest do end describe "transform_scopes/2" do - clear_config([:auth, :enforce_oauth_admin_scope_usage]) + setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage]) setup do {:ok, %{f: &OAuthScopesPlug.transform_scopes/2}}