Extract EE specific files/lines for CI/CD spec/requests/api
We have the following files containing EE specific code. We should move them to ee/
spec/requests/api/jobs_spec.rb
diff --git a/spec/requests/api/jobs_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/requests/api/jobs_spec.rb
index 3defe8bbf51..47663dac011 100644
--- a/spec/requests/api/jobs_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/requests/api/jobs_spec.rb
@@ -50,6 +50,7 @@ describe API::Jobs do
let(:guest) { create(:project_member, :guest, project: project).user }
before do
+ stub_licensed_features(cross_project_pipelines: true)
project.add_developer(user)
end
@@ -603,6 +604,29 @@ describe API::Jobs do
it_behaves_like 'a valid file'
end
+
+ context 'when using job_token to authenticate' do
+ before do
+ pipeline.reload
+ pipeline.update(ref: 'master',
+ sha: project.commit('master').sha)
+
+ get api("/projects/#{project.id}/jobs/artifacts/master/download"), params: { job: job.name, job_token: job.token }
+ end
+
+ context 'when user is reporter' do
+ it_behaves_like 'a valid file'
+ end
+
+ context 'when user is admin, but not member' do
+ let(:api_user) { create(:admin) }
+ let(:job) { create(:ci_build, :artifacts, pipeline: pipeline, user: api_user) }
+
+ it 'does not allow to see that artfiact is present' do
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
+ end
end
end
spec/requests/api/runner_spec.rb
diff --git a/spec/requests/api/runner_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/requests/api/runner_spec.rb
index 43c06f7c973..9eabbba7130 100644
--- a/spec/requests/api/runner_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/requests/api/runner_spec.rb
@@ -1675,7 +1675,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
end
it 'download artifacts' do
- expect(response).to have_http_status(200)
+ expect(response).to have_gitlab_http_status(200)
expect(response.headers.to_h).to include download_headers
end
end
Edited by Yorick Peterse