X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fplugs%2Foauth_scopes_plug_test.exs;h=d855d4f5420f230c35c3536c8248b6e3d1f6c5b7;hb=862d4886c9c600ff0ff85edc744e3c05a3fcd68d;hp=ce426677b21d7adad190173e4affd6b43f73fcdf;hpb=3849053c6adbb4024e8fbe60e908cb141204f594;p=akkoma diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/plugs/oauth_scopes_plug_test.exs index ce426677b..d855d4f54 100644 --- a/test/plugs/oauth_scopes_plug_test.exs +++ b/test/plugs/oauth_scopes_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors +# Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Plugs.OAuthScopesPlugTest do @@ -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