mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 18:11:11 +08:00
FEATURE: List, revoke and reconnect associated accounts. Phase 1 (#6099)
Listing connections is supported for all built-in auth providers. Revoke and reconnect is currently only implemented for Facebook.
This commit is contained in:
@ -38,13 +38,26 @@ RSpec.describe Users::OmniauthCallbacksController do
|
||||
|
||||
let :provider do
|
||||
provider = Plugin::AuthProvider.new
|
||||
provider.authenticator = Auth::OpenIdAuthenticator.new('ubuntu', 'https://login.ubuntu.com', trusted: true)
|
||||
provider.authenticator = Class.new(Auth::Authenticator) do
|
||||
def name
|
||||
'ubuntu'
|
||||
end
|
||||
|
||||
def enabled?
|
||||
SiteSetting.ubuntu_login_enabled
|
||||
end
|
||||
end.new
|
||||
|
||||
provider.enabled_setting = "ubuntu_login_enabled"
|
||||
provider
|
||||
end
|
||||
|
||||
before do
|
||||
Discourse.stubs(:auth_providers).returns [provider]
|
||||
DiscoursePluginRegistry.register_auth_provider(provider)
|
||||
end
|
||||
|
||||
after do
|
||||
DiscoursePluginRegistry.reset!
|
||||
end
|
||||
|
||||
it "finds an authenticator when enabled" do
|
||||
@ -60,14 +73,6 @@ RSpec.describe Users::OmniauthCallbacksController do
|
||||
expect { Users::OmniauthCallbacksController.find_authenticator("ubuntu") }
|
||||
.to raise_error(Discourse::InvalidAccess)
|
||||
end
|
||||
|
||||
it "succeeds if an authenticator does not have a site setting" do
|
||||
provider.enabled_setting = nil
|
||||
SiteSetting.stubs(:ubuntu_login_enabled).returns(false)
|
||||
|
||||
expect(Users::OmniauthCallbacksController.find_authenticator("ubuntu"))
|
||||
.to be(provider.authenticator)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user