Skip to content
Snippets Groups Projects
Verified Commit 1649515c authored by Zamir Martins's avatar Zamir Martins :speech_balloon:
Browse files

Include reserved report_approvers rule names as

part of json schema validation.

EE: true
Changelog: fixed
parent e3dde1e4
No related branches found
No related tags found
1 merge request!96140Validate reserved report_approvers rule names through schema
......@@ -270,7 +270,8 @@
"description": "Name for the policy.",
"minLength": 1,
"maxLength": 255,
"type": "string"
"type": "string",
"pattern": "^(?!License-Check$|Coverage-Check$)"
},
"description": {
"description": "Specifies the longer description of the policy.",
......
......@@ -300,7 +300,8 @@
end
context 'with scan result policies' do
let(:scan_result_policy) { build(:scan_result_policy, name: 'Contains security critical severities') }
let(:policy_name) { 'Contains security critical severities' }
let(:scan_result_policy) { build(:scan_result_policy, name: policy_name) }
let(:policy_yaml) { build(:orchestration_policy_yaml, scan_result_policy: [scan_result_policy]) }
it { is_expected.to eq(true) }
......@@ -326,6 +327,21 @@
it { is_expected.to eq(is_valid) }
end
end
context 'with various policy names' do
using RSpec::Parameterized::TableSyntax
where(:policy_name, :expected_to_be_valid) do
ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT | false
ApprovalRuleLike::DEFAULT_NAME_FOR_COVERAGE | false
"New #{ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT}" | true
"#{ApprovalRuleLike::DEFAULT_NAME_FOR_COVERAGE} through policies" | true
end
with_them do
it { is_expected.to eq(expected_to_be_valid) }
end
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment