1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Tests.OAuthTestControllerTest do
6 use Pleroma.Web.ConnCase
10 setup %{conn: conn} do
12 conn = assign(conn, :user, user)
13 %{conn: conn, user: user}
16 test "missed_oauth", %{conn: conn} do
19 |> get("/test/authenticated_api/missed_oauth")
25 "Security violation: OAuth scopes check was neither handled nor explicitly skipped."
29 test "skipped_oauth", %{conn: conn} do
31 |> assign(:token, nil)
32 |> get("/test/authenticated_api/skipped_oauth")
36 test "performed_oauth", %{user: user} do
37 %{conn: good_token_conn} = oauth_access(["read"], user: user)
40 |> get("/test/authenticated_api/performed_oauth")
43 %{conn: bad_token_conn} = oauth_access(["follow"], user: user)
46 |> get("/test/authenticated_api/performed_oauth")