Sha256: d49b894c2482bf8b3c8e75adffcf56b822e840f48696b1c81a48f885a7bc6593

Contents?: true

Size: 1.66 KB

Versions: 9

Compression:

Stored size: 1.66 KB

Contents

require_relative '../test_helper'

class InspecTest < Minitest::Test
  def test_that_xccdf_exists
    refute_nil ::InspecTools::Inspec
  end

  def test_inspec_init_with_valid_params
    inspec_json = File.read('examples/sample_json/single_control_results.json')
    assert(InspecTools::Inspec.new(inspec_json))
  end

  def test_inspec_init_with_invalid_params
    json = nil
    assert_raises(StandardError) { InspecTools::Inspec.new(json) }
  end

  def test_inspec_to_ckl
    inspec_json = File.read('examples/sample_json/single_control_results.json')
    inspec_tools = InspecTools::Inspec.new(inspec_json)
    ckl = inspec_tools.to_ckl
    assert(ckl)
  end

  def test_inspec_to_xccdf_results_json
    inspec_json = File.read('examples/sample_json/single_control_results.json')
    attributes = 'examples/attribute.json'
    inspec_tools = InspecTools::Inspec.new(inspec_json)
    xccdf = inspec_tools.to_xccdf(attributes)
    assert(xccdf)
  end

  def test_inspec_to_xccdf_profile_json
    inspec_json = File.read('examples/sample_json/single_control_profile.json')
    attributes = 'examples/attribute.json'
    inspec_tools = InspecTools::Inspec.new(inspec_json)
    xccdf = inspec_tools.to_xccdf(attributes)
    assert(xccdf)
  end

  def test_inspec_to_csv_results_json
    inspec_json = File.read('examples/sample_json/single_control_results.json')
    inspec_tools = InspecTools::Inspec.new(inspec_json)
    csv = inspec_tools.to_csv
    assert(csv)
  end

  def test_inspec_to_csv_profile_json
    inspec_json = File.read('examples/sample_json/single_control_profile.json')
    inspec_tools = InspecTools::Inspec.new(inspec_json)
    csv = inspec_tools.to_csv
    assert(csv)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
inspec_tools-1.4.2 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.4.1 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.4.0 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.3.6 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.3.5 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.3.0 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.2.2 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.2.1 test/unit/inspec_tools/inspec_test.rb
inspec_tools-1.2.0 test/unit/inspec_tools/inspec_test.rb