FEATURE: API to create user's associated account (#15737)

Discourse users and associated accounts are created or updated when a
user logins or connects the account using their account preferences.
This new API can be used to create associated accounts and users too,
if necessary.
This commit is contained in:
Dan Ungureanu
2022-03-03 18:17:02 +02:00
committed by GitHub
parent a7db0ce985
commit 39ab14531a
11 changed files with 260 additions and 4 deletions

View File

@ -48,6 +48,15 @@ RSpec.describe Admin::UsersController do
get "/admin/users/#{user.id}.json"
expect(response.status).to eq(200)
end
it 'includes associated accounts' do
user.user_associated_accounts.create!(provider_name: 'pluginauth', provider_uid: 'pluginauth_uid')
get "/admin/users/#{user.id}.json"
expect(response.status).to eq(200)
expect(response.parsed_body['external_ids'].size).to eq(1)
expect(response.parsed_body['external_ids']['pluginauth']).to eq('pluginauth_uid')
end
end
context 'a non-existing user' do