add test for metrics controller
This commit is contained in:
parent
d1a0d93bf7
commit
6d8e4d5e05
24
test/pleroma/web/akkoma_api/metrics_controller_test.exs
Normal file
24
test/pleroma/web/akkoma_api/metrics_controller_test.exs
Normal 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
|
|
@ -770,7 +770,6 @@ test "authorize from cookie" 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()
|
||||
|
|
Loading…
Reference in a new issue