Commit 1198cf60 authored by Fernando's avatar Fernando

Fix bad merge conflict resolution

parent e04b74bd
- return unless @project.feature_available?(:license_scanning)
- expanded = expanded_by_default?
%section.settings.no-animate#js-license-management{ class: ('expanded' if expanded), data: { qa_selector: 'license_compliance_settings_content' } }
.settings-header
%h4
= s_('LicenseCompliance|License Compliance')
= link_to icon('question-circle'), help_page_path('user/compliance/license_compliance/index'), target: '_blank', rel: 'noopener noreferrer'
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
- ci = link_to(s_('Gitlab CI/CD'), 'https://docs.gitlab.com/ee/ci/', target: '_blank', rel: 'noopener noreferrer')
- license = link_to(s_('Auto License Compliance'), 'https://docs.gitlab.com/ee/topics/autodevops/index.html#auto-license-management-ultimate', target: '_blank', rel: 'noopener noreferrer')
= s_('LicenseCompliance|Here you can allow or deny licenses for this project. Using %{ci} or %{license} will allow you to see if there are any unmanaged licenses and allow or deny them in merge request.').html_safe % { ci: ci, license: license }
.settings-content
#js-managed-licenses{ data: { api_url: @license_management_url } }
# frozen_string_literal: true
module QA
module EE
module Page
module Project
module Settings
module CICD
extend QA::Page::PageConcern
def self.prepended(base)
super
base.class_eval do
view 'ee/app/views/projects/settings/ci_cd/_managed_licenses.html.haml' do
element :license_compliance_settings_content
end
end
end
def expand_license_compliance(&block)
expand_section(:license_compliance_settings_content) do
Settings::LicenseCompliance.perform(&block)
end
end
end
end
end
end
end
end
# frozen_string_literal: true
require 'pathname'
module QA
context 'Secure', :docker, :runner do
let(:approved_license_name) { "MIT License" }
let(:denied_license_name) { "WTFPL" }
describe 'License Compliance settings page' do
before do
Flow::Login.sign_in
@project = Resource::Project.fabricate_via_api! do |project|
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure'
end
@project.visit!
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform(&:expand_license_compliance)
end
it 'can approve a license in the settings page' do
QA::EE::Page::Project::Settings::LicenseCompliance.perform do |license_compliance|
license_compliance.approve_license approved_license_name
expect(license_compliance).to have_approved_license approved_license_name
end
end
it 'can deny a license in the settings page' do
QA::EE::Page::Project::Settings::LicenseCompliance.perform do |license_compliance|
license_compliance.deny_license denied_license_name
expect(license_compliance).to have_denied_license denied_license_name
end
end
end
describe 'License Compliance pipeline reports' do
let(:number_of_licenses_in_fixture) { 2 }
after do
@runner.remove_via_api!
end
before do
@executor = "qa-runner-#{Time.now.to_i}"
Flow::Login.sign_in
@project = Resource::Project.fabricate_via_api! do |project|
project.name = Runtime::Env.auto_devops_project_name || 'project-with-secure'
project.description = 'Project with Secure'
end
@runner = Resource::Runner.fabricate! do |runner|
runner.project = @project
runner.name = @executor
runner.tags = %w[qa test]
end
# Push fixture to generate Secure reports
Resource::Repository::ProjectPush.fabricate! do |project_push|
project_push.project = @project
project_push.directory = Pathname
.new(__dir__)
.join('../../../../../ee/fixtures/secure_premade_reports')
project_push.commit_message = 'Create Secure compatible application to serve premade reports'
end.project.visit!
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform(&:expand_license_compliance)
QA::EE::Page::Project::Settings::LicenseCompliance.perform do |license_compliance|
license_compliance.approve_license approved_license_name
license_compliance.deny_license denied_license_name
end
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success)
end
it 'displays license approval status in the pipeline' do
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline)
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_on_licenses
expect(pipeline).to have_license_count_of number_of_licenses_in_fixture
expect(pipeline).to have_approved_license approved_license_name
expect(pipeline).to have_blacklisted_license denied_license_name
end
end
end
end
end
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