discourse/spec/models/api_key_scope_spec.rb
Isaac Janzen 6d27e65d7d
DEV: Add tests for intentional granular API key behavior for /about (#39922)
## 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.
2026-05-12 09:05:11 -05:00

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