From 0aea548dd8c370ecf06a95c60fe49d2eb2cb92bd Mon Sep 17 00:00:00 2001 From: Miah Johnson Date: Sat, 1 Jun 2019 23:17:53 -0700 Subject: [PATCH] Update tests to use json-schema, and test something. Signed-off-by: Miah Johnson --- test/functional/inspec_check_test.rb | 1 - test/functional/inspec_exec_json_test.rb | 10 +++++----- test/functional/inspec_exec_jsonmin_test.rb | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/test/functional/inspec_check_test.rb b/test/functional/inspec_check_test.rb index 49e11e787..556f99205 100644 --- a/test/functional/inspec_check_test.rb +++ b/test/functional/inspec_check_test.rb @@ -1,5 +1,4 @@ require 'functional/helper' -require 'jsonschema' require 'tmpdir' describe 'inspec check' do diff --git a/test/functional/inspec_exec_json_test.rb b/test/functional/inspec_exec_json_test.rb index bb1c32866..cf606a11d 100644 --- a/test/functional/inspec_exec_json_test.rb +++ b/test/functional/inspec_exec_json_test.rb @@ -1,5 +1,5 @@ require 'functional/helper' -require 'jsonschema' +require 'json-schema' describe 'inspec exec with json formatter' do include FunctionalHelper @@ -11,7 +11,7 @@ describe 'inspec exec with json formatter' do data = JSON.parse(out.stdout) sout = inspec('schema exec-json') schema = JSON.parse(sout.stdout) - JSON::Schema.validate(data, schema) + JSON::Validator.validate(schema, data).wont_equal false end it 'can execute a profile and validate the json schema' do @@ -21,7 +21,7 @@ describe 'inspec exec with json formatter' do data = JSON.parse(out.stdout) sout = inspec('schema exec-json') schema = JSON.parse(sout.stdout) - JSON::Schema.validate(data, schema) + JSON::Validator.validate(schema, data).wont_equal false end it 'can execute a simple file while using end of options after reporter cli option' do @@ -31,7 +31,7 @@ describe 'inspec exec with json formatter' do data = JSON.parse(out.stdout) sout = inspec('schema exec-json') schema = JSON.parse(sout.stdout) - JSON::Schema.validate(data, schema) + JSON::Validator.validate(schema, data).wont_equal false end it 'can execute a profile and validate the json schema with target_id' do @@ -42,7 +42,7 @@ describe 'inspec exec with json formatter' do data['platform']['target_id'].must_equal '1d3e399f-4d71-4863-ac54-84d437fbc444' sout = inspec('schema exec-json') schema = JSON.parse(sout.stdout) - JSON::Schema.validate(data, schema) + JSON::Validator.validate(schema, data).wont_equal false end it 'does not report skipped dependent profiles' do diff --git a/test/functional/inspec_exec_jsonmin_test.rb b/test/functional/inspec_exec_jsonmin_test.rb index e210095ad..1f14c3b3d 100644 --- a/test/functional/inspec_exec_jsonmin_test.rb +++ b/test/functional/inspec_exec_jsonmin_test.rb @@ -1,5 +1,5 @@ require 'functional/helper' -require 'jsonschema' +require 'json-schema' describe 'inspec exec' do include FunctionalHelper @@ -11,7 +11,7 @@ describe 'inspec exec' do data = JSON.parse(out.stdout) sout = inspec('schema exec-jsonmin') schema = JSON.parse(sout.stdout) - JSON::Schema.validate(data, schema) + JSON::Validator.validate(schema, data).wont_equal false end it 'can execute a simple file with the mini json formatter and validate its schema' do @@ -21,7 +21,7 @@ describe 'inspec exec' do data = JSON.parse(out.stdout) sout = inspec('schema exec-jsonmin') schema = JSON.parse(sout.stdout) - JSON::Schema.validate(data, schema) + JSON::Validator.validate(schema, data).wont_equal false end it 'does not contain any dupilcate results with describe.one' do