diff options
Diffstat (limited to 'spec/requests/api/runners_spec.rb')
-rw-r--r-- | spec/requests/api/runners_spec.rb | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index 67907579225..fe38a7b3251 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -37,7 +37,7 @@ describe API::Runners do get api('/runners', user) shared = json_response.any? { |r| r['is_shared'] } - 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 expect(shared).to be_falsey @@ -47,7 +47,7 @@ describe API::Runners do get api('/runners?scope=active', user) shared = json_response.any? { |r| r['is_shared'] } - 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 expect(shared).to be_falsey @@ -55,7 +55,7 @@ describe API::Runners do it 'avoids filtering if scope is invalid' do get api('/runners?scope=unknown', user) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end end @@ -63,7 +63,7 @@ describe API::Runners do it 'does not return runners' do get api('/runners') - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -75,7 +75,7 @@ describe API::Runners do get api('/runners/all', admin) shared = json_response.any? { |r| r['is_shared'] } - 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 expect(shared).to be_truthy @@ -86,7 +86,7 @@ describe API::Runners do it 'does not return runners list' do get api('/runners/all', user) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -94,7 +94,7 @@ describe API::Runners do get api('/runners/all?scope=specific', admin) shared = json_response.any? { |r| r['is_shared'] } - 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 expect(shared).to be_falsey @@ -102,7 +102,7 @@ describe API::Runners do it 'avoids filtering if scope is invalid' do get api('/runners?scope=unknown', admin) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end end @@ -110,7 +110,7 @@ describe API::Runners do it 'does not return runners' do get api('/runners') - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -121,7 +121,7 @@ describe API::Runners do it "returns runner's details" do get api("/runners/#{shared_runner.id}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['description']).to eq(shared_runner.description) end end @@ -130,7 +130,7 @@ describe API::Runners do it "returns runner's details" do get api("/runners/#{specific_runner.id}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['description']).to eq(specific_runner.description) end end @@ -138,7 +138,7 @@ describe API::Runners do it 'returns 404 if runner does not exists' do get api('/runners/9999', admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -147,7 +147,7 @@ describe API::Runners do it "returns runner's details" do get api("/runners/#{specific_runner.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['description']).to eq(specific_runner.description) end end @@ -156,7 +156,7 @@ describe API::Runners do it "returns runner's details" do get api("/runners/#{shared_runner.id}", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['description']).to eq(shared_runner.description) end end @@ -166,7 +166,7 @@ describe API::Runners do it "does not return runner's details" do get api("/runners/#{specific_runner.id}", user2) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -174,7 +174,7 @@ describe API::Runners do it "does not return runner's details" do get api("/runners/#{specific_runner.id}") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -195,7 +195,7 @@ describe API::Runners do access_level: 'ref_protected') shared_runner.reload - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(shared_runner.description).to eq("#{description}_updated") expect(shared_runner.active).to eq(!active) expect(shared_runner.tag_list).to include('ruby2.1', 'pgsql', 'mysql') @@ -215,7 +215,7 @@ describe API::Runners do update_runner(specific_runner.id, admin, description: 'test') specific_runner.reload - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(specific_runner.description).to eq('test') expect(specific_runner.description).not_to eq(description) expect(specific_runner.ensure_runner_queue_value) @@ -226,7 +226,7 @@ describe API::Runners do it 'returns 404 if runner does not exists' do update_runner(9999, admin, description: 'test') - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end def update_runner(id, user, args) @@ -239,7 +239,7 @@ describe API::Runners do it 'does not update runner' do put api("/runners/#{shared_runner.id}", user), description: 'test' - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -247,7 +247,7 @@ describe API::Runners do it 'does not update runner without access to it' do put api("/runners/#{specific_runner.id}", user2), description: 'test' - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it 'updates runner with access to it' do @@ -255,7 +255,7 @@ describe API::Runners do put api("/runners/#{specific_runner.id}", admin), description: 'test' specific_runner.reload - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(specific_runner.description).to eq('test') expect(specific_runner.description).not_to eq(description) end @@ -266,7 +266,7 @@ describe API::Runners do it 'does not delete runner' do put api("/runners/#{specific_runner.id}") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -278,7 +278,7 @@ describe API::Runners do expect do delete api("/runners/#{shared_runner.id}", admin) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { Ci::Runner.shared.count }.by(-1) end @@ -292,7 +292,7 @@ describe API::Runners do expect do delete api("/runners/#{unused_specific_runner.id}", admin) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { Ci::Runner.specific.count }.by(-1) end @@ -300,7 +300,7 @@ describe API::Runners do expect do delete api("/runners/#{specific_runner.id}", admin) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { Ci::Runner.specific.count }.by(-1) end end @@ -308,7 +308,7 @@ describe API::Runners do it 'returns 404 if runner does not exists' do delete api('/runners/9999', admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -316,26 +316,26 @@ describe API::Runners do context 'when runner is shared' do it 'does not delete runner' do delete api("/runners/#{shared_runner.id}", user) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end context 'when runner is not shared' do it 'does not delete runner without access to it' do delete api("/runners/#{specific_runner.id}", user2) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it 'does not delete runner with more than one associated project' do delete api("/runners/#{two_projects_runner.id}", user) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it 'deletes runner for one owned project' do expect do delete api("/runners/#{specific_runner.id}", user) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { Ci::Runner.specific.count }.by(-1) end @@ -349,7 +349,7 @@ describe API::Runners do it 'does not delete runner' do delete api("/runners/#{specific_runner.id}") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -360,7 +360,7 @@ describe API::Runners do get api("/projects/#{project.id}/runners", user) shared = json_response.any? { |r| r['is_shared'] } - 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 expect(shared).to be_truthy @@ -371,7 +371,7 @@ describe API::Runners do it "does not return project's runners" do get api("/projects/#{project.id}/runners", user2) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -379,7 +379,7 @@ describe API::Runners do it "does not return project's runners" do get api("/projects/#{project.id}/runners") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -396,14 +396,14 @@ describe API::Runners do expect do post api("/projects/#{project.id}/runners", user), runner_id: specific_runner2.id end.to change { project.runners.count }.by(+1) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end it 'avoids changes when enabling already enabled runner' do expect do post api("/projects/#{project.id}/runners", user), runner_id: specific_runner.id end.to change { project.runners.count }.by(0) - expect(response).to have_http_status(409) + expect(response).to have_gitlab_http_status(409) end it 'does not enable locked runner' do @@ -413,13 +413,13 @@ describe API::Runners do post api("/projects/#{project.id}/runners", user), runner_id: specific_runner2.id end.to change { project.runners.count }.by(0) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it 'does not enable shared runner' do post api("/projects/#{project.id}/runners", user), runner_id: shared_runner.id - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end context 'user is admin' do @@ -427,7 +427,7 @@ describe API::Runners do expect do post api("/projects/#{project.id}/runners", admin), runner_id: unused_specific_runner.id end.to change { project.runners.count }.by(+1) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end end @@ -435,14 +435,14 @@ describe API::Runners do it 'does not enable runner without access to' do post api("/projects/#{project.id}/runners", user), runner_id: unused_specific_runner.id - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end it 'raises an error when no runner_id param is provided' do post api("/projects/#{project.id}/runners", admin) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end end @@ -450,7 +450,7 @@ describe API::Runners do it 'does not enable runner' do post api("/projects/#{project.id}/runners", user2) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -458,7 +458,7 @@ describe API::Runners do it 'does not enable runner' do post api("/projects/#{project.id}/runners") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end @@ -470,7 +470,7 @@ describe API::Runners do expect do delete api("/projects/#{project.id}/runners/#{two_projects_runner.id}", user) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { project.runners.count }.by(-1) end @@ -484,14 +484,14 @@ describe API::Runners do expect do delete api("/projects/#{project.id}/runners/#{specific_runner.id}", user) end.to change { project.runners.count }.by(0) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end it 'returns 404 is runner is not found' do delete api("/projects/#{project.id}/runners/9999", user) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -499,7 +499,7 @@ describe API::Runners do it "does not disable project's runner" do delete api("/projects/#{project.id}/runners/#{specific_runner.id}", user2) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -507,7 +507,7 @@ describe API::Runners do it "does not disable project's runner" do delete api("/projects/#{project.id}/runners/#{specific_runner.id}") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end end end |