diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-20 09:08:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-20 09:08:32 +0000 |
commit | 2ee5991b42717969af93cb30d863aafab04dff8a (patch) | |
tree | c09c0b7b4d02ceb9d6ac090c1ccfb93effb8a368 /spec/requests/api/users_spec.rb | |
parent | 6b1ba27ef7373815ea29dc5b80eab846c8acd022 (diff) | |
download | gitlab-ce-2ee5991b42717969af93cb30d863aafab04dff8a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r-- | spec/requests/api/users_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 0a22a09b8a6..5af56aa6f75 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -913,6 +913,27 @@ describe API::Users do end end + describe 'GET /user/:user_id/keys' do + it 'returns 404 for non-existing user' do + get api("/users/#{not_existing_user_id}/keys") + + expect(response).to have_gitlab_http_status(404) + expect(json_response['message']).to eq('404 User Not Found') + end + + it 'returns array of ssh keys' do + user.keys << key + user.save + + get api("/users/#{user.username}/keys") + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.first['title']).to eq(key.title) + end + end + describe 'DELETE /user/:id/keys/:key_id' do before do admin |