mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
Normalize legacy SSO icon values before validation (#955)
This commit is contained in:
@@ -232,6 +232,38 @@ class SsoProviderTest < ActiveSupport::TestCase
|
||||
assert_equal 1, oidc_providers.count
|
||||
end
|
||||
|
||||
|
||||
|
||||
test "normalizes icon by stripping whitespace before validation" do
|
||||
provider = SsoProvider.new(
|
||||
strategy: "openid_connect",
|
||||
name: "icon_normalized",
|
||||
label: "Icon Normalized",
|
||||
icon: " key ",
|
||||
issuer: "https://test.example.com",
|
||||
client_id: "test_client",
|
||||
client_secret: "test_secret"
|
||||
)
|
||||
|
||||
assert provider.valid?
|
||||
assert_equal "key", provider.icon
|
||||
end
|
||||
|
||||
test "normalizes whitespace-only icon to nil" do
|
||||
provider = SsoProvider.new(
|
||||
strategy: "openid_connect",
|
||||
name: "icon_nil",
|
||||
label: "Icon Nil",
|
||||
icon: " ",
|
||||
issuer: "https://test.example.com",
|
||||
client_id: "test_client",
|
||||
client_secret: "test_secret"
|
||||
)
|
||||
|
||||
assert provider.valid?
|
||||
assert_nil provider.icon
|
||||
end
|
||||
|
||||
test "to_omniauth_config returns correct hash" do
|
||||
provider = SsoProvider.create!(
|
||||
strategy: "openid_connect",
|
||||
|
||||
Reference in New Issue
Block a user