mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
add test for when run is not specified in waiver (5370)
This commit is contained in:
commit
c13f780b8f
4 changed files with 14 additions and 5 deletions
|
@ -42,8 +42,8 @@ control_id:
|
|||
```
|
||||
|
||||
- `expiration_date` is optional. Absence means the waiver is permanent.
|
||||
- `run` is optional. If present and true, the control will run and be
|
||||
reported, but failures in it won't make the overall run fail. If absent or false, the control will not be run. You may use any of yes, no, true or false.
|
||||
- `run` is optional. If absent or true, the control will run and be
|
||||
reported, but failures in it won't make the overall run fail. If present and false, the control will not be run. You may use any of yes, no, true or false. To avoid confusion, it is good practice to explicitly specify whether the control should run.
|
||||
- `justification` can be any text you want and might include a reason
|
||||
as well as who signed off on the waiver.
|
||||
|
||||
|
|
|
@ -65,4 +65,8 @@ end
|
|||
|
||||
control "17_waivered_expiry_in_future_string_not_ran" do
|
||||
describe(true) { it { should eq true } }
|
||||
end
|
||||
end
|
||||
|
||||
control "18_waivered_no_expiry_default_run" do
|
||||
describe(true) { it { should eq false } }
|
||||
end
|
||||
|
|
|
@ -68,4 +68,7 @@
|
|||
17_waivered_expiry_in_future_string_not_ran:
|
||||
expiration_date: "2077-06-01"
|
||||
justification: Lack of imagination
|
||||
run: false
|
||||
run: false
|
||||
|
||||
18_waivered_no_expiry_default_run:
|
||||
justification: Too lazy to specify run, which defaults to true
|
||||
|
|
|
@ -48,6 +48,7 @@ describe "waivers" do
|
|||
in_past = !!(control_id =~ /in_past/)
|
||||
in_future = !!(control_id =~ /in_future/)
|
||||
ran = !!(control_id !~ /not_ran/)
|
||||
default_run = !!(control_id =~ /default_run/)
|
||||
waiver_expired_in_past = /Waiver expired/ =~ act["message"]
|
||||
|
||||
# higher logic
|
||||
|
@ -58,7 +59,7 @@ describe "waivers" do
|
|||
assert_instance_of Hash, act
|
||||
|
||||
assert_stringy act["justification"] # TODO: optional?
|
||||
assert_equal ran, act["run"]
|
||||
assert_equal ran, act["run"] unless default_run
|
||||
assert_equal waived, act["skipped_due_to_waiver"]
|
||||
assert_stringy act["message"] if has_message
|
||||
# We supply a message indicating that the waiver has expired in all cases
|
||||
|
@ -100,6 +101,7 @@ describe "waivers" do
|
|||
"15_waivered_expiry_in_future_string_ran_passes" => "passed",
|
||||
"16_waivered_expiry_in_future_string_ran_fails" => "failed",
|
||||
"17_waivered_expiry_in_future_string_not_ran" => "skipped",
|
||||
"18_waivered_no_expiry_default_run" => "failed",
|
||||
}.each do |control_id, expected|
|
||||
it "has all of the expected outcomes #{control_id}" do
|
||||
assert_test_outcome expected, control_id
|
||||
|
|
Loading…
Reference in a new issue