diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-23 22:44:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-23 22:44:23 +0300 |
commit | 6b96d119aec0ba674cca2c380cf60f1500306612 (patch) | |
tree | f7742d802f557d04e2144b06a2b47719fbd58b82 /spec/requests/api | |
parent | 8b7c4494871c7d69ac7bc59839bdce6ff2937f95 (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/deploy_keys_spec.rb | 54 |
1 files changed, 1 insertions, 53 deletions
diff --git a/spec/requests/api/deploy_keys_spec.rb b/spec/requests/api/deploy_keys_spec.rb index 1baa18b53ce..e8cc6bc71ae 100644 --- a/spec/requests/api/deploy_keys_spec.rb +++ b/spec/requests/api/deploy_keys_spec.rb @@ -8,7 +8,7 @@ describe API::DeployKeys do let(:admin) { create(:admin) } let(:project) { create(:project, creator_id: user.id) } let(:project2) { create(:project, creator_id: user.id) } - let(:deploy_key) { create(:deploy_key, public: true, user: user) } + let(:deploy_key) { create(:deploy_key, public: true) } let!(:deploy_keys_project) do create(:deploy_keys_project, project: project, deploy_key: deploy_key) @@ -40,32 +40,6 @@ describe API::DeployKeys do expect(json_response).to be_an Array expect(json_response.first['id']).to eq(deploy_keys_project.deploy_key.id) end - - it 'returns all deploy keys with comments replaced with'\ - 'a simple identifier of username + hostname' do - get api('/deploy_keys', admin) - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response).to be_an Array - - keys = json_response.map { |key_detail| key_detail['key'] } - expect(keys).to all(include("#{user.name} (#{Gitlab.config.gitlab.host}")) - end - - context 'N+1 queries' do - before do - get api('/deploy_keys', admin) - end - - it 'avoids N+1 queries', :request_store do - control_count = ActiveRecord::QueryRecorder.new { get api('/deploy_keys', admin) }.count - - create_list(:deploy_key, 2, public: true, user: create(:user)) - - expect { get api('/deploy_keys', admin) }.not_to exceed_query_limit(control_count) - end - end end end @@ -82,25 +56,6 @@ describe API::DeployKeys do expect(json_response).to be_an Array expect(json_response.first['title']).to eq(deploy_key.title) end - - context 'N+1 queries' do - before do - get api("/projects/#{project.id}/deploy_keys", admin) - end - - it 'avoids N+1 queries', :request_store do - control_count = ActiveRecord::QueryRecorder.new do - get api("/projects/#{project.id}/deploy_keys", admin) - end.count - - deploy_key = create(:deploy_key, user: create(:user)) - create(:deploy_keys_project, project: project, deploy_key: deploy_key) - - expect do - get api("/projects/#{project.id}/deploy_keys", admin) - end.not_to exceed_query_limit(control_count) - end - end end describe 'GET /projects/:id/deploy_keys/:key_id' do @@ -111,13 +66,6 @@ describe API::DeployKeys do expect(json_response['title']).to eq(deploy_key.title) end - it 'exposes key comment as a simple identifier of username + hostname' do - get api("/projects/#{project.id}/deploy_keys/#{deploy_key.id}", admin) - - expect(response).to have_gitlab_http_status(:ok) - expect(json_response['key']).to include("#{deploy_key.user_name} (#{Gitlab.config.gitlab.host})") - end - it 'returns 404 Not Found with invalid ID' do get api("/projects/#{project.id}/deploy_keys/404", admin) |