diff options
Diffstat (limited to 'spec/requests/api/jobs_spec.rb')
-rw-r--r-- | spec/requests/api/jobs_spec.rb | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index 2d7cc1a1798..3b7b9c889e7 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -31,7 +31,7 @@ describe API::Jobs do context 'authorized user' do it 'returns project jobs' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array end @@ -55,7 +55,7 @@ describe API::Jobs do let(:query) { { 'scope' => 'pending' } } it do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array end end @@ -64,7 +64,7 @@ describe API::Jobs do let(:query) { { scope: %w(pending running) } } it do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array end end @@ -72,7 +72,7 @@ describe API::Jobs do context 'respond 400 when scope contains invalid state' do let(:query) { { scope: %w(unknown running) } } - it { expect(response).to have_http_status(400) } + it { expect(response).to have_gitlab_http_status(400) } end end @@ -80,7 +80,7 @@ describe API::Jobs do let(:api_user) { nil } it 'does not return project jobs' do - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -94,7 +94,7 @@ describe API::Jobs do context 'authorized user' do it 'returns pipeline jobs' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array end @@ -118,7 +118,7 @@ describe API::Jobs do let(:query) { { 'scope' => 'pending' } } it do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array end end @@ -127,7 +127,7 @@ describe API::Jobs do let(:query) { { scope: %w(pending running) } } it do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response).to be_an Array end end @@ -135,7 +135,7 @@ describe API::Jobs do context 'respond 400 when scope contains invalid state' do let(:query) { { scope: %w(unknown running) } } - it { expect(response).to have_http_status(400) } + it { expect(response).to have_gitlab_http_status(400) } end context 'jobs in different pipelines' do @@ -152,7 +152,7 @@ describe API::Jobs do let(:api_user) { nil } it 'does not return jobs' do - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -164,7 +164,7 @@ describe API::Jobs do context 'authorized user' do it 'returns specific job data' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq('test') end @@ -183,7 +183,7 @@ describe API::Jobs do let(:api_user) { nil } it 'does not return specific job data' do - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -207,7 +207,7 @@ describe API::Jobs do get_artifact_file(artifact) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) end end @@ -219,7 +219,7 @@ describe API::Jobs do get_artifact_file(artifact) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -231,7 +231,7 @@ describe API::Jobs do get_artifact_file(artifact) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -244,7 +244,7 @@ describe API::Jobs do get_artifact_file(artifact) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response.headers) .to include('Content-Type' => 'application/json', 'Gitlab-Workhorse-Send-Data' => /artifacts-entry/) @@ -256,7 +256,7 @@ describe API::Jobs do it 'does not return job artifact file' do get_artifact_file('some/artifact') - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -281,7 +281,7 @@ describe API::Jobs do end it 'returns specific job artifacts' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response.headers).to include(download_headers) expect(response.body).to match_file(job.artifacts_file.file.file) end @@ -292,13 +292,13 @@ describe API::Jobs do it 'hides artifacts and rejects request' do expect(project).to be_private - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end it 'does not return job artifacts if not uploaded' do - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -323,7 +323,7 @@ describe API::Jobs do it 'does not find a resource in a private project' do expect(project).to be_private - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -335,13 +335,13 @@ describe API::Jobs do end it 'gives 403' do - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end context 'non-existing job' do shared_examples 'not found' do - it { expect(response).to have_http_status(:not_found) } + it { expect(response).to have_gitlab_http_status(:not_found) } end context 'has no such ref' do @@ -369,7 +369,7 @@ describe API::Jobs do "attachment; filename=#{job.artifacts_file.filename}" } end - it { expect(response).to have_http_status(200) } + it { expect(response).to have_gitlab_http_status(200) } it { expect(response.headers).to include(download_headers) } end @@ -410,7 +410,7 @@ describe API::Jobs do context 'authorized user' do it 'returns specific job trace' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response.body).to eq(job.trace.raw) end end @@ -419,7 +419,7 @@ describe API::Jobs do let(:api_user) { nil } it 'does not return specific job trace' do - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -432,7 +432,7 @@ describe API::Jobs do context 'authorized user' do context 'user with :update_build persmission' do it 'cancels running or pending job' do - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(project.builds.first.status).to eq('canceled') end end @@ -441,7 +441,7 @@ describe API::Jobs do let(:api_user) { reporter } it 'does not cancel job' do - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end end @@ -450,7 +450,7 @@ describe API::Jobs do let(:api_user) { nil } it 'does not cancel job' do - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -465,7 +465,7 @@ describe API::Jobs do context 'authorized user' do context 'user with :update_build permission' do it 'retries non-running job' do - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(project.builds.first.status).to eq('canceled') expect(json_response['status']).to eq('pending') end @@ -475,7 +475,7 @@ describe API::Jobs do let(:api_user) { reporter } it 'does not retry job' do - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end end @@ -484,7 +484,7 @@ describe API::Jobs do let(:api_user) { nil } it 'does not retry job' do - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -498,7 +498,7 @@ describe API::Jobs do let(:job) { create(:ci_build, :trace, :artifacts, :success, project: project, pipeline: pipeline) } it 'erases job content' do - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(job).not_to have_trace expect(job.artifacts_file.exists?).to be_falsy expect(job.artifacts_metadata.exists?).to be_falsy @@ -516,7 +516,7 @@ describe API::Jobs do let(:job) { create(:ci_build, :trace, project: project, pipeline: pipeline) } it 'responds with forbidden' do - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end end @@ -533,7 +533,7 @@ describe API::Jobs do end it 'keeps artifacts' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(job.reload.artifacts_expire_at).to be_nil end end @@ -542,7 +542,7 @@ describe API::Jobs do let(:job) { create(:ci_build, project: project, pipeline: pipeline) } it 'responds with not found' do - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -557,7 +557,7 @@ describe API::Jobs do context 'when user is authorized to trigger a manual action' do it 'plays the job' do - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['user']['id']).to eq(user.id) expect(json_response['id']).to eq(job.id) expect(job.reload).to be_pending @@ -570,7 +570,7 @@ describe API::Jobs do it 'does not trigger a manual action' do expect(job.reload).to be_manual - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -579,7 +579,7 @@ describe API::Jobs do it 'does not trigger a manual action' do expect(job.reload).to be_manual - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end end @@ -587,7 +587,7 @@ describe API::Jobs do context 'on a non-playable job' do it 'returns a status code 400, Bad Request' do - expect(response).to have_http_status 400 + expect(response).to have_gitlab_http_status 400 expect(response.body).to match("Unplayable Job") end end |