Commit dc606b39 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add integrations tests for pipeline security page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 972d6ff4
class Projects::PipelinesController < Projects::ApplicationController class Projects::PipelinesController < Projects::ApplicationController
prepend ::EE::Projects::PipelinesController
before_action :whitelist_query_limiting, only: [:create, :retry] before_action :whitelist_query_limiting, only: [:create, :retry]
before_action :pipeline, except: [:index, :new, :create, :charts] before_action :pipeline, except: [:index, :new, :create, :charts]
before_action :commit, only: [:show, :builds, :failures, :security] before_action :commit, only: [:show, :builds, :failures, :security]
...@@ -94,14 +96,6 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -94,14 +96,6 @@ class Projects::PipelinesController < Projects::ApplicationController
end end
end end
def security
if @pipeline.sast_artifact
render_show
else
redirect_to pipeline_path(@pipeline)
end
end
def status def status
render json: PipelineSerializer render json: PipelineSerializer
.new(project: @project, current_user: @current_user) .new(project: @project, current_user: @current_user)
......
module EE
module Projects
module PipelinesController
extend ActiveSupport::Concern
def security
if @pipeline.sast_artifact
render_show
else
redirect_to pipeline_path(@pipeline)
end
end
end
end
end
require 'spec_helper'
describe Projects::PipelinesController do
set(:user) { create(:user) }
set(:project) { create(:project, :repository) }
before do
project.add_developer(user)
sign_in(user)
end
describe 'GET security' do
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
let(:build) do
create(
:ci_build,
:artifacts,
name: 'sast',
pipeline: pipeline,
options: {
artifacts: {
paths: [Ci::Build::SAST_FILE]
}
}
)
end
before do
build
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
end
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template :show
end
end
end
require 'spec_helper' require 'spec_helper'
describe 'Pipeline', :js do describe 'Pipeline', :js do
let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
before do before do
sign_in(user) sign_in(user)
...@@ -10,7 +10,6 @@ describe 'Pipeline', :js do ...@@ -10,7 +10,6 @@ describe 'Pipeline', :js do
end end
describe 'GET /:project/pipelines/:id/security' do describe 'GET /:project/pipelines/:id/security' do
let(:project) { create(:project, :repository) }
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) } let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
let(:build) do let(:build) do
......
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