Commit 28e91aea authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Dmytro Zaporozhets

Use `license_scanning` feature

All code related to `license_management` is scheduled
to be deprecated after 13.0 https://gitlab.com/gitlab-org/gitlab/-/issues/8912
parent 5e05c233
......@@ -73,7 +73,7 @@ module EE
each_report(::Ci::JobArtifact::LICENSE_SCANNING_REPORT_FILE_TYPES) do |file_type, blob|
next if ::Feature.disabled?(:parse_license_management_reports, default_enabled: true)
next unless project.feature_available?(:license_management)
next unless project.feature_available?(:license_scanning) || project.feature_available?(:license_management)
::Gitlab::Ci::Parsers.fabricate!(file_type).parse!(blob, license_scanning_report)
end
......
......@@ -45,8 +45,8 @@ module EE
container_scanning: %i[container_scanning sast_container],
dast: %i[dast],
performance: %i[merge_request_performance_metrics],
license_management: %i[license_management],
license_scanning: %i[license_management],
license_management: %i[license_scanning license_management],
license_scanning: %i[license_scanning license_management],
metrics: %i[metrics_reports]
}.freeze
......
......@@ -22,7 +22,7 @@ describe Projects::DependenciesController do
context 'when feature is available' do
before do
stub_licensed_features(dependency_scanning: true, license_management: true, security_dashboard: true)
stub_licensed_features(dependency_scanning: true, license_scanning: true, security_dashboard: true)
end
context 'when requesting HTML' do
......
......@@ -16,7 +16,7 @@ describe Projects::LicensesController do
context 'with authorized user' do
context 'when feature is available' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context 'with reporter' do
......@@ -280,7 +280,7 @@ describe Projects::LicensesController do
context 'with unauthorized user' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
get_licenses
end
......@@ -309,7 +309,7 @@ describe Projects::LicensesController do
let(:current_user) { create(:user) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
sign_in(current_user)
end
......@@ -427,7 +427,7 @@ describe Projects::LicensesController do
let(:current_user) { create(:user) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
sign_in(current_user)
end
......
......@@ -84,7 +84,7 @@ describe Projects::PipelinesController do
context 'with feature enabled' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
licenses_with_html
end
......@@ -96,7 +96,7 @@ describe Projects::PipelinesController do
context 'with feature enabled json' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
it 'will return license management report in json format' do
......@@ -141,7 +141,7 @@ describe Projects::PipelinesController do
context 'without license management artifact' do
context 'with feature enabled' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
licenses_with_html
end
......@@ -152,7 +152,7 @@ describe Projects::PipelinesController do
context 'with feature enabled json' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
licenses_with_json
end
......
......@@ -11,7 +11,7 @@ describe 'EE > Projects > Licenses > Maintainer views policies', :js do
end
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
sign_in(maintainer)
visit(project_licenses_path(project))
......
......@@ -131,7 +131,7 @@ describe 'Pipeline', :js do
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context 'with a License Compliance artifact' do
......
......@@ -15,7 +15,7 @@ describe SoftwareLicensePoliciesFinder do
let(:finder) { described_class.new(user, project, params) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context 'searched by name' do
......
......@@ -369,7 +369,7 @@ describe ApprovalMergeRequestRule do
describe "#refresh_required_approvals!" do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context "when the rule is a `#{ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT}` rule" do
......
......@@ -198,7 +198,7 @@ describe Ci::Build do
let(:license_scanning_report) { Gitlab::Ci::Reports::LicenseScanning::Report.new }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
it { expect(license_scanning_report.licenses.count).to eq(0) }
......@@ -243,7 +243,7 @@ describe Ci::Build do
context 'when the license management feature is disabled' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
create(:ee_ci_job_artifact, :license_management, job: job, project: job.project)
end
......@@ -344,7 +344,7 @@ describe Ci::Build do
context 'when license does not have metrics_reports' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
it 'does not parse metrics report' do
......
......@@ -91,7 +91,7 @@ describe Ci::Pipeline do
context 'with license compliance artifact' do
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
[:license_management, :license_scanning].each do |artifact_type|
......@@ -120,7 +120,7 @@ describe Ci::Pipeline do
subject { pipeline.expose_license_scanning_data? }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
[:license_scanning, :license_management].each do |artifact_type|
......@@ -247,7 +247,7 @@ describe Ci::Pipeline do
subject { pipeline.license_scanning_report }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context 'when pipeline has multiple builds with license management reports' do
......
......@@ -10,7 +10,7 @@ RSpec.describe SCA::LicenseCompliance do
let(:other_license) { create(:software_license, spdx_identifier: "Other-Id") }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
describe "#policies" do
......
......@@ -21,7 +21,7 @@ describe ProjectPolicy do
project.add_developer(developer)
project.add_reporter(reporter)
project.add_guest(guest)
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context 'basic permissions' do
......@@ -68,7 +68,7 @@ describe ProjectPolicy do
let(:current_user) { create(:user, :auditor) }
before do
stub_licensed_features(security_dashboard: true, license_management: true, threat_monitoring: true)
stub_licensed_features(security_dashboard: true, license_scanning: true, threat_monitoring: true)
end
context 'who is not a team member' do
......@@ -696,7 +696,7 @@ describe ProjectPolicy do
describe 'admin_license_management' do
context 'without license management feature available' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
let(:current_user) { admin }
......@@ -756,7 +756,7 @@ describe ProjectPolicy do
describe 'read_software_license_policy' do
context 'without license management feature available' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
let(:current_user) { admin }
......@@ -890,7 +890,7 @@ describe ProjectPolicy do
context 'when license management feature in not available' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
let(:current_user) { admin }
......
......@@ -30,7 +30,7 @@ describe Ci::PipelinePresenter do
context 'when features are available' do
before do
stub_licensed_features(dependency_scanning: true, license_management: true)
stub_licensed_features(dependency_scanning: true, license_scanning: true)
end
context 'when there is an artifact of a right type' do
......
......@@ -10,7 +10,7 @@ describe API::ManagedLicenses do
let_it_be(:software_license_policy) { create(:software_license_policy, project: project) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
project.add_maintainer(maintainer_user)
project.add_developer(dev_user)
project.add_reporter(reporter_user)
......@@ -19,7 +19,7 @@ describe API::ManagedLicenses do
describe 'GET /projects/:id/managed_licenses' do
context 'with license management not available' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
it 'returns a forbidden status' do
......
......@@ -18,7 +18,7 @@ describe DependencyEntity do
context 'when all required features available' do
before do
stub_licensed_features(security_dashboard: true, license_management: true)
stub_licensed_features(security_dashboard: true, license_scanning: true)
allow(request).to receive(:project).and_return(project)
allow(request).to receive(:user).and_return(user)
end
......
......@@ -13,7 +13,7 @@ describe DependencyListSerializer do
end
before do
stub_licensed_features(security_dashboard: true, license_management: true)
stub_licensed_features(security_dashboard: true, license_scanning: true)
project.add_developer(user)
end
......
......@@ -7,7 +7,7 @@ describe LicensesListEntity do
let(:license_compliance) { ::SCA::LicenseCompliance.new(project) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
it_behaves_like 'report list' do
......
......@@ -18,7 +18,7 @@ describe LicensesListSerializer do
before do
project.add_guest(user)
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
it { is_expected.to match_schema('licenses_list', dir: 'ee') }
......
......@@ -124,7 +124,7 @@ describe MergeRequestWidgetEntity do
context 'when feature is not licensed' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
it 'is not included' do
......@@ -178,7 +178,7 @@ describe MergeRequestWidgetEntity do
describe '#license_scanning', :request_store do
before do
allow(merge_request).to receive_messages(head_pipeline: pipeline, target_project: project)
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
it 'is not included, if missing artifacts' do
......@@ -201,7 +201,7 @@ describe MergeRequestWidgetEntity do
context 'when feature is not licensed' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
it 'is not included' do
......@@ -238,7 +238,7 @@ describe MergeRequestWidgetEntity do
before do
allow(fork_merge_request).to receive_messages(head_pipeline: pipeline)
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
it 'is a path for target project' do
......
......@@ -8,7 +8,7 @@ describe Ci::CompareLicenseScanningReportsService do
let(:project) { create(:project, :repository) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
describe '#execute' do
......
......@@ -15,7 +15,7 @@ describe Projects::Licenses::UpdatePolicyService do
context "when the user is authorized" do
before do
allow(RefreshLicenseComplianceChecksWorker).to receive(:perform_async)
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
project.add_maintainer(user)
end
......
......@@ -13,7 +13,7 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
before do
allow(Ci::Pipeline).to receive(:find).with(pipeline.id) { pipeline }
stub_licensed_features(dependency_scanning: true, dast: true, license_management: true)
stub_licensed_features(dependency_scanning: true, dast: true, license_scanning: true)
end
context 'when there are reports' do
......
......@@ -13,7 +13,7 @@ describe SoftwareLicensePolicies::CreateService do
end
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
subject { described_class.new(project, user, params) }
......@@ -21,7 +21,7 @@ describe SoftwareLicensePolicies::CreateService do
describe '#execute' do
context 'with license management unavailable' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
it 'does not creates a software license policy' do
......
......@@ -14,7 +14,7 @@ describe SoftwareLicensePolicies::UpdateService do
let(:software_license_policy) { create(:software_license_policy, :denied) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
describe '#execute' do
......@@ -29,7 +29,7 @@ describe SoftwareLicensePolicies::UpdateService do
context 'with license management unavailable' do
before do
stub_licensed_features(license_management: false)
stub_licensed_features(license_scanning: false)
end
it 'does not update the software license policy' do
......
......@@ -9,7 +9,7 @@ describe RefreshLicenseComplianceChecksWorker do
let(:project) { create(:project) }
before do
stub_licensed_features(license_management: true)
stub_licensed_features(license_scanning: true)
end
context "when there are merge requests associated with the project" 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