diff --git a/test/pleroma/web/akkoma_api/metrics_controller_test.exs b/test/pleroma/web/akkoma_api/metrics_controller_test.exs new file mode 100644 index 000000000..4b7214e6f --- /dev/null +++ b/test/pleroma/web/akkoma_api/metrics_controller_test.exs @@ -0,0 +1,24 @@ +defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do + use Pleroma.Web.ConnCase, async: true + + import Pleroma.Factory + alias Pleroma.Akkoma.FrontendSettingsProfile + + describe "GET /api/v1/akkoma/metrics" do + test "should return metrics when the user has admin:metrics" do + %{conn: conn} = oauth_access(["admin:metrics"]) + resp = conn + |> get("/api/v1/akkoma/metrics") + |> text_response(200) + + assert resp =~ "# HELP" + end + + test "should not allow users that do not have the admin:metrics scope" do + %{conn: conn} = oauth_access(["read:metrics"]) + resp = conn + |> get("/api/v1/akkoma/metrics") + |> json_response(403) + end + end +end diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index 19a7dea60..d3cc0acb2 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -770,7 +770,6 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do app = insert(:oauth_app) oauth_token = insert(:oauth_token, user: user, app: app) redirect_uri = OAuthController.default_redirect_uri(app) - IO.inspect(app) conn = build_conn()