1 defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do
2 use Pleroma.Web.ConnCase, async: true
4 describe "GET /api/v1/akkoma/metrics" do
5 test "should return metrics when the user has admin:metrics" do
6 %{conn: conn} = oauth_access(["admin:metrics"])
10 |> get("/api/v1/akkoma/metrics")
13 assert resp =~ "# HELP"
16 test "should not allow users that do not have the admin:metrics scope" do
17 %{conn: conn} = oauth_access(["read:metrics"])
20 |> get("/api/v1/akkoma/metrics")
24 test "should be disabled by export_prometheus_metrics" do
25 clear_config([:instance, :export_prometheus_metrics], false)
26 %{conn: conn} = oauth_access(["admin:metrics"])
29 |> get("/api/v1/akkoma/metrics")