Skip to content
Snippets Groups Projects
Commit f7dae0cd authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent b98fa9ef
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -66,7 +66,7 @@ describe API::Jobs do
 
context 'authorized user' do
it 'returns project jobs' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
end
Loading
Loading
@@ -122,7 +122,7 @@ describe API::Jobs do
let(:query) { { 'scope' => 'pending' } }
 
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
end
end
Loading
Loading
@@ -131,7 +131,7 @@ describe API::Jobs do
let(:query) { { scope: %w(pending running) } }
 
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
end
end
Loading
Loading
@@ -139,7 +139,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_gitlab_http_status(400) }
it { expect(response).to have_gitlab_http_status(:bad_request) }
end
end
 
Loading
Loading
@@ -148,7 +148,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not return project jobs' do
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
 
Loading
Loading
@@ -156,7 +156,7 @@ describe API::Jobs do
let(:api_user) { guest }
 
it 'does not return project jobs' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
Loading
Loading
@@ -178,7 +178,7 @@ describe API::Jobs do
 
context 'authorized user' do
it 'returns pipeline jobs' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
end
Loading
Loading
@@ -210,7 +210,7 @@ describe API::Jobs do
let(:query) { { 'scope' => 'pending' } }
 
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
end
end
Loading
Loading
@@ -219,7 +219,7 @@ describe API::Jobs do
let(:query) { { scope: %w(pending running) } }
 
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
end
end
Loading
Loading
@@ -227,7 +227,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_gitlab_http_status(400) }
it { expect(response).to have_gitlab_http_status(:bad_request) }
end
 
context 'jobs in different pipelines' do
Loading
Loading
@@ -257,7 +257,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not return jobs' do
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
 
Loading
Loading
@@ -265,7 +265,7 @@ describe API::Jobs do
let(:api_user) { guest }
 
it 'does not return jobs' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
Loading
Loading
@@ -280,7 +280,7 @@ describe API::Jobs do
 
context 'authorized user' do
it 'returns specific job data' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['id']).to eq(job.id)
expect(json_response['status']).to eq(job.status)
expect(json_response['stage']).to eq(job.stage)
Loading
Loading
@@ -319,7 +319,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not return specific job data' do
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
Loading
Loading
@@ -339,7 +339,7 @@ describe API::Jobs do
end
 
it 'returns status 401 (unauthorized)' do
expect(response).to have_http_status :unauthorized
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
 
Loading
Loading
@@ -349,7 +349,7 @@ describe API::Jobs do
end
 
it 'returns status 403 (forbidden)' do
expect(response).to have_http_status :forbidden
expect(response).to have_gitlab_http_status(:forbidden)
end
end
 
Loading
Loading
@@ -362,7 +362,7 @@ describe API::Jobs do
end
 
it 'returns status 204 (no content)' do
expect(response).to have_http_status :no_content
expect(response).to have_gitlab_http_status(:no_content)
end
end
end
Loading
Loading
@@ -386,7 +386,7 @@ describe API::Jobs do
 
get_artifact_file(artifact)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
end
 
Loading
Loading
@@ -398,7 +398,7 @@ describe API::Jobs do
 
get_artifact_file(artifact)
 
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
 
Loading
Loading
@@ -410,7 +410,7 @@ describe API::Jobs do
 
get_artifact_file(artifact)
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
@@ -423,7 +423,7 @@ describe API::Jobs do
 
get_artifact_file(artifact)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers.to_h)
.to include('Content-Type' => 'application/json',
'Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
Loading
Loading
@@ -435,7 +435,7 @@ describe API::Jobs do
it 'does not return job artifact file' do
get_artifact_file('some/artifact')
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -453,7 +453,7 @@ describe API::Jobs do
end
 
it 'returns specific job artifacts' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers.to_h).to include(download_headers)
expect(response.body).to match_file(job.artifacts_file.file.file)
end
Loading
Loading
@@ -476,7 +476,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not return specific job artifacts' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
@@ -507,7 +507,7 @@ describe API::Jobs do
 
context 'when proxy download is disabled' do
it 'returns location redirect' do
expect(response).to have_gitlab_http_status(302)
expect(response).to have_gitlab_http_status(:found)
end
end
 
Loading
Loading
@@ -521,7 +521,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not return specific job artifacts' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
@@ -557,7 +557,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_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -569,7 +569,7 @@ describe API::Jobs do
end
 
it 'gives 403' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
 
Loading
Loading
@@ -604,7 +604,7 @@ describe API::Jobs do
%Q(attachment; filename="#{job.artifacts_file.filename}"; filename*=UTF-8''#{job.artifacts_file.filename}) }
end
 
it { expect(response).to have_http_status(:ok) }
it { expect(response).to have_gitlab_http_status(:ok) }
it { expect(response.headers.to_h).to include(download_headers) }
end
 
Loading
Loading
@@ -619,7 +619,7 @@ describe API::Jobs do
end
 
it 'returns location redirect' do
expect(response).to have_http_status(:found)
expect(response).to have_gitlab_http_status(:found)
end
end
end
Loading
Loading
@@ -677,7 +677,7 @@ describe API::Jobs do
let(:public_builds) { true }
 
it 'allows to access artifacts', :sidekiq_might_not_need_inline do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers.to_h)
.to include('Content-Type' => 'application/json',
'Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
Loading
Loading
@@ -689,7 +689,7 @@ describe API::Jobs do
let(:public_builds) { false }
 
it 'rejects access to artifacts' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
expect(json_response).to have_key('message')
expect(response.headers.to_h)
.not_to include('Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
Loading
Loading
@@ -701,7 +701,7 @@ describe API::Jobs do
let(:public_builds) { true }
 
it 'rejects access and hides existence of artifacts' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response).to have_key('message')
expect(response.headers.to_h)
.not_to include('Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
Loading
Loading
@@ -720,7 +720,7 @@ describe API::Jobs do
 
get_artifact_file(artifact)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers.to_h)
.to include('Content-Type' => 'application/json',
'Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
Loading
Loading
@@ -737,7 +737,7 @@ describe API::Jobs do
it 'returns a specific artifact file for a valid path', :sidekiq_might_not_need_inline do
get_artifact_file(artifact, 'improve/awesome')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers.to_h)
.to include('Content-Type' => 'application/json',
'Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
Loading
Loading
@@ -773,7 +773,7 @@ describe API::Jobs do
it 'does not return job artifact file' do
get_artifact_file('some/artifact')
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -803,7 +803,7 @@ describe API::Jobs do
end
 
it 'returns specific job trace' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to eq(job.trace.raw)
end
end
Loading
Loading
@@ -812,7 +812,7 @@ describe API::Jobs do
let(:job) { create(:ci_build, :trace_artifact, pipeline: pipeline) }
 
it 'returns specific job trace' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to eq(job.trace.raw)
end
end
Loading
Loading
@@ -821,7 +821,7 @@ describe API::Jobs do
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
 
it 'returns specific job trace' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to eq(job.trace.raw)
end
end
Loading
Loading
@@ -831,7 +831,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not return specific job trace' do
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
Loading
Loading
@@ -844,7 +844,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_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(project.builds.first.status).to eq('success')
end
end
Loading
Loading
@@ -853,7 +853,7 @@ describe API::Jobs do
let(:api_user) { reporter }
 
it 'does not cancel job' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
Loading
Loading
@@ -862,7 +862,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not cancel job' do
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
Loading
Loading
@@ -877,7 +877,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_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(project.builds.first.status).to eq('canceled')
expect(json_response['status']).to eq('pending')
end
Loading
Loading
@@ -887,7 +887,7 @@ describe API::Jobs do
let(:api_user) { reporter }
 
it 'does not retry job' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
Loading
Loading
@@ -896,7 +896,7 @@ describe API::Jobs do
let(:api_user) { nil }
 
it 'does not retry job' do
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
end
Loading
Loading
@@ -914,7 +914,7 @@ describe API::Jobs do
let(:job) { create(:ci_build, :trace_artifact, :artifacts, :test_reports, :success, project: project, pipeline: pipeline) }
 
it 'erases job content' do
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(job.job_artifacts.count).to eq(0)
expect(job.trace.exist?).to be_falsy
expect(job.artifacts_file.present?).to be_falsy
Loading
Loading
@@ -934,7 +934,7 @@ describe API::Jobs do
let(:job) { create(:ci_build, :trace_live, project: project, pipeline: pipeline) }
 
it 'responds with forbidden' do
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
 
Loading
Loading
@@ -945,13 +945,13 @@ describe API::Jobs do
context 'when the build was created by the developer' do
let(:owner) { user }
 
it { expect(response).to have_gitlab_http_status(201) }
it { expect(response).to have_gitlab_http_status(:created) }
end
 
context 'when the build was created by the other' do
let(:owner) { create(:user) }
 
it { expect(response).to have_gitlab_http_status(403) }
it { expect(response).to have_gitlab_http_status(:forbidden) }
end
end
end
Loading
Loading
@@ -968,7 +968,7 @@ describe API::Jobs do
end
 
it 'keeps artifacts' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(job.reload.artifacts_expire_at).to be_nil
end
end
Loading
Loading
@@ -977,7 +977,7 @@ describe API::Jobs do
let(:job) { create(:ci_build, project: project, pipeline: pipeline) }
 
it 'responds with not found' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
@@ -992,7 +992,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_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['user']['id']).to eq(user.id)
expect(json_response['id']).to eq(job.id)
expect(job.reload).to be_pending
Loading
Loading
@@ -1005,7 +1005,7 @@ describe API::Jobs do
 
it 'does not trigger a manual action' do
expect(job.reload).to be_manual
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
 
Loading
Loading
@@ -1014,7 +1014,7 @@ describe API::Jobs do
 
it 'does not trigger a manual action' do
expect(job.reload).to be_manual
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
Loading
Loading
@@ -1022,7 +1022,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_gitlab_http_status 400
expect(response).to have_gitlab_http_status(:bad_request)
expect(response.body).to match("Unplayable Job")
end
end
Loading
Loading
Loading
Loading
@@ -12,21 +12,21 @@ describe API::Keys do
context 'when unauthenticated' do
it 'returns authentication error' do
get api("/keys/#{key.id}")
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
end
 
context 'when authenticated' do
it 'returns 404 for non-existing key' do
get api('/keys/0', admin)
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Not found')
end
 
it 'returns single ssh key with user information' do
user.keys << key
get api("/keys/#{key.id}", admin)
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['title']).to eq(key.title)
expect(json_response['user']['id']).to eq(user.id)
expect(json_response['user']['username']).to eq(user.username)
Loading
Loading
@@ -44,27 +44,27 @@ describe API::Keys do
it 'returns authentication error' do
get api("/keys?fingerprint=#{key.fingerprint}")
 
expect(response).to have_gitlab_http_status(401)
expect(response).to have_gitlab_http_status(:unauthorized)
end
 
it 'returns authentication error when authenticated as user' do
get api("/keys?fingerprint=#{key.fingerprint}", user)
 
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
 
context 'when authenticated as admin' do
it 'returns 404 for non-existing SSH md5 fingerprint' do
get api("/keys?fingerprint=11:11:11:11:11:11:11:11:11:11:11:11:11:11:11:11", admin)
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Key Not Found')
end
 
it 'returns 404 for non-existing SSH sha256 fingerprint' do
get api("/keys?fingerprint=#{URI.encode_www_form_component("SHA256:nUhzNyftwADy8AH3wFY31tAKs7HufskYTte2aXo1lCg")}", admin)
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Key Not Found')
end
 
Loading
Loading
@@ -73,7 +73,7 @@ describe API::Keys do
 
get api("/keys?fingerprint=#{key.fingerprint}", admin)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['title']).to eq(key.title)
expect(json_response['user']['id']).to eq(user.id)
expect(json_response['user']['username']).to eq(user.username)
Loading
Loading
@@ -84,7 +84,7 @@ describe API::Keys do
 
get api("/keys?fingerprint=#{URI.encode_www_form_component("SHA256:" + key.fingerprint_sha256)}", admin)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['title']).to eq(key.title)
expect(json_response['user']['id']).to eq(user.id)
expect(json_response['user']['username']).to eq(user.username)
Loading
Loading
@@ -95,7 +95,7 @@ describe API::Keys do
 
get api("/keys?fingerprint=#{URI.encode_www_form_component("sha256:" + key.fingerprint_sha256)}", admin)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['title']).to eq(key.title)
expect(json_response['user']['id']).to eq(user.id)
expect(json_response['user']['username']).to eq(user.username)
Loading
Loading
@@ -125,7 +125,7 @@ describe API::Keys do
 
get api("/keys?fingerprint=#{URI.encode_www_form_component("SHA256:" + deploy_key.fingerprint_sha256)}", admin)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['title']).to eq(deploy_key.title)
expect(json_response['user']['id']).to eq(user.id)
 
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ describe API::Labels do
it "returns 200 if name is changed (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, new_name: 'New Label')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq('New Label')
expect(json_response['color']).to eq(label1.color)
end
Loading
Loading
@@ -35,7 +35,7 @@ describe API::Labels do
it "returns 200 if colors is changed (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, color: '#FFFFFF')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(label1.name)
expect(json_response['color']).to eq('#FFFFFF')
end
Loading
Loading
@@ -51,7 +51,7 @@ describe API::Labels do
it "returns 400 if no new parameters given (#{route_type} route)" do
put_labels_api(route_type, user, spec_params)
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('new_name, color, description, priority are missing, '\
'at least one parameter must be provided')
end
Loading
Loading
@@ -59,27 +59,27 @@ describe API::Labels do
it "returns 400 when color code is too short (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, color: '#FF')
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['color']).to eq(['must be a valid color code'])
end
 
it "returns 400 for too long color code (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, color: '#FFAAFFFF')
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['color']).to eq(['must be a valid color code'])
end
 
it "returns 400 for invalid priority (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, priority: 'foo')
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
 
it "returns 200 if name and colors and description are changed (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, new_name: 'New Label', color: '#FFFFFF', description: 'test')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq('New Label')
expect(json_response['color']).to eq('#FFFFFF')
expect(json_response['description']).to eq('test')
Loading
Loading
@@ -88,14 +88,14 @@ describe API::Labels do
it "returns 400 for invalid name (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, new_name: ',', color: '#FFFFFF')
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['title']).to eq(['is invalid'])
end
 
it "returns 200 if description is changed (#{route_type} route)" do
put_labels_api(route_type, user, spec_params, description: 'test')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['id']).to eq(expected_response_label_id)
expect(json_response['description']).to eq('test')
end
Loading
Loading
@@ -162,14 +162,14 @@ describe API::Labels do
it 'returns 204 for existing label (deprecated route)' do
delete api("/projects/#{project.id}/labels", user), params: spec_params
 
expect(response).to have_gitlab_http_status(204)
expect(response).to have_gitlab_http_status(:no_content)
end
 
it 'returns 204 for existing label (rest route)' do
label_id = spec_params[:name] || spec_params[:label_id]
delete api("/projects/#{project.id}/labels/#{label_id}", user), params: spec_params.except(:name, :label_id)
 
expect(response).to have_gitlab_http_status(204)
expect(response).to have_gitlab_http_status(:no_content)
end
end
 
Loading
Loading
@@ -188,7 +188,7 @@ describe API::Labels do
it 'returns all available labels to the project' do
get api("/projects/#{project.id}/labels", user)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to all(match_schema('public_api/v4/labels/project_label'))
expect(json_response.size).to eq(3)
Loading
Loading
@@ -205,7 +205,7 @@ describe API::Labels do
it 'includes counts in the response' do
get api("/projects/#{project.id}/labels", user), params: { with_counts: true }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to all(match_schema('public_api/v4/labels/project_label_with_counts'))
expect(json_response.size).to eq(3)
Loading
Loading
@@ -264,7 +264,7 @@ describe API::Labels do
it 'returns all available labels for the project, parent group and ancestor groups' do
get api("/projects/#{project.id}/labels", user)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response).to all(match_schema('public_api/v4/labels/label'))
Loading
Loading
@@ -287,7 +287,7 @@ describe API::Labels do
it 'returns all available labels for the project and the parent group only' do
get api("/projects/#{project.id}/labels", user), params: { include_ancestor_groups: false }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response).to all(match_schema('public_api/v4/labels/label'))
Loading
Loading
@@ -307,7 +307,7 @@ describe API::Labels do
priority: 2
}
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(json_response['name']).to eq('Foo')
expect(json_response['color']).to eq('#FFAABB')
expect(json_response['description']).to eq('test')
Loading
Loading
@@ -345,12 +345,12 @@ describe API::Labels do
 
it 'returns a 400 bad request if name not given' do
post api("/projects/#{project.id}/labels", user), params: { color: '#FFAABB' }
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
 
it 'returns a 400 bad request if color not given' do
post api("/projects/#{project.id}/labels", user), params: { name: 'Foobar' }
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
 
it 'returns 400 for invalid color' do
Loading
Loading
@@ -359,7 +359,7 @@ describe API::Labels do
name: 'Foo',
color: '#FFAA'
}
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['color']).to eq(['must be a valid color code'])
end
 
Loading
Loading
@@ -369,7 +369,7 @@ describe API::Labels do
name: 'Foo',
color: '#FFAAFFFF'
}
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['color']).to eq(['must be a valid color code'])
end
 
Loading
Loading
@@ -379,7 +379,7 @@ describe API::Labels do
name: ',',
color: '#FFAABB'
}
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']['title']).to eq(['is invalid'])
end
 
Loading
Loading
@@ -394,7 +394,7 @@ describe API::Labels do
color: '#FFAABB'
}
 
expect(response).to have_gitlab_http_status(409)
expect(response).to have_gitlab_http_status(:conflict)
expect(json_response['message']).to eq('Label already exists')
end
 
Loading
Loading
@@ -406,7 +406,7 @@ describe API::Labels do
priority: 'foo'
}
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
 
it 'returns 409 if label already exists in project' do
Loading
Loading
@@ -415,7 +415,7 @@ describe API::Labels do
name: 'label1',
color: '#FFAABB'
}
expect(response).to have_gitlab_http_status(409)
expect(response).to have_gitlab_http_status(:conflict)
expect(json_response['message']).to eq('Label already exists')
end
end
Loading
Loading
@@ -432,14 +432,14 @@ describe API::Labels do
it 'returns 404 for non existing label' do
delete api("/projects/#{project.id}/labels", user), params: { name: 'label2' }
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('404 Label Not Found')
end
 
it 'returns 400 for wrong parameters' do
delete api("/projects/#{project.id}/labels", user)
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
 
it 'fails if label_id and name are given in params' do
Loading
Loading
@@ -449,7 +449,7 @@ describe API::Labels do
name: priority_label.name
}
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
 
it_behaves_like '412 response' do
Loading
Loading
@@ -480,7 +480,7 @@ describe API::Labels do
new_name: 'label3'
}
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
 
it 'returns 404 if label by id does not exist' do
Loading
Loading
@@ -490,13 +490,13 @@ describe API::Labels do
new_name: 'label3'
}
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
 
it 'returns 400 if no label name and id is given' do
put api("/projects/#{project.id}/labels", user), params: { new_name: 'label2' }
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('label_id, name are missing, exactly one parameter must be provided')
end
 
Loading
Loading
@@ -508,7 +508,7 @@ describe API::Labels do
new_name: 'New Label'
}
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
end
end
 
Loading
Loading
@@ -523,7 +523,7 @@ describe API::Labels do
it 'returns 200 if label is promoted' do
put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['name']).to eq(label1.name)
expect(json_response['color']).to eq(label1.color)
end
Loading
Loading
@@ -535,7 +535,7 @@ describe API::Labels do
.to change(project.labels, :count).by(-1)
.and change(group.labels, :count).by(0)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
end
 
it 'returns 403 if guest promotes label' do
Loading
Loading
@@ -544,19 +544,19 @@ describe API::Labels do
 
put api("/projects/#{project.id}/labels/promote", guest), params: { name: label1.name }
 
expect(response).to have_gitlab_http_status(403)
expect(response).to have_gitlab_http_status(:forbidden)
end
 
it 'returns 404 if label does not exist' do
put api("/projects/#{project.id}/labels/promote", user), params: { name: 'unknown' }
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
 
it 'returns 400 if no label name given' do
put api("/projects/#{project.id}/labels/promote", user)
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('name is missing')
end
end
Loading
Loading
@@ -566,7 +566,7 @@ describe API::Labels do
it "subscribes to the label" do
post api("/projects/#{project.id}/labels/#{label1.title}/subscribe", user)
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(json_response["name"]).to eq(label1.title)
expect(json_response["subscribed"]).to be_truthy
end
Loading
Loading
@@ -576,7 +576,7 @@ describe API::Labels do
it "subscribes to the label" do
post api("/projects/#{project.id}/labels/#{label1.id}/subscribe", user)
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(json_response["name"]).to eq(label1.title)
expect(json_response["subscribed"]).to be_truthy
end
Loading
Loading
@@ -590,7 +590,7 @@ describe API::Labels do
it "returns 304" do
post api("/projects/#{project.id}/labels/#{label1.id}/subscribe", user)
 
expect(response).to have_gitlab_http_status(304)
expect(response).to have_gitlab_http_status(:not_modified)
end
end
 
Loading
Loading
@@ -598,7 +598,7 @@ describe API::Labels do
it "returns 404 error" do
post api("/projects/#{project.id}/labels/1234/subscribe", user)
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
@@ -612,7 +612,7 @@ describe API::Labels do
it "unsubscribes from the label" do
post api("/projects/#{project.id}/labels/#{label1.title}/unsubscribe", user)
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(json_response["name"]).to eq(label1.title)
expect(json_response["subscribed"]).to be_falsey
end
Loading
Loading
@@ -622,7 +622,7 @@ describe API::Labels do
it "unsubscribes from the label" do
post api("/projects/#{project.id}/labels/#{label1.id}/unsubscribe", user)
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(json_response["name"]).to eq(label1.title)
expect(json_response["subscribed"]).to be_falsey
end
Loading
Loading
@@ -636,7 +636,7 @@ describe API::Labels do
it "returns 304" do
post api("/projects/#{project.id}/labels/#{label1.id}/unsubscribe", user)
 
expect(response).to have_gitlab_http_status(304)
expect(response).to have_gitlab_http_status(:not_modified)
end
end
 
Loading
Loading
@@ -644,7 +644,7 @@ describe API::Labels do
it "returns 404 error" do
post api("/projects/#{project.id}/labels/1234/unsubscribe", user)
 
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ describe API::Lint do
it 'passes validation' do
post api('/ci/lint'), params: { content: yaml_content }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Hash
expect(json_response['status']).to eq('valid')
expect(json_response['errors']).to eq([])
Loading
Loading
@@ -23,7 +23,7 @@ describe API::Lint do
it 'responds with errors about invalid syntax' do
post api('/ci/lint'), params: { content: 'invalid content' }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['status']).to eq('invalid')
expect(json_response['errors']).to eq(['Invalid configuration format'])
end
Loading
Loading
@@ -31,7 +31,7 @@ describe API::Lint do
it "responds with errors about invalid configuration" do
post api('/ci/lint'), params: { content: '{ image: "ruby:2.1", services: ["postgres"] }' }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['status']).to eq('invalid')
expect(json_response['errors']).to eq(['jobs config should contain at least one visible job'])
end
Loading
Loading
@@ -41,7 +41,7 @@ describe API::Lint do
it 'responds with validation error about missing content' do
post api('/ci/lint')
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['error']).to eq('content is missing')
end
end
Loading
Loading
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment