forked from AkkomaGang/akkoma
mix format
This commit is contained in:
parent
48d302a60f
commit
ca70d42541
1 changed files with 7 additions and 3 deletions
|
@ -4,15 +4,18 @@ defmodule Pleroma.Web.AkkomaAPI.MetricsControllerTest do
|
||||||
describe "GET /api/v1/akkoma/metrics" do
|
describe "GET /api/v1/akkoma/metrics" do
|
||||||
test "should return metrics when the user has admin:metrics" do
|
test "should return metrics when the user has admin:metrics" do
|
||||||
%{conn: conn} = oauth_access(["admin:metrics"])
|
%{conn: conn} = oauth_access(["admin:metrics"])
|
||||||
resp = conn
|
|
||||||
|> get("/api/v1/akkoma/metrics")
|
resp =
|
||||||
|> text_response(200)
|
conn
|
||||||
|
|> get("/api/v1/akkoma/metrics")
|
||||||
|
|> text_response(200)
|
||||||
|
|
||||||
assert resp =~ "# HELP"
|
assert resp =~ "# HELP"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should not allow users that do not have the admin:metrics scope" do
|
test "should not allow users that do not have the admin:metrics scope" do
|
||||||
%{conn: conn} = oauth_access(["read:metrics"])
|
%{conn: conn} = oauth_access(["read:metrics"])
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> get("/api/v1/akkoma/metrics")
|
|> get("/api/v1/akkoma/metrics")
|
||||||
|> json_response(403)
|
|> json_response(403)
|
||||||
|
@ -21,6 +24,7 @@ test "should not allow users that do not have the admin:metrics scope" do
|
||||||
test "should be disabled by export_prometheus_metrics" do
|
test "should be disabled by export_prometheus_metrics" do
|
||||||
clear_config([:instance, :export_prometheus_metrics], false)
|
clear_config([:instance, :export_prometheus_metrics], false)
|
||||||
%{conn: conn} = oauth_access(["admin:metrics"])
|
%{conn: conn} = oauth_access(["admin:metrics"])
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> get("/api/v1/akkoma/metrics")
|
|> get("/api/v1/akkoma/metrics")
|
||||||
|> response(404)
|
|> response(404)
|
||||||
|
|
Loading…
Reference in a new issue