BigW Consortium Gitlab

Commit 513d551c by Kamil Trzcinski

Fix after column rename

parent 73b04beb
......@@ -210,7 +210,7 @@ class ProjectsController < ApplicationController
def project_params
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,
: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,
......
......@@ -194,7 +194,7 @@ module Ci
def trace
trace = raw_trace
if project && trace.present?
trace.gsub(project.token, 'xxxxxx')
trace.gsub(project.runners_token, 'xxxxxx')
else
trace
end
......@@ -221,7 +221,7 @@ module Ci
end
def token
project.token
project.runners_token
end
def valid_token? token
......
......@@ -163,9 +163,9 @@
%legend
Advanced settings
.form-group
= f.label :token, "CI token", class: 'control-label'
= f.label :runners_token, "CI token", class: 'control-label'
.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.
.form-actions
......
......@@ -37,15 +37,6 @@ module Ci
expose :id, :token
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
expose :id, :project_id, :runner_id
end
......
......@@ -191,10 +191,10 @@ describe Grack::Auth, lib: true do
context "when a gitlab ci token is provided" do
let(:token) { "123" }
let(:project) { FactoryGirl.create :empty_project, token: token }
let(:project) { FactoryGirl.create :empty_project }
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)
end
......
......@@ -111,7 +111,7 @@ describe Ci::Build, models: true do
let(:token) { 'my_secret_token' }
before do
build.project.update_attributes(token: token)
build.project.update_attributes(runners_token: token)
build.update_attributes(trace: token)
end
......
......@@ -98,13 +98,13 @@ describe Project, models: true do
describe 'project token' do
it 'should set an random token if none provided' do
project = FactoryGirl.create :empty_project, token: ''
expect(project.token).not_to eq('')
project = FactoryGirl.create :empty_project, runners_token: ''
expect(project.runners_token).not_to eq('')
end
it 'should not set an random toke if one provided' do
project = FactoryGirl.create :empty_project, token: 'my-token'
expect(project.token).to eq('my-token')
project = FactoryGirl.create :empty_project, runners_token: 'my-token'
expect(project.runners_token).to eq('my-token')
end
end
......
......@@ -131,7 +131,7 @@ describe Ci::API::API do
let(:delete_url) { ci_api("/builds/#{build.id}/artifacts") }
let(:get_url) { ci_api("/builds/#{build.id}/artifacts") }
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
context "should authorize posting artifact to running build" do
......@@ -140,7 +140,7 @@ describe Ci::API::API do
end
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(json_response["TempPath"]).to_not be_nil
end
......@@ -159,7 +159,7 @@ describe Ci::API::API do
it "using token as parameter" do
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)
end
......@@ -239,7 +239,7 @@ describe Ci::API::API do
end
it do
post post_url, { token: build.project.token }, {}
post post_url, { token: build.token }, {}
expect(response.status).to eq(403)
end
end
......@@ -279,12 +279,12 @@ describe Ci::API::API do
describe "DELETE /builds/:id/artifacts" do
before do
build.run!
post delete_url, token: build.project.token, file: file_upload
post delete_url, token: build.token, file: file_upload
end
it "should delete artifact build" do
build.success
delete delete_url, token: build.project.token
delete delete_url, token: build.token
expect(response.status).to eq(200)
end
end
......@@ -296,12 +296,12 @@ describe Ci::API::API do
it "should download artifact" do
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)
end
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)
end
end
......
......@@ -31,7 +31,7 @@ describe Ci::API::API do
describe "should create a runner if project token provided" do
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(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