Commit 513d551c authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix after column rename

parent 73b04beb
...@@ -210,7 +210,7 @@ class ProjectsController < ApplicationController ...@@ -210,7 +210,7 @@ class ProjectsController < ApplicationController
def project_params def project_params
params.require(:project).permit( params.require(:project).permit(
:name, :path, :description, :issues_tracker, :tag_list, :token, :name, :path, :description, :issues_tracker, :tag_list, :runners_token,
:issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch, :issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch,
:wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar, :wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar,
:builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
......
...@@ -194,7 +194,7 @@ module Ci ...@@ -194,7 +194,7 @@ module Ci
def trace def trace
trace = raw_trace trace = raw_trace
if project && trace.present? if project && trace.present?
trace.gsub(project.token, 'xxxxxx') trace.gsub(project.runners_token, 'xxxxxx')
else else
trace trace
end end
...@@ -221,7 +221,7 @@ module Ci ...@@ -221,7 +221,7 @@ module Ci
end end
def token def token
project.token project.runners_token
end end
def valid_token? token def valid_token? token
......
...@@ -163,9 +163,9 @@ ...@@ -163,9 +163,9 @@
%legend %legend
Advanced settings Advanced settings
.form-group .form-group
= f.label :token, "CI token", class: 'control-label' = f.label :runners_token, "CI token", class: 'control-label'
.col-sm-10 .col-sm-10
= f.text_field :token, class: "form-control", placeholder: 'xEeFCaDAB89' = f.text_field :runners_token, class: "form-control", placeholder: 'xEeFCaDAB89'
%p.help-block The secure token used to checkout project. %p.help-block The secure token used to checkout project.
.form-actions .form-actions
......
...@@ -37,15 +37,6 @@ module Ci ...@@ -37,15 +37,6 @@ module Ci
expose :id, :token expose :id, :token
end end
class Project < Grape::Entity
expose :id, :name, :token, :default_ref, :gitlab_url, :path,
:always_build, :polling_interval, :public, :ssh_url_to_repo, :gitlab_id
expose :timeout do |model|
model.timeout
end
end
class RunnerProject < Grape::Entity class RunnerProject < Grape::Entity
expose :id, :project_id, :runner_id expose :id, :project_id, :runner_id
end end
......
...@@ -191,10 +191,10 @@ describe Grack::Auth, lib: true do ...@@ -191,10 +191,10 @@ describe Grack::Auth, lib: true do
context "when a gitlab ci token is provided" do context "when a gitlab ci token is provided" do
let(:token) { "123" } let(:token) { "123" }
let(:project) { FactoryGirl.create :empty_project, token: token } let(:project) { FactoryGirl.create :empty_project }
before do before do
project.update_attributes(token: token, builds_enabled: true) project.update_attributes(runners_token: token, builds_enabled: true)
env["HTTP_AUTHORIZATION"] = ActionController::HttpAuthentication::Basic.encode_credentials("gitlab-ci-token", token) env["HTTP_AUTHORIZATION"] = ActionController::HttpAuthentication::Basic.encode_credentials("gitlab-ci-token", token)
end end
......
...@@ -111,7 +111,7 @@ describe Ci::Build, models: true do ...@@ -111,7 +111,7 @@ describe Ci::Build, models: true do
let(:token) { 'my_secret_token' } let(:token) { 'my_secret_token' }
before do before do
build.project.update_attributes(token: token) build.project.update_attributes(runners_token: token)
build.update_attributes(trace: token) build.update_attributes(trace: token)
end end
......
...@@ -98,13 +98,13 @@ describe Project, models: true do ...@@ -98,13 +98,13 @@ describe Project, models: true do
describe 'project token' do describe 'project token' do
it 'should set an random token if none provided' do it 'should set an random token if none provided' do
project = FactoryGirl.create :empty_project, token: '' project = FactoryGirl.create :empty_project, runners_token: ''
expect(project.token).not_to eq('') expect(project.runners_token).not_to eq('')
end end
it 'should not set an random toke if one provided' do it 'should not set an random toke if one provided' do
project = FactoryGirl.create :empty_project, token: 'my-token' project = FactoryGirl.create :empty_project, runners_token: 'my-token'
expect(project.token).to eq('my-token') expect(project.runners_token).to eq('my-token')
end end
end end
......
...@@ -131,7 +131,7 @@ describe Ci::API::API do ...@@ -131,7 +131,7 @@ describe Ci::API::API do
let(:delete_url) { ci_api("/builds/#{build.id}/artifacts") } let(:delete_url) { ci_api("/builds/#{build.id}/artifacts") }
let(:get_url) { ci_api("/builds/#{build.id}/artifacts") } let(:get_url) { ci_api("/builds/#{build.id}/artifacts") }
let(:headers) { { "GitLab-Workhorse" => "1.0" } } let(:headers) { { "GitLab-Workhorse" => "1.0" } }
let(:headers_with_token) { headers.merge(Ci::API::Helpers::BUILD_TOKEN_HEADER => build.project.token) } let(:headers_with_token) { headers.merge(Ci::API::Helpers::BUILD_TOKEN_HEADER => build.token) }
describe "POST /builds/:id/artifacts/authorize" do describe "POST /builds/:id/artifacts/authorize" do
context "should authorize posting artifact to running build" do context "should authorize posting artifact to running build" do
...@@ -140,7 +140,7 @@ describe Ci::API::API do ...@@ -140,7 +140,7 @@ describe Ci::API::API do
end end
it "using token as parameter" do it "using token as parameter" do
post authorize_url, { token: build.project.token }, headers post authorize_url, { token: build.token }, headers
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response["TempPath"]).to_not be_nil expect(json_response["TempPath"]).to_not be_nil
end end
...@@ -159,7 +159,7 @@ describe Ci::API::API do ...@@ -159,7 +159,7 @@ describe Ci::API::API do
it "using token as parameter" do it "using token as parameter" do
stub_application_setting(max_artifacts_size: 0) stub_application_setting(max_artifacts_size: 0)
post authorize_url, { token: build.project.token, filesize: 100 }, headers post authorize_url, { token: build.token, filesize: 100 }, headers
expect(response.status).to eq(413) expect(response.status).to eq(413)
end end
...@@ -239,7 +239,7 @@ describe Ci::API::API do ...@@ -239,7 +239,7 @@ describe Ci::API::API do
end end
it do it do
post post_url, { token: build.project.token }, {} post post_url, { token: build.token }, {}
expect(response.status).to eq(403) expect(response.status).to eq(403)
end end
end end
...@@ -279,12 +279,12 @@ describe Ci::API::API do ...@@ -279,12 +279,12 @@ describe Ci::API::API do
describe "DELETE /builds/:id/artifacts" do describe "DELETE /builds/:id/artifacts" do
before do before do
build.run! build.run!
post delete_url, token: build.project.token, file: file_upload post delete_url, token: build.token, file: file_upload
end end
it "should delete artifact build" do it "should delete artifact build" do
build.success build.success
delete delete_url, token: build.project.token delete delete_url, token: build.token
expect(response.status).to eq(200) expect(response.status).to eq(200)
end end
end end
...@@ -296,12 +296,12 @@ describe Ci::API::API do ...@@ -296,12 +296,12 @@ describe Ci::API::API do
it "should download artifact" do it "should download artifact" do
build.update_attributes(artifacts_file: file_upload) build.update_attributes(artifacts_file: file_upload)
get get_url, token: build.project.token get get_url, token: build.token
expect(response.status).to eq(200) expect(response.status).to eq(200)
end end
it "should fail to download if no artifact uploaded" do it "should fail to download if no artifact uploaded" do
get get_url, token: build.project.token get get_url, token: build.token
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
end end
......
...@@ -31,7 +31,7 @@ describe Ci::API::API do ...@@ -31,7 +31,7 @@ describe Ci::API::API do
describe "should create a runner if project token provided" do describe "should create a runner if project token provided" do
let(:project) { FactoryGirl.create(:empty_project) } let(:project) { FactoryGirl.create(:empty_project) }
before { post ci_api("/runners/register"), token: project.token } before { post ci_api("/runners/register"), token: project.runners_token }
it { expect(response.status).to eq(201) } it { expect(response.status).to eq(201) }
it { expect(project.runners.size).to eq(1) } it { expect(project.runners.size).to eq(1) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment