mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
FIX: Logs api scope not working (#25215)
This commit is contained in:
@ -290,6 +290,27 @@ RSpec.describe Admin::ApiController do
|
||||
expect(scope.allowed_parameters["topic_id"]).to contain_exactly("55")
|
||||
end
|
||||
|
||||
it "creates an scope for /logs" do
|
||||
post "/admin/api/keys.json",
|
||||
params: {
|
||||
key: {
|
||||
description: "logs",
|
||||
scopes: [{ scope_id: "logs:messages" }],
|
||||
},
|
||||
}
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
data = response.parsed_body
|
||||
scope = ApiKeyScope.find_by(api_key_id: data.dig("key", "id"))
|
||||
|
||||
expect(scope.resource).to eq("logs")
|
||||
expect(scope.action).to eq("messages")
|
||||
|
||||
api_key = data.dig("key", "key")
|
||||
post "/logs/messages.json", headers: { "Api-Key": api_key, "Api-Username": "system" }
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "allows multiple parameters separated by a comma" do
|
||||
post "/admin/api/keys.json",
|
||||
params: {
|
||||
|
Reference in New Issue
Block a user