2019-06-11 22:24:35 +00:00
|
|
|
require "minitest/autorun"
|
|
|
|
require "tmpdir"
|
|
|
|
require_relative "../../../../lib/inspec/plugin/v2"
|
2018-11-16 22:03:09 +00:00
|
|
|
|
|
|
|
# This file relies on setting environment variables for some
|
|
|
|
# of its tests - it is NOT thread-safe.
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Plugin::V2::ConfigFile" do
|
|
|
|
orig_home = ENV["HOME"]
|
2018-11-16 22:03:09 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
let(:repo_path) { File.expand_path(File.join( __FILE__, "..", "..", "..", "..", "..")) }
|
|
|
|
let(:config_fixtures_path) { File.join(repo_path, "test", "unit", "mock", "config_dirs") }
|
2018-11-16 22:03:09 +00:00
|
|
|
let(:config_file_obj) { Inspec::Plugin::V2::ConfigFile.new(constructor_arg) }
|
2019-06-11 22:24:35 +00:00
|
|
|
let(:constructor_arg) { File.join(config_fixtures_path, "plugin_config_files", fixture_name + ".json") }
|
2018-11-16 22:03:09 +00:00
|
|
|
|
|
|
|
after do
|
2019-06-11 22:24:35 +00:00
|
|
|
ENV["HOME"] = orig_home
|
|
|
|
ENV["INSPEC_CONFIG_DIR"] = nil
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Path Handling
|
|
|
|
#----------------------------------------------------------#
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "locating the file" do
|
|
|
|
describe "when no env var is set" do
|
2018-11-16 22:03:09 +00:00
|
|
|
let(:constructor_arg) { nil }
|
2019-06-11 22:24:35 +00:00
|
|
|
it "defaults to the home directory" do
|
|
|
|
ENV["HOME"] = File.join(config_fixtures_path, "fakehome")
|
|
|
|
expected_path = File.join(ENV["HOME"], ".inspec", "plugins.json")
|
2018-11-16 22:03:09 +00:00
|
|
|
|
|
|
|
config_file_obj.path.must_equal expected_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when an env var is set" do
|
2018-11-16 22:03:09 +00:00
|
|
|
let(:constructor_arg) { nil }
|
2019-06-11 22:24:35 +00:00
|
|
|
it "looks to the dir specified by the env var" do
|
|
|
|
ENV["INSPEC_CONFIG_DIR"] = File.join(config_fixtures_path, "meaning-by-path")
|
|
|
|
expected_path = File.join(ENV["INSPEC_CONFIG_DIR"], "plugins.json")
|
2018-11-16 22:03:09 +00:00
|
|
|
|
|
|
|
config_file_obj.path.must_equal expected_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when a path is provided to the constructor" do
|
|
|
|
let(:fixture_name) { "no_plugins" }
|
|
|
|
it "uses the provided path" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.path.must_equal constructor_arg
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Reading a File
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "reading the file" do
|
2018-11-16 22:03:09 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the file is missing" do
|
|
|
|
let(:fixture_name) { "nonesuch" }
|
|
|
|
it "creates a empty datastructure" do
|
2018-11-16 22:03:09 +00:00
|
|
|
Dir.mktmpdir do |tmp_dir|
|
|
|
|
config_file_obj.count.must_equal 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the file is corrupt" do
|
|
|
|
let(:fixture_name) { "corrupt" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Failed to load")
|
|
|
|
ex.message.must_include("JSON")
|
|
|
|
ex.message.must_include("unexpected token")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the file is valid" do
|
|
|
|
let(:fixture_name) { "basic" }
|
|
|
|
it "can count plugins" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 3
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "can look up plugins by name with a String" do
|
|
|
|
config_file_obj.plugin_by_name("inspec-test-fixture-01").wont_be_nil
|
|
|
|
config_file_obj.plugin_by_name("inspec-test-fixture-99").must_be_nil
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "can look up plugins by name with a Symbol" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture-01').wont_be_nil
|
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture-99').must_be_nil
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "symbolizes the keys of the entries" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.each do |entry|
|
|
|
|
entry.keys.each do |key|
|
|
|
|
key.must_be_kind_of(Symbol)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "implements Enumerable" do
|
|
|
|
config_file_obj.select { |entry| entry[:name].to_s.start_with?("inspec-test-fixture") }.count.must_equal 3
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Validation
|
|
|
|
#----------------------------------------------------------#
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the file is invalid" do
|
2018-11-16 22:03:09 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because the file version is wrong" do
|
|
|
|
let(:fixture_name) { "bad_plugin_conf_version" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Unsupported")
|
|
|
|
ex.message.must_include("version")
|
|
|
|
ex.message.must_include("99.99.9")
|
|
|
|
ex.message.must_include("1.0.0")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because the file version is missing" do
|
|
|
|
let(:fixture_name) { "missing_plugin_conf_version" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Missing")
|
|
|
|
ex.message.must_include("version")
|
|
|
|
ex.message.must_include("1.0.0")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because the plugins field is missing" do
|
|
|
|
let(:fixture_name) { "missing_plugins_key" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("missing")
|
2018-11-16 22:03:09 +00:00
|
|
|
ex.message.must_include("'plugins'")
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("array")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because the plugins field is not an array" do
|
|
|
|
let(:fixture_name) { "hash_plugins_key" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Malformed")
|
2018-11-16 22:03:09 +00:00
|
|
|
ex.message.must_include("'plugins'")
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("array")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because a plugin entry is not a hash" do
|
|
|
|
let(:fixture_name) { "entry_not_hash" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Malformed")
|
|
|
|
ex.message.must_include("Hash")
|
|
|
|
ex.message.must_include("at index 2")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because it contains duplicate plugin entries" do
|
|
|
|
let(:fixture_name) { "entry_duplicate" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Malformed")
|
|
|
|
ex.message.must_include("duplicate")
|
|
|
|
ex.message.must_include("inspec-test-fixture-01")
|
|
|
|
ex.message.must_include("at index 1 and 3")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because a plugin entry does not have a name" do
|
|
|
|
let(:fixture_name) { "entry_no_name" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Malformed")
|
2018-11-16 22:03:09 +00:00
|
|
|
ex.message.must_include("missing 'name'")
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("at index 1")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because a plugin entry has an unrecognized installation type" do
|
|
|
|
let(:fixture_name) { "entry_bad_installation_type" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Malformed")
|
|
|
|
ex.message.must_include("unrecognized installation_type")
|
2018-11-16 22:03:09 +00:00
|
|
|
ex.message.must_include("one of 'gem' or 'path'")
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("at index 1")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "because a path plugin entry does not have a path" do
|
|
|
|
let(:fixture_name) { "entry_no_path_for_path_type" }
|
|
|
|
it "throws an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include("Malformed")
|
|
|
|
ex.message.must_include("missing installation path")
|
|
|
|
ex.message.must_include("at index 2")
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "modifying the conf file" do
|
2018-11-16 22:03:09 +00:00
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Adding Entries
|
|
|
|
#----------------------------------------------------------#
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "adding an entry" do
|
|
|
|
let(:fixture_name) { "no_plugins" }
|
2018-11-16 22:03:09 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the conf is empty" do
|
|
|
|
it "should add one valid entry" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 0
|
2019-06-11 22:24:35 +00:00
|
|
|
config_file_obj.add_entry(name: "inspec-test-fixture")
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 1
|
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture').wont_be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the conf has entries" do
|
|
|
|
let(:fixture_name) { "basic" }
|
|
|
|
it "should append one valid entry" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 3
|
2019-06-11 22:24:35 +00:00
|
|
|
config_file_obj.add_entry(name: "inspec-test-fixture-03")
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 4
|
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture-03').wont_be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when adding a gem entry" do
|
|
|
|
it "should add a gem entry" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.add_entry(
|
2019-06-11 22:24:35 +00:00
|
|
|
name: "inspec-test-fixture-03",
|
|
|
|
installation_type: :gem
|
2018-11-16 22:03:09 +00:00
|
|
|
)
|
|
|
|
entry = config_file_obj.plugin_by_name(:'inspec-test-fixture-03')
|
|
|
|
entry.wont_be_nil
|
|
|
|
entry[:installation_type].must_equal :gem
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when adding a path entry" do
|
|
|
|
it "should add a path entry" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.add_entry(
|
2019-06-11 22:24:35 +00:00
|
|
|
name: "inspec-test-fixture-03",
|
2018-11-16 22:03:09 +00:00
|
|
|
installation_type: :path,
|
2019-06-11 22:24:35 +00:00
|
|
|
installation_path: "/my/path.rb"
|
2018-11-16 22:03:09 +00:00
|
|
|
)
|
|
|
|
entry = config_file_obj.plugin_by_name(:'inspec-test-fixture-03')
|
|
|
|
entry.wont_be_nil
|
|
|
|
entry[:installation_type].must_equal :path
|
2019-06-11 22:24:35 +00:00
|
|
|
entry[:installation_path].must_equal "/my/path.rb"
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when adding a duplicate plugin name" do
|
|
|
|
let(:fixture_name) { "basic" }
|
|
|
|
it "should throw an exception" do
|
|
|
|
assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj.add_entry(name: "inspec-test-fixture-02") }
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when adding an invalid entry" do
|
|
|
|
it "should throw an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
[
|
2019-06-11 22:24:35 +00:00
|
|
|
{ name: "inspec-test-fixture", installation_type: :path },
|
|
|
|
{ installation_type: :gem },
|
|
|
|
{ name: "inspec-test-fixture", installation_type: :invalid },
|
|
|
|
{ "name" => "inspec-test-fixture" },
|
2018-11-16 22:03:09 +00:00
|
|
|
].each do |proposed_entry|
|
|
|
|
assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj.add_entry(proposed_entry) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Removing Entries
|
|
|
|
#----------------------------------------------------------#
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "removing an entry" do
|
|
|
|
let(:fixture_name) { "basic" }
|
2018-11-16 22:03:09 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the entry exists" do
|
|
|
|
it "should remove the entry by symbol name" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 3
|
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture-01').wont_be_nil
|
|
|
|
config_file_obj.remove_entry(:'inspec-test-fixture-01')
|
|
|
|
config_file_obj.count.must_equal 2
|
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture-01').must_be_nil
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "should remove the entry by String name" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 3
|
2019-06-11 22:24:35 +00:00
|
|
|
config_file_obj.plugin_by_name("inspec-test-fixture-01").wont_be_nil
|
|
|
|
config_file_obj.remove_entry("inspec-test-fixture-01")
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 2
|
2019-06-11 22:24:35 +00:00
|
|
|
config_file_obj.plugin_by_name("inspec-test-fixture-01").must_be_nil
|
2018-11-16 22:03:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the entry does not exist" do
|
|
|
|
let(:fixture_name) { "basic" }
|
|
|
|
it "should throw an exception" do
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 3
|
|
|
|
config_file_obj.plugin_by_name(:'inspec-test-fixture-99').must_be_nil
|
|
|
|
ex = assert_raises(Inspec::Plugin::V2::ConfigError) { config_file_obj.remove_entry(:'inspec-test-fixture-99') }
|
2019-06-11 22:24:35 +00:00
|
|
|
ex.message.must_include "No such entry"
|
|
|
|
ex.message.must_include "inspec-test-fixture-99"
|
2018-11-16 22:03:09 +00:00
|
|
|
config_file_obj.count.must_equal 3
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "writing the file" do
|
|
|
|
let(:fixture_name) { "unused" }
|
2018-11-16 22:03:09 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the file does not exist" do
|
|
|
|
it "is created" do
|
2018-11-16 22:03:09 +00:00
|
|
|
Dir.mktmpdir do |tmp_dir|
|
2019-06-11 22:24:35 +00:00
|
|
|
path = File.join(tmp_dir, "plugins.json")
|
2018-11-16 22:03:09 +00:00
|
|
|
File.exist?(path).must_equal false
|
|
|
|
cfo_writer = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_writer.add_entry(name: :'inspec-resource-lister')
|
|
|
|
cfo_writer.save
|
|
|
|
|
|
|
|
File.exist?(path).must_equal true
|
|
|
|
cfo_reader = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_reader.existing_entry?(:'inspec-resource-lister').must_equal true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the directory does not exist" do
|
|
|
|
it "is created" do
|
2018-11-16 22:03:09 +00:00
|
|
|
Dir.mktmpdir do |tmp_dir|
|
2019-06-11 22:24:35 +00:00
|
|
|
path = File.join(tmp_dir, "subdir", "plugins.json")
|
2018-11-16 22:03:09 +00:00
|
|
|
File.exist?(path).must_equal false
|
|
|
|
cfo_writer = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_writer.add_entry(name: :'inspec-resource-lister')
|
|
|
|
cfo_writer.save
|
|
|
|
|
|
|
|
File.exist?(path).must_equal true
|
|
|
|
cfo_reader = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_reader.existing_entry?(:'inspec-resource-lister').must_equal true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when the file does exist" do
|
|
|
|
it "is overwritten" do
|
2018-11-16 22:03:09 +00:00
|
|
|
Dir.mktmpdir do |tmp_dir|
|
2019-06-11 22:24:35 +00:00
|
|
|
path = File.join(tmp_dir, "plugins.json")
|
2018-11-16 22:03:09 +00:00
|
|
|
cfo_writer = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_writer.add_entry(name: :'inspec-resource-lister')
|
|
|
|
cfo_writer.save
|
|
|
|
|
|
|
|
File.exist?(path).must_equal true
|
|
|
|
|
|
|
|
cfo_modifier = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_modifier.remove_entry(:'inspec-resource-lister')
|
|
|
|
cfo_modifier.add_entry(name: :'inspec-test-fixture')
|
|
|
|
cfo_modifier.save
|
|
|
|
|
|
|
|
cfo_reader = Inspec::Plugin::V2::ConfigFile.new(path)
|
|
|
|
cfo_reader.existing_entry?(:'inspec-resource-lister').must_equal false
|
|
|
|
cfo_reader.existing_entry?(:'inspec-test-fixture').must_equal true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-04-24 00:21:31 +00:00
|
|
|
end
|