mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +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:
@ -59,6 +59,54 @@ describe Discourse do
|
||||
end
|
||||
end
|
||||
|
||||
context 'authenticators' do
|
||||
it 'returns inbuilt authenticators' do
|
||||
expect(Discourse.authenticators).to match_array(Users::OmniauthCallbacksController::BUILTIN_AUTH)
|
||||
end
|
||||
|
||||
context 'with authentication plugin installed' do
|
||||
let(:plugin_auth_provider) do
|
||||
authenticator_class = Class.new(Auth::Authenticator) do
|
||||
def name
|
||||
'pluginauth'
|
||||
end
|
||||
|
||||
def enabled
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
provider = Plugin::AuthProvider.new
|
||||
provider.authenticator = authenticator_class.new
|
||||
provider
|
||||
end
|
||||
|
||||
before do
|
||||
DiscoursePluginRegistry.register_auth_provider(plugin_auth_provider)
|
||||
end
|
||||
|
||||
after do
|
||||
DiscoursePluginRegistry.reset!
|
||||
end
|
||||
|
||||
it 'returns inbuilt and plugin authenticators' do
|
||||
expect(Discourse.authenticators).to match_array(
|
||||
Users::OmniauthCallbacksController::BUILTIN_AUTH + [plugin_auth_provider.authenticator])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
context 'enabled_authenticators' do
|
||||
it 'only returns enabled authenticators' do
|
||||
expect(Discourse.enabled_authenticators.length).to be(0)
|
||||
expect { SiteSetting.enable_twitter_logins = true }
|
||||
.to change { Discourse.enabled_authenticators.length }.by(1)
|
||||
expect(Discourse.enabled_authenticators.length).to be(1)
|
||||
expect(Discourse.enabled_authenticators.first).to be_instance_of(Auth::TwitterAuthenticator)
|
||||
end
|
||||
end
|
||||
|
||||
context '#site_contact_user' do
|
||||
|
||||
let!(:admin) { Fabricate(:admin) }
|
||||
|
Reference in New Issue
Block a user