mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
Test summary JSON schema
This commit is contained in:
parent
6c91183995
commit
8094add5b3
1 changed files with 9 additions and 0 deletions
|
@ -23,6 +23,7 @@ describe 'inspec exec with json formatter' do
|
||||||
|
|
||||||
describe 'execute a profile with json formatting' do
|
describe 'execute a profile with json formatting' do
|
||||||
let(:json) { JSON.load(inspec('exec ' + example_profile + ' --format json').stdout) }
|
let(:json) { JSON.load(inspec('exec ' + example_profile + ' --format json').stdout) }
|
||||||
|
let(:control_summary) { json['control_summary'] }
|
||||||
let(:profile) { json['profiles']['profile'] }
|
let(:profile) { json['profiles']['profile'] }
|
||||||
let(:controls) { profile['controls'] }
|
let(:controls) { profile['controls'] }
|
||||||
let(:ex1) { controls['tmp-1.0'] }
|
let(:ex1) { controls['tmp-1.0'] }
|
||||||
|
@ -60,6 +61,7 @@ describe 'inspec exec with json formatter' do
|
||||||
|
|
||||||
it 'must have 4 controls' do
|
it 'must have 4 controls' do
|
||||||
controls.length.must_equal 4
|
controls.length.must_equal 4
|
||||||
|
control_summary['total'].must_equal 4
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has an id for every control' do
|
it 'has an id for every control' do
|
||||||
|
@ -107,6 +109,13 @@ describe 'inspec exec with json formatter' do
|
||||||
"code" => "control \"tmp-1.0\" do # A unique ID for this control\n impact 0.7 # The criticality, if this control fails.\n title \"Create /tmp directory\" # A human-readable title\n desc \"An optional description...\" # Describe why this is needed\n tag data: \"temp data\" # A tag allows you to associate key information\n tag \"security\" # to the test\n ref \"Document A-12\", url: 'http://...' # Additional references\n\n describe file('/tmp') do # The actual test\n it { should be_directory }\n end\nend\n",
|
"code" => "control \"tmp-1.0\" do # A unique ID for this control\n impact 0.7 # The criticality, if this control fails.\n title \"Create /tmp directory\" # A human-readable title\n desc \"An optional description...\" # Describe why this is needed\n tag data: \"temp data\" # A tag allows you to associate key information\n tag \"security\" # to the test\n ref \"Document A-12\", url: 'http://...' # Additional references\n\n describe file('/tmp') do # The actual test\n it { should be_directory }\n end\nend\n",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'must report 3 passing controls' do
|
||||||
|
control_summary['passed'].must_equal 3
|
||||||
|
end
|
||||||
|
it 'must report 1 skipped control' do
|
||||||
|
control_summary['skipped'].must_equal 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with a profile that is not supported on this OS/platform' do
|
describe 'with a profile that is not supported on this OS/platform' do
|
||||||
|
|
Loading…
Reference in a new issue