4b7214e6f689e61108a1294d8f9fadfe3810e8a9
[akkoma] / test / pleroma / web / akkoma_api / metrics_controller_test.exs
1 defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do
2 use Pleroma.Web.ConnCase, async: true
3
4 import Pleroma.Factory
5 alias Pleroma.Akkoma.FrontendSettingsProfile
6
7 describe "GET /api/v1/akkoma/metrics" do
8 test "should return metrics when the user has admin:metrics" do
9 %{conn: conn} = oauth_access(["admin:metrics"])
10 resp = conn
11 |> get("/api/v1/akkoma/metrics")
12 |> text_response(200)
13
14 assert resp =~ "# HELP"
15 end
16
17 test "should not allow users that do not have the admin:metrics scope" do
18 %{conn: conn} = oauth_access(["read:metrics"])
19 resp = conn
20 |> get("/api/v1/akkoma/metrics")
21 |> json_response(403)
22 end
23 end
24 end