diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-09-23 09:13:23 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-09-23 09:13:23 +0000 |
commit | b4bedfdfb96b603cd3d97c19dccc32b75c1b26ab (patch) | |
tree | 26886325752f0254476944d970bb5ca77404b5ea /spec/requests | |
parent | 03fd5919a393b8784c601c76c3ed65912f4b522a (diff) | |
parent | f60eb60473a1dcfd2b874d5ebac6dca60da7c1ea (diff) | |
download | gitlab-ce-b4bedfdfb96b603cd3d97c19dccc32b75c1b26ab.tar.gz |
Merge branch 'fix-user-identities-api' into 'master'
Fix user identities API
Added ability to update or set the identity of an existing user, like the documentation said it was possible, but actually wasn't.
@DouweM or @stanhu could you please take a look at my code, and see if its sound?
/cc @JobV
See merge request !1398
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/users_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index f9bc63680ba..d26a300ed82 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -7,6 +7,7 @@ describe API::API, api: true do let(:admin) { create(:admin) } let(:key) { create(:key, user: user) } let(:email) { create(:email, user: user) } + let(:omniauth_user) { create(:omniauth_user) } describe "GET /users" do context "when unauthenticated" do @@ -230,6 +231,19 @@ describe API::API, api: true do expect(user.reload.username).to eq(user.username) end + it "should update user's existing identity" do + put api("/users/#{omniauth_user.id}", admin), provider: 'ldapmain', extern_uid: '654321' + expect(response.status).to eq(200) + expect(omniauth_user.reload.identities.first.extern_uid).to eq('654321') + end + + it 'should update user with new identity' do + put api("/users/#{user.id}", admin), provider: 'github', extern_uid: '67890' + expect(response.status).to eq(200) + expect(user.reload.identities.first.extern_uid).to eq('67890') + expect(user.reload.identities.first.provider).to eq('github') + end + it "should update admin status" do put api("/users/#{user.id}", admin), { admin: true } expect(response.status).to eq(200) |