Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
afd5cfef
Commit
afd5cfef
authored
Dec 06, 2019
by
mo khan
Committed by
Ash McKenzie
Dec 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `denied` instead of `blocked`
parent
cd68506c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
ee/spec/lib/gitlab/ci/reports/license_scanning/report_spec.rb
...pec/lib/gitlab/ci/reports/license_scanning/report_spec.rb
+12
-12
ee/spec/services/security/sync_reports_to_approval_rules_service_spec.rb
...s/security/sync_reports_to_approval_rules_service_spec.rb
+5
-5
ee/spec/workers/refresh_license_compliance_checks_worker_spec.rb
.../workers/refresh_license_compliance_checks_worker_spec.rb
+4
-4
No files found.
ee/spec/lib/gitlab/ci/reports/license_scanning/report_spec.rb
View file @
afd5cfef
...
...
@@ -93,32 +93,32 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
.
add_dependency
(
'rails'
)
end
context
'when a
block
ed license is found in the report'
do
let
(
:
mit_blocklist
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
mit_license
)
}
context
'when a
deni
ed license is found in the report'
do
let
(
:
denied_policy
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
mit_license
)
}
before
do
project
.
software_license_policies
<<
mit_blocklist
project
.
software_license_policies
<<
denied_policy
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when a
block
ed license is discovered with a different casing for the name'
do
let
(
:
mit_blocklist
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
mit_license
)
}
context
'when a
deni
ed license is discovered with a different casing for the name'
do
let
(
:
denied_policy
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
mit_license
)
}
before
do
mit_license
.
update!
(
name:
'mit'
)
project
.
software_license_policies
<<
mit_blocklist
project
.
software_license_policies
<<
denied_policy
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when none of the licenses discovered in the report violate the
blocklist
policy'
do
let
(
:
apache_blocklist
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
apache_license
)
}
context
'when none of the licenses discovered in the report violate the
denied
policy'
do
let
(
:
denied_policy
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
apache_license
)
}
before
do
project
.
software_license_policies
<<
apache_blocklist
project
.
software_license_policies
<<
denied_policy
end
it
{
is_expected
.
to
be_falsey
}
...
...
@@ -128,7 +128,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context
"when checking for violations using the v2 license scan reports"
do
let
(
:report
)
{
build
(
:license_scan_report
)
}
context
"when a
block
ed license with a SPDX identifier is also in the report"
do
context
"when a
deni
ed license with a SPDX identifier is also in the report"
do
let
(
:mit_spdx_id
)
{
'MIT'
}
let
(
:mit_license
)
{
build
(
:software_license
,
:mit
,
spdx_identifier:
mit_spdx_id
)
}
let
(
:mit_policy
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
mit_license
)
}
...
...
@@ -141,7 +141,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
it
{
is_expected
.
to
be_truthy
}
end
context
"when a
block
ed license does not have an SPDX identifier because it was provided by an end user"
do
context
"when a
deni
ed 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_policy
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
custom_license
)
}
...
...
@@ -153,7 +153,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
it
{
is_expected
.
to
be_truthy
}
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_policy
)
{
build
(
:software_license_policy
,
:denied
,
software_license:
apache_license
)
}
...
...
ee/spec/services/security/sync_reports_to_approval_rules_service_spec.rb
View file @
afd5cfef
...
...
@@ -62,12 +62,12 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
end
context
"license compliance policy"
do
let!
(
:software_license_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
block
ed_license
)
}
let!
(
:software_license_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
deni
ed_license
)
}
let!
(
:license_compliance_rule
)
{
create
(
:report_approver_rule
,
:license_management
,
merge_request:
merge_request
,
approvals_required:
1
)
}
let!
(
:
block
ed_license
)
{
create
(
:software_license
)
}
let!
(
:
deni
ed_license
)
{
create
(
:software_license
)
}
context
"when a license violates the license compliance policy"
do
let!
(
:
block
ed_license
)
{
create
(
:software_license
,
name:
license_name
)
}
let!
(
:
deni
ed_license
)
{
create
(
:software_license
,
name:
license_name
)
}
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
]
}
...
...
@@ -139,9 +139,9 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
end
context
"license compliance policy"
do
let!
(
:software_license_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
block
ed_license
)
}
let!
(
:software_license_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
deni
ed_license
)
}
let!
(
:license_compliance_rule
)
{
create
(
:report_approver_rule
,
:license_management
,
merge_request:
merge_request
,
approvals_required:
1
)
}
let!
(
:
block
ed_license
)
{
create
(
:software_license
)
}
let!
(
:
deni
ed_license
)
{
create
(
:software_license
)
}
specify
{
expect
{
subject
}.
not_to
change
{
license_compliance_rule
.
reload
.
approvals_required
}
}
specify
{
expect
(
subject
[
:status
]).
to
be
(
:success
)
}
...
...
ee/spec/workers/refresh_license_compliance_checks_worker_spec.rb
View file @
afd5cfef
...
...
@@ -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!
(
:project_approval_rule
)
{
create
(
:approval_project_rule
,
:requires_approval
,
:license_management
,
project:
project
)
}
context
"when a license is
block
ed, that appears in some of the license management reports"
do
context
"when a license is
deni
ed, 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!
(
:closed_pipeline
)
{
create
(
:ee_ci_pipeline
,
:success
,
:with_license_management_report
,
project:
project
,
merge_requests_as_head_pipeline:
[
closed_merge_request
])
}
let!
(
:
block
ed_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
license
)
}
let!
(
:
deni
ed_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
license
)
}
let
(
:license
)
{
create
(
:software_license
,
name:
license_report
.
license_names
[
0
])
}
let
(
:license_report
)
{
open_pipeline
.
license_scanning_report
}
...
...
@@ -36,10 +36,10 @@ describe RefreshLicenseComplianceChecksWorker do
specify
{
expect
(
closed_merge_request_approval_rule
.
reload
.
approvals_required
).
to
be_zero
}
end
context
"when none of the
block
ed licenses appear in the most recent license management reports"
do
context
"when none of the
deni
ed 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!
(
:closed_pipeline
)
{
create
(
:ee_ci_pipeline
,
:success
,
:with_license_management_report
,
project:
project
,
merge_requests_as_head_pipeline:
[
closed_merge_request
])
}
let!
(
:
block
ed_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
license
)
}
let!
(
:
deni
ed_policy
)
{
create
(
:software_license_policy
,
:denied
,
project:
project
,
software_license:
license
)
}
let
(
:license
)
{
create
(
:software_license
,
name:
SecureRandom
.
uuid
)
}
before
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment