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"])
8 |> get("/api/v1/akkoma/metrics")
11 assert resp =~ "# HELP"
14 test "should not allow users that do not have the admin:metrics scope" do
15 %{conn: conn} = oauth_access(["read:metrics"])
17 |> get("/api/v1/akkoma/metrics")
21 test "should be disabled by export_prometheus_metrics" do
22 clear_config([:instance, :export_prometheus_metrics], false)
23 %{conn: conn} = oauth_access(["admin:metrics"])
25 |> get("/api/v1/akkoma/metrics")