Commit afd5cfef authored by mo khan's avatar mo khan Committed by Ash McKenzie

Use `denied` instead of `blocked`

parent cd68506c
...@@ -93,32 +93,32 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -93,32 +93,32 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
.add_dependency('rails') .add_dependency('rails')
end end
context 'when a blocked license is found in the report' do context 'when a denied license is found in the report' do
let(:mit_blocklist) { build(:software_license_policy, :denied, software_license: mit_license) } let(:denied_policy) { build(:software_license_policy, :denied, software_license: mit_license) }
before do before do
project.software_license_policies << mit_blocklist project.software_license_policies << denied_policy
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
context 'when a blocked license is discovered with a different casing for the name' do context 'when a denied license is discovered with a different casing for the name' do
let(:mit_blocklist) { build(:software_license_policy, :denied, software_license: mit_license) } let(:denied_policy) { build(:software_license_policy, :denied, software_license: mit_license) }
before do before do
mit_license.update!(name: 'mit') mit_license.update!(name: 'mit')
project.software_license_policies << mit_blocklist project.software_license_policies << denied_policy
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
context 'when none of the licenses discovered in the report violate the blocklist policy' do context 'when none of the licenses discovered in the report violate the denied policy' do
let(:apache_blocklist) { build(:software_license_policy, :denied, software_license: apache_license) } let(:denied_policy) { build(:software_license_policy, :denied, software_license: apache_license) }
before do before do
project.software_license_policies << apache_blocklist project.software_license_policies << denied_policy
end end
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
...@@ -128,7 +128,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -128,7 +128,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context "when checking for violations using the v2 license scan reports" do context "when checking for violations using the v2 license scan reports" do
let(:report) { build(:license_scan_report) } let(:report) { build(:license_scan_report) }
context "when a blocked license with a SPDX identifier is also in the report" do context "when a denied license with a SPDX identifier is also in the report" do
let(:mit_spdx_id) { 'MIT' } let(:mit_spdx_id) { 'MIT' }
let(:mit_license) { build(:software_license, :mit, spdx_identifier: mit_spdx_id) } let(:mit_license) { build(:software_license, :mit, spdx_identifier: mit_spdx_id) }
let(:mit_policy) { build(:software_license_policy, :denied, software_license: mit_license) } let(:mit_policy) { build(:software_license_policy, :denied, software_license: mit_license) }
...@@ -141,7 +141,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -141,7 +141,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
context "when a blocked license does not have an SPDX identifier because it was provided by an end user" do context "when a denied license does not have an SPDX identifier because it was provided by an end user" do
let(:custom_license) { build(:software_license, name: 'custom', spdx_identifier: nil) } let(:custom_license) { build(:software_license, name: 'custom', spdx_identifier: nil) }
let(:custom_policy) { build(:software_license_policy, :denied, software_license: custom_license) } let(:custom_policy) { build(:software_license_policy, :denied, software_license: custom_license) }
...@@ -153,7 +153,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -153,7 +153,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
context "when none of the licenses discovered match any of the blocklist software policies" do context "when none of the licenses discovered match any of the denied software policies" do
let(:apache_license) { build(:software_license, :apache_2_0, spdx_identifier: 'Apache-2.0') } let(:apache_license) { build(:software_license, :apache_2_0, spdx_identifier: 'Apache-2.0') }
let(:apache_policy) { build(:software_license_policy, :denied, software_license: apache_license) } let(:apache_policy) { build(:software_license_policy, :denied, software_license: apache_license) }
......
...@@ -62,12 +62,12 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do ...@@ -62,12 +62,12 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
end end
context "license compliance policy" do context "license compliance policy" do
let!(:software_license_policy) { create(:software_license_policy, :denied, project: project, software_license: blocked_license) } let!(:software_license_policy) { create(:software_license_policy, :denied, project: project, software_license: denied_license) }
let!(:license_compliance_rule) { create(:report_approver_rule, :license_management, merge_request: merge_request, approvals_required: 1) } let!(:license_compliance_rule) { create(:report_approver_rule, :license_management, merge_request: merge_request, approvals_required: 1) }
let!(:blocked_license) { create(:software_license) } let!(:denied_license) { create(:software_license) }
context "when a license violates the license compliance policy" do context "when a license violates the license compliance policy" do
let!(:blocked_license) { create(:software_license, name: license_name) } let!(:denied_license) { create(:software_license, name: license_name) }
let!(:ci_build) { create(:ee_ci_build, :success, :license_management, pipeline: pipeline, project: project) } let!(:ci_build) { create(:ee_ci_build, :success, :license_management, pipeline: pipeline, project: project) }
let!(:license_name) { ci_build.pipeline.license_scanning_report.license_names[0] } let!(:license_name) { ci_build.pipeline.license_scanning_report.license_names[0] }
...@@ -139,9 +139,9 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do ...@@ -139,9 +139,9 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
end end
context "license compliance policy" do context "license compliance policy" do
let!(:software_license_policy) { create(:software_license_policy, :denied, project: project, software_license: blocked_license) } let!(:software_license_policy) { create(:software_license_policy, :denied, project: project, software_license: denied_license) }
let!(:license_compliance_rule) { create(:report_approver_rule, :license_management, merge_request: merge_request, approvals_required: 1) } let!(:license_compliance_rule) { create(:report_approver_rule, :license_management, merge_request: merge_request, approvals_required: 1) }
let!(:blocked_license) { create(:software_license) } let!(:denied_license) { create(:software_license) }
specify { expect { subject }.not_to change { license_compliance_rule.reload.approvals_required } } specify { expect { subject }.not_to change { license_compliance_rule.reload.approvals_required } }
specify { expect(subject[:status]).to be(:success) } specify { expect(subject[:status]).to be(:success) }
......
...@@ -21,10 +21,10 @@ describe RefreshLicenseComplianceChecksWorker do ...@@ -21,10 +21,10 @@ describe RefreshLicenseComplianceChecksWorker do
let!(:closed_merge_request_approval_rule) { create(:report_approver_rule, :license_management, merge_request: closed_merge_request, approvals_required: 0) } let!(:closed_merge_request_approval_rule) { create(:report_approver_rule, :license_management, merge_request: closed_merge_request, approvals_required: 0) }
let!(:project_approval_rule) { create(:approval_project_rule, :requires_approval, :license_management, project: project) } let!(:project_approval_rule) { create(:approval_project_rule, :requires_approval, :license_management, project: project) }
context "when a license is blocked, that appears in some of the license management reports" do context "when a license is denied, that appears in some of the license management reports" do
let!(:open_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [open_merge_request]) } let!(:open_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [open_merge_request]) }
let!(:closed_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [closed_merge_request]) } let!(:closed_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [closed_merge_request]) }
let!(:blocked_policy) { create(:software_license_policy, :denied, project: project, software_license: license) } let!(:denied_policy) { create(:software_license_policy, :denied, project: project, software_license: license) }
let(:license) { create(:software_license, name: license_report.license_names[0]) } let(:license) { create(:software_license, name: license_report.license_names[0]) }
let(:license_report) { open_pipeline.license_scanning_report } let(:license_report) { open_pipeline.license_scanning_report }
...@@ -36,10 +36,10 @@ describe RefreshLicenseComplianceChecksWorker do ...@@ -36,10 +36,10 @@ describe RefreshLicenseComplianceChecksWorker do
specify { expect(closed_merge_request_approval_rule.reload.approvals_required).to be_zero } specify { expect(closed_merge_request_approval_rule.reload.approvals_required).to be_zero }
end end
context "when none of the blocked licenses appear in the most recent license management reports" do context "when none of the denied licenses appear in the most recent license management reports" do
let!(:open_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [open_merge_request]) } let!(:open_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [open_merge_request]) }
let!(:closed_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [closed_merge_request]) } let!(:closed_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [closed_merge_request]) }
let!(:blocked_policy) { create(:software_license_policy, :denied, project: project, software_license: license) } let!(:denied_policy) { create(:software_license_policy, :denied, project: project, software_license: license) }
let(:license) { create(:software_license, name: SecureRandom.uuid) } let(:license) { create(:software_license, name: SecureRandom.uuid) }
before do before 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