add test for metrics controller
ci/woodpecker/push/woodpecker Pipeline is pending Details

This commit is contained in:
FloatingGhost 2022-12-16 10:56:17 +00:00
parent d1a0d93bf7
commit 6d8e4d5e05
2 changed files with 24 additions and 1 deletions

View File

@ -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

View File

@ -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()