mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-14 19:41:29 +08:00
## Summary This patch adds regression tests to ensure that granular API keys can access the /about endpoint when scoped correctly. These tests verify that the endpoint remains accessible for API key validation by external tools, even when site settings like login_required are enabled.
24 lines
681 B
Ruby
24 lines
681 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ApiKeyScope do
|
|
describe ".find_urls" do
|
|
it "should return the right urls" do
|
|
expect(ApiKeyScope.find_urls(actions: ["posts#create"], methods: [])).to contain_exactly(
|
|
"/posts (POST)",
|
|
)
|
|
end
|
|
|
|
it "should return logster urls" do
|
|
expect(ApiKeyScope.find_urls(actions: [Logster::Web], methods: [])).to contain_exactly(
|
|
"/logs/messages.json (POST)",
|
|
"/logs/show/:id.json (GET)",
|
|
)
|
|
end
|
|
end
|
|
|
|
describe ".scope_mappings" do
|
|
it "does not define a granular scope for about requests" do
|
|
expect(described_class.scope_mappings).not_to have_key(:about)
|
|
end
|
|
end
|
|
end
|