mirror of
https://github.com/inspec/inspec
synced 2024-11-24 21:53:15 +00:00
Fix typos identified by cspell
Just a pile of misc typos Signed-off-by: Tim Smith <tsmith@chef.io>
This commit is contained in:
parent
52d9fe4321
commit
403647c3e4
35 changed files with 81 additions and 81 deletions
|
@ -55,7 +55,7 @@ Actual HTTP communication is handled by `InspecPlugins::Compliance::HTTP`, again
|
|||
|
||||
#### lib/http.rb
|
||||
|
||||
This is probably unneccesary. It is a wrapper around Net:HTTP. Instead, we should probably be using a REST API wrapper or something similar.
|
||||
This is probably unnecessary. It is a wrapper around Net:HTTP. Instead, we should probably be using a REST API wrapper or something similar.
|
||||
|
||||
#### lib/support.rb
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class Thing < Inspec.resource(1)
|
|||
filter_table_config.install_filter_methods_on_resource(self, :fetch_data)
|
||||
|
||||
def fetch_data
|
||||
# This method should return an array of hashes - the raw data. We'll hardcode it here.
|
||||
# This method should return an array of hashes - the raw data. We'll hard code it here.
|
||||
[
|
||||
{ thing_id: 1, color: :red },
|
||||
{ thing_id: 2, color: :blue, tackiness: 'very' },
|
||||
|
@ -301,7 +301,7 @@ This method behaves just like `thing_ids`, except that it returns the values of
|
|||
|
||||
You also get this for `thing_ids`. This is unrelated to `style: :simple` for `colors`.
|
||||
|
||||
People definitely use this in the wild. It reads badly to me; I think this is a legacy usage that we should consider deprecating. To me, this seems to imply that there is a sub-resource (here, colors) we are auditing. At least two core resouces (`xinetd_conf` and `users`) advocate this as their primary use.
|
||||
People definitely use this in the wild. It reads badly to me; I think this is a legacy usage that we should consider deprecating. To me, this seems to imply that there is a sub-resource (here, colors) we are auditing. At least two core resources (`xinetd_conf` and `users`) advocate this as their primary use.
|
||||
|
||||
```ruby
|
||||
# Filter on colors
|
||||
|
|
|
@ -50,7 +50,7 @@ _**If the current Account is the Master Account, the following properties are al
|
|||
| ------------- | ------------------------------------------------------ |
|
||||
| account_id | The ID of the current Account. |
|
||||
| account_arn | The ARN of the current Account. |
|
||||
| account_name | The Name of the current Acccount. |
|
||||
| account_name | The Name of the current Account. |
|
||||
| account_email | The Email address associated with the current Account. |
|
||||
|
||||
## Examples
|
||||
|
|
|
@ -52,7 +52,7 @@ See also the [AWS documentation on SNS](https://docs.aws.amazon.com/sns/latest/d
|
|||
its('endpoint') { should cmp '+16105551234' }
|
||||
# If protocol is 'email' or 'email-json', endpoint should be an email address
|
||||
its('endpoint') { should cmp 'myemail@example.com' }
|
||||
# If protocal is 'http', endpoint should be a URL beginning with 'https://'
|
||||
# If protocol is 'http', endpoint should be a URL beginning with 'https://'
|
||||
its('endpoint') { should cmp 'https://www.exampleurl.com' }
|
||||
# If the protocol is 'lambda', its endpoint should be the ARN of a AWS Lambda function
|
||||
its('endpoint') { should cmp 'rn:aws:lambda:us-east-1:account-id:function:myfunction' }
|
||||
|
|
|
@ -69,7 +69,7 @@ name and resource group.
|
|||
|
||||
## Parameter Examples
|
||||
|
||||
The resource group as well as the Activty Log Alert
|
||||
The resource group as well as the Activity Log Alert
|
||||
name.
|
||||
|
||||
describe azurerm_monitor_activity_log_alert(resource_group: 'example', name: 'AlertName') do
|
||||
|
|
|
@ -99,21 +99,21 @@ The default_security_rules property contains the set of Default Security Rules.
|
|||
|
||||
### allow_ssh_from_internet
|
||||
|
||||
The allow_ssh_from_internet property contains a boolean value determined by analysing
|
||||
The allow_ssh_from_internet property contains a boolean value determined by analyzing
|
||||
the Security Rules and Default Security Rules for unrestricted SSH access.
|
||||
|
||||
it { should_not allow_ssh_from_internet }
|
||||
|
||||
### allow_rdp_from_internet
|
||||
|
||||
The allow_rdp_from_internet property contains a boolean value determined by analysing
|
||||
The allow_rdp_from_internet property contains a boolean value determined by analyzing
|
||||
the Security Rules and Default Security Rules for unrestricted RDP access.
|
||||
|
||||
it { should_not allow_rdp_from_internet }
|
||||
|
||||
### allow\port_from_internet
|
||||
|
||||
The allow_port_from_internet property contains a boolean value determined by analysing
|
||||
The allow_port_from_internet property contains a boolean value determined by analyzing
|
||||
the Security Rules and Default Security Rules for unrestricted access to a specified port.
|
||||
|
||||
it { should_not allow_port_from_internet('443') }
|
||||
|
|
|
@ -105,7 +105,7 @@ module Inspec::Resources
|
|||
children_keys(@options[:path], filter)
|
||||
end
|
||||
|
||||
# returns nil, if not existant or value
|
||||
# returns nil, if not existent or value
|
||||
def method_missing(*keys)
|
||||
# allow the use of array syntax in an `its` block so that users
|
||||
# can use it to query for keys with . characters in them
|
||||
|
|
|
@ -36,7 +36,7 @@ module Inspec::Resources
|
|||
end
|
||||
end
|
||||
|
||||
# returns nil, if not existant or value
|
||||
# returns nil, if not existent or value
|
||||
def method_missing(*keys)
|
||||
# catch behavior of rspec its implementation
|
||||
# @see https://github.com/rspec/rspec-its/blob/v1.2.0/lib/rspec/its.rb#L110
|
||||
|
|
|
@ -434,7 +434,7 @@ module InspecPlugins
|
|||
"version #{options[:version]} found on #{source_host} - " \
|
||||
"installation failed.\n")
|
||||
else
|
||||
ui.red("Unknown error occured - installation failed.\n")
|
||||
ui.red("Unknown error occurred - installation failed.\n")
|
||||
end
|
||||
ui.exit Inspec::UI::EXIT_USAGE_ERROR
|
||||
end
|
||||
|
@ -458,7 +458,7 @@ module InspecPlugins
|
|||
end
|
||||
end
|
||||
|
||||
# Check for latest version (and implicitly, existance)
|
||||
# Check for latest version (and implicitly, existence)
|
||||
latest_version = installer.search(plugin_name, exact: true, scope: :latest)
|
||||
latest_version = latest_version[plugin_name]&.last
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
|
||||
include PluginManagerHelpers
|
||||
ruby_abi_version = (Gem.ruby_version.segments[0, 2] << 0).join(".")
|
||||
# Test multiple hueristics of the path-mode install.
|
||||
# Test multiple heuristics of the path-mode install.
|
||||
# These are all positive tests; they should resolve the entry point to the same path in each case.
|
||||
{
|
||||
"is_perfect" => {
|
||||
|
@ -66,7 +66,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
end
|
||||
end
|
||||
|
||||
def test_fail_install_from_nonexistant_path
|
||||
def test_fail_install_from_nonexistent_path
|
||||
bad_path = File.join(project_fixtures_path, "none", "such", "inspec-test-fixture-nonesuch.rb")
|
||||
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
||||
|
||||
|
@ -166,7 +166,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
||||
def test_fail_install_from_nonexistant_gemfile
|
||||
def test_fail_install_from_nonexistent_gemfile
|
||||
bad_path = File.join(project_fixtures_path, "none", "such", "inspec-test-fixture-nonesuch-0.3.0.gem")
|
||||
install_result = run_inspec_process_with_this_plugin("plugin install #{bad_path}")
|
||||
|
||||
|
@ -195,7 +195,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
||||
def test_fail_install_from_nonexistant_remote_rubygem
|
||||
def test_fail_install_from_nonexistent_remote_rubygem
|
||||
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture-nonesuch")
|
||||
|
||||
assert_match(/No such plugin gem .+ could be found on rubygems.org - installation failed./, install_result.stdout)
|
||||
|
@ -224,7 +224,7 @@ class PluginManagerCliInstall < Minitest::Test
|
|||
assert_exit_code 0, install_result
|
||||
end
|
||||
|
||||
def test_fail_install_from_nonexistant_rubygem_version
|
||||
def test_fail_install_from_nonexistent_rubygem_version
|
||||
install_result = run_inspec_process_with_this_plugin("plugin install inspec-test-fixture -v 99.99.99")
|
||||
|
||||
fail_message = install_result.stdout.split("\n").grep(/failed/).last
|
||||
|
|
|
@ -49,7 +49,7 @@ class PluginManagerCliUpdate < Minitest::Test
|
|||
assert_exit_code 0, update_result
|
||||
end
|
||||
|
||||
def test_fail_update_from_nonexistant_gem
|
||||
def test_fail_update_from_nonexistent_gem
|
||||
update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture-nonesuch")
|
||||
|
||||
assert_match(/No such plugin installed:.+ - update failed/, update_result.stdout)
|
||||
|
|
|
@ -86,7 +86,7 @@ class AwsIamAccessKey < Inspec.resource(1)
|
|||
end
|
||||
|
||||
if access_keys.count > 1
|
||||
raise "More than one access key matched for aws_iam_access_key. Use more specific paramaters, such as access_key_id."
|
||||
raise "More than one access key matched for aws_iam_access_key. Use more specific parameters, such as access_key_id."
|
||||
end
|
||||
|
||||
@exists = true
|
||||
|
|
|
@ -6,7 +6,7 @@ module Inspec::Resources
|
|||
class AzureResourceBase < Inspec.resource(1)
|
||||
attr_reader :opts, :client, :azure
|
||||
|
||||
# Constructor that retreives the specified resource
|
||||
# Constructor that retrieves the specified resource
|
||||
#
|
||||
# The opts hash should contain the following
|
||||
# :group_name - name of the resource group in which to look for items
|
||||
|
@ -275,7 +275,7 @@ end
|
|||
|
||||
# Class object to maintain a count of the Azure Resource types that are found
|
||||
# when a less specific test is carried out. For example if all the resoures of a resource
|
||||
# group are called for, there will be variaous types and number of those types.
|
||||
# group are called for, there will be various types and number of those types.
|
||||
#
|
||||
# Each type is namespaced, so for example a virtual machine has the type 'Microsoft.Compute/virtualMachines'
|
||||
# This is broken down into the 'Microsoft' class with the type 'Compute/virtualMachines'
|
||||
|
@ -310,7 +310,7 @@ class AzureResourceTypeCounts
|
|||
end
|
||||
|
||||
# Class object that is created for each element that is returned by Azure.
|
||||
# This is what is interogated by Inspec. If they are nested hashes, then this results
|
||||
# This is what is interrogated by InSpec. If they are nested hashes, then this results
|
||||
# in nested AzureResourceProbe objects.
|
||||
#
|
||||
# For example, if the following was seen in an Azure Resource
|
||||
|
|
|
@ -127,7 +127,7 @@ module Inspec::Resources
|
|||
password_authentication?
|
||||
end
|
||||
|
||||
# Deteremine if the machine allows password authentication
|
||||
# Determine if the machine allows password authentication
|
||||
#
|
||||
# @return boolean
|
||||
def password_authentication?
|
||||
|
|
|
@ -85,7 +85,7 @@ module Inspec::Resources
|
|||
# return hashtable
|
||||
def parse_datadisk(disk, index)
|
||||
# Configure parsed hashtable to hold the information
|
||||
# Initialise this with common attributes from the different types of disk
|
||||
# Initialize this with common attributes from the different types of disk
|
||||
parsed = {
|
||||
disk: index,
|
||||
number: index + 1,
|
||||
|
@ -115,7 +115,7 @@ module Inspec::Resources
|
|||
parsed[:storage_account_type] = disk.managedDisk.storageAccountType
|
||||
parsed[:id] = disk.managedDisk.id
|
||||
|
||||
# Break up the ID string so that the following information can get retreived
|
||||
# Break up the ID string so that the following information can get retrieved
|
||||
# - subscription_id
|
||||
# - resource_group
|
||||
id_parts = parsed[:id].split(%r{/}).reject(&:empty?)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
title 'Test case 1 for exceptions in the file resource'
|
||||
|
||||
control 'c01 using file resource on nonexistant file with no property access' do
|
||||
control 'c01 using file resource on nonexistent file with no property access' do
|
||||
f = file('/i/do/not/exist')
|
||||
describe 'Test block' do
|
||||
it { should include 'Test'}
|
||||
end
|
||||
end
|
||||
|
||||
control 'c02 using file resource on nonexistant file with contents access in test block' do
|
||||
control 'c02 using file resource on nonexistent file with contents access in test block' do
|
||||
f = file('/i/do/not/exist')
|
||||
describe 'Test block' do
|
||||
subject { f.content }
|
||||
|
@ -15,7 +15,7 @@ control 'c02 using file resource on nonexistant file with contents access in tes
|
|||
end
|
||||
end
|
||||
|
||||
control 'c03 using file resource on nonexistant file with contents access control block' do
|
||||
control 'c03 using file resource on nonexistent file with contents access control block' do
|
||||
f = file('/i/do/not/exist')
|
||||
c = f.content
|
||||
describe 'Test block' do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
title 'Test case 2 for exceptions in the sshd_config resource'
|
||||
|
||||
control 'sshd01 using sshd_config resource nonexistant path with no property access' do
|
||||
control 'sshd01 using sshd_config resource nonexistent path with no property access' do
|
||||
s = sshd_config('/i/do/not/exist')
|
||||
describe 'Test block' do
|
||||
it { should include 'Test'}
|
||||
|
@ -8,7 +8,7 @@ control 'sshd01 using sshd_config resource nonexistant path with no property acc
|
|||
end
|
||||
|
||||
# sshd02 throws exception but is caught and fails the resource
|
||||
control 'sshd02 sshd_config resource nonexistant path with contents access in test block' do
|
||||
control 'sshd02 sshd_config resource nonexistent path with contents access in test block' do
|
||||
s = sshd_config('/i/do/not/exist')
|
||||
describe 'Test block' do
|
||||
subject { s }
|
||||
|
@ -35,7 +35,7 @@ end
|
|||
|
||||
# sshd05 throws exception which is not caught, and aborts inspec with stacktrace
|
||||
# Defective on 2.1.54
|
||||
control 'sshd05 sshd_config resource nonexistant path with contents access control block' do
|
||||
control 'sshd05 sshd_config resource nonexistent path with contents access control block' do
|
||||
s = sshd_config('/i/do/not/exist')
|
||||
# Next line triggers compile-time exception
|
||||
c = s.Protocol
|
||||
|
|
|
@ -916,7 +916,7 @@ Test Summary: 2 successful, 0 failures, 0 skipped\n"
|
|||
end
|
||||
end
|
||||
|
||||
describe "when --config points to a nonexistant location" do
|
||||
describe "when --config points to a nonexistent location" do
|
||||
let(:cli_args) { "--config " + "no/such/path" }
|
||||
it "should issue an error with the file path" do
|
||||
_(stderr).wont_match looks_like_a_stacktrace
|
||||
|
|
|
@ -26,7 +26,7 @@ control "aws_cloudtrail_trail recall" do
|
|||
it { should exist }
|
||||
end
|
||||
|
||||
describe aws_cloudtrail_trail('non-existant-trail') do
|
||||
describe aws_cloudtrail_trail('non-existent-trail') do
|
||||
it { should_not exist }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ control "aws_kms_key recall" do
|
|||
describe aws_kms_key(key_id: fixtures['kms_key_enabled_key_id']) do
|
||||
it { should exist }
|
||||
end
|
||||
describe aws_kms_key('non-existant-key') do
|
||||
describe aws_kms_key('non-existent-key') do
|
||||
it { should_not exist }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -146,7 +146,7 @@ describe users.where(username: userinfo[:username]) do
|
|||
end
|
||||
end
|
||||
|
||||
# catch case where user is not existant
|
||||
# catch case where user is not existent
|
||||
describe user('not_available') do
|
||||
it { should_not exist }
|
||||
its ('uid') { should eq nil}
|
||||
|
|
|
@ -3,7 +3,7 @@ class TestFindFiles < Inspec.resource(1)
|
|||
name "test_find_files"
|
||||
|
||||
desc "
|
||||
Resource used for testing the funcitonality of Utils::FindFiles
|
||||
Resource used for testing the functionality of Utils::FindFiles
|
||||
"
|
||||
|
||||
example "
|
||||
|
|
|
@ -4,7 +4,7 @@ require "inspec/plugin/v2"
|
|||
|
||||
describe "Input plugin type" do
|
||||
describe "when registering the plugin type superclass" do
|
||||
it "returns the superclass when calling the global defintion method" do
|
||||
it "returns the superclass when calling the global definition method" do
|
||||
klass = Inspec.plugin(2, :input)
|
||||
_(klass).must_be_kind_of Class
|
||||
_(klass).must_equal Inspec::Plugin::V2::PluginType::Input
|
||||
|
|
|
@ -155,7 +155,7 @@ class PluginInstallerInstallationTests < Minitest::Test
|
|||
def test_install_a_gem_from_missing_local_file
|
||||
gem_file = File.join(@plugin_fixture_pkg_path, "inspec-test-fixture-nonesuch-0.0.0.gem")
|
||||
|
||||
refute File.exist?(gem_file), "The nonexistant gem should not exist prior to install attempt"
|
||||
refute File.exist?(gem_file), "The non-existent gem should not exist prior to install attempt"
|
||||
ex = assert_raises(Inspec::Plugin::V2::InstallError) { @installer.install("inspec-test-fixture-nonesuch", gem_file: gem_file) }
|
||||
assert_includes ex.message, "Could not find local gem file"
|
||||
end
|
||||
|
@ -396,7 +396,7 @@ end
|
|||
class PluginInstallerUninstallTests < Minitest::Test
|
||||
include InstallerTestHelpers
|
||||
|
||||
def test_uninstalling_a_nonexistant_plugin_is_an_error
|
||||
def test_uninstalling_a_nonexistent_plugin_is_an_error
|
||||
# Try a mythical one
|
||||
ex = assert_raises(Inspec::Plugin::V2::UnInstallError) do
|
||||
@installer.uninstall("inspec-test-fixture-nonesuch")
|
||||
|
|
|
@ -51,7 +51,7 @@ class AwsCloudTrailTrailRecallTest < Minitest::Test
|
|||
end
|
||||
|
||||
def test_search_miss_is_not_an_exception
|
||||
refute AwsCloudTrailTrail.new(trail_name: "non-existant").exists?
|
||||
refute AwsCloudTrailTrail.new(trail_name: "non-existent").exists?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -66,37 +66,37 @@ class AwsCloudTrailTrailPropertiesTest < Minitest::Test
|
|||
|
||||
def test_property_s3_bucket_name
|
||||
assert_equal("aws-s3-bucket-test-trail-1", AwsCloudTrailTrail.new("test-trail-1").s3_bucket_name)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").s3_bucket_name)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").s3_bucket_name)
|
||||
end
|
||||
|
||||
def test_property_trail_arn
|
||||
assert_equal("arn:aws:cloudtrail:us-east-1::trail/test-trail-1", AwsCloudTrailTrail.new("test-trail-1").trail_arn)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").trail_arn)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").trail_arn)
|
||||
end
|
||||
|
||||
def test_property_cloud_watch_logs_role_arn
|
||||
assert_equal("arn:aws:iam:::role/CloudTrail_CloudWatchLogs_Role", AwsCloudTrailTrail.new("test-trail-1").cloud_watch_logs_role_arn)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").cloud_watch_logs_role_arn)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").cloud_watch_logs_role_arn)
|
||||
end
|
||||
|
||||
def test_property_cloud_watch_logs_log_group_arn
|
||||
assert_equal("arn:aws:logs:us-east-1::log-group:test:*", AwsCloudTrailTrail.new("test-trail-1").cloud_watch_logs_log_group_arn)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").cloud_watch_logs_log_group_arn)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").cloud_watch_logs_log_group_arn)
|
||||
end
|
||||
|
||||
def test_property_kms_key_id
|
||||
assert_equal("arn:aws:kms:us-east-1::key/88197884-041f-4f8e-a801-cf120e4845a8", AwsCloudTrailTrail.new("test-trail-1").kms_key_id)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").kms_key_id)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").kms_key_id)
|
||||
end
|
||||
|
||||
def test_property_home_region
|
||||
assert_equal("us-east-1", AwsCloudTrailTrail.new("test-trail-1").home_region)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").home_region)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").home_region)
|
||||
end
|
||||
|
||||
def test_property_delivered_logs_days_ago
|
||||
assert_equal(0, AwsCloudTrailTrail.new("test-trail-1").delivered_logs_days_ago)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existant").delivered_logs_days_ago)
|
||||
assert_nil(AwsCloudTrailTrail.new(trail_name: "non-existent").delivered_logs_days_ago)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class AwsIamPolicyRecallTest < Minitest::Test
|
|||
end
|
||||
|
||||
def test_search_miss_is_not_an_exception
|
||||
refute AwsIamPolicy.new(policy_name: "non-existant").exists?
|
||||
refute AwsIamPolicy.new(policy_name: "non-existent").exists?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -66,32 +66,32 @@ class AwsIamPolicyPropertiesTest < Minitest::Test
|
|||
|
||||
def test_property_arn
|
||||
assert_equal("arn:aws:iam::aws:policy/test-policy-1", AwsIamPolicy.new("test-policy-1").arn)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existant").arn)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existent").arn)
|
||||
end
|
||||
|
||||
def test_property_default_version_id
|
||||
assert_equal("v1", AwsIamPolicy.new("test-policy-1").default_version_id)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existant").default_version_id)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existent").default_version_id)
|
||||
end
|
||||
|
||||
def test_property_attachment_count
|
||||
assert_equal(3, AwsIamPolicy.new("test-policy-1").attachment_count)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existant").attachment_count)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existent").attachment_count)
|
||||
end
|
||||
|
||||
def test_property_attached_users
|
||||
assert_equal(["test-user"], AwsIamPolicy.new("test-policy-1").attached_users)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existant").attached_users)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existent").attached_users)
|
||||
end
|
||||
|
||||
def test_property_attached_groups
|
||||
assert_equal(["test-group"], AwsIamPolicy.new("test-policy-1").attached_groups)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existant").attached_groups)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existent").attached_groups)
|
||||
end
|
||||
|
||||
def test_property_attached_roles
|
||||
assert_equal(["test-role"], AwsIamPolicy.new("test-policy-1").attached_roles)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existant").attached_roles)
|
||||
assert_nil(AwsIamPolicy.new(policy_name: "non-existent").attached_roles)
|
||||
end
|
||||
|
||||
def test_property_policy
|
||||
|
@ -99,11 +99,11 @@ class AwsIamPolicyPropertiesTest < Minitest::Test
|
|||
assert_kind_of(Hash, policy)
|
||||
assert(policy.key?("Statement"), "test-policy-1 should have a Statement key when unpacked")
|
||||
assert_equal(1, policy["Statement"].count, "test-policy-1 should have 1 statements when unpacked")
|
||||
assert_nil(AwsIamPolicy.new("non-existant").policy)
|
||||
assert_nil(AwsIamPolicy.new("non-existent").policy)
|
||||
end
|
||||
|
||||
def test_property_statement_count
|
||||
assert_nil(AwsIamPolicy.new("non-existant").statement_count)
|
||||
assert_nil(AwsIamPolicy.new("non-existent").statement_count)
|
||||
assert_equal(1, AwsIamPolicy.new("test-policy-1").statement_count)
|
||||
assert_equal(2, AwsIamPolicy.new("test-policy-2").statement_count)
|
||||
assert_equal(1, AwsIamPolicy.new("test-policy-3").statement_count)
|
||||
|
|
|
@ -52,7 +52,7 @@ class AwsKmsKeyRecallTest < Minitest::Test
|
|||
end
|
||||
|
||||
def test_search_miss_is_not_an_exception
|
||||
refute AwsKmsKey.new(key_id: "non-existant").exists?
|
||||
refute AwsKmsKey.new(key_id: "non-existent").exists?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -71,42 +71,42 @@ class AwsKmsKeyPropertiesTest < Minitest::Test
|
|||
|
||||
def test_property_arn
|
||||
assert_equal("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111", AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").arn)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").arn)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").arn)
|
||||
end
|
||||
|
||||
def test_property_creation_date
|
||||
assert_equal(TIME_NOW - 10 * 24 * 3600, AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").creation_date)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").creation_date)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").creation_date)
|
||||
end
|
||||
|
||||
def test_property_key_usage
|
||||
assert_equal("ENCRYPT_DECRYPT", AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").key_usage)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").key_usage)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").key_usage)
|
||||
end
|
||||
|
||||
def test_property_key_state
|
||||
assert_equal("Enabled", AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").key_state)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").key_state)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").key_state)
|
||||
end
|
||||
|
||||
def test_property_description
|
||||
assert_equal("test-key-1-desc", AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").description)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").description)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").description)
|
||||
end
|
||||
|
||||
def test_property_deletion_time
|
||||
assert_equal(TIME_NOW + 10 * 24 * 3600, AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").deletion_time)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").deletion_time)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").deletion_time)
|
||||
end
|
||||
|
||||
def test_property_invalidation_time
|
||||
assert_nil(AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").invalidation_time)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").invalidation_time)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").invalidation_time)
|
||||
end
|
||||
|
||||
def test_property_created_days_ago
|
||||
assert_equal(10, AwsKmsKey.new("arn:aws:kms:us-east-1::key/7a6950aa-c8e6-4e51-8afc-111111111111").created_days_ago)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existant").created_days_ago)
|
||||
assert_nil(AwsKmsKey.new(key_id: "non-existent").created_days_ago)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -40,13 +40,13 @@ describe Inspec::Resources::Cmd do
|
|||
_(result.resource_exception_message).must_match(/must be a regular expression/)
|
||||
end
|
||||
|
||||
it "redacts output if `redact_regex` is passed with caputure groups" do
|
||||
it "redacts output if `redact_regex` is passed with capture groups" do
|
||||
cmd = "command_with_password -p supersecret -d no_redact"
|
||||
expected_to_s = "Command: `command_with_password -p REDACTED -d no_redact`"
|
||||
_(resource(cmd, redact_regex: /(-p ).*( -d)/).to_s).must_equal(expected_to_s)
|
||||
end
|
||||
|
||||
it "redacts output if `redact_regex` is passed without a caputure group" do
|
||||
it "redacts output if `redact_regex` is passed without a capture group" do
|
||||
cmd = "command_with_password -p supersecret -d no_redact"
|
||||
expected_to_s = "Command: `command_with_password REDACTED no_redact`"
|
||||
_(resource(cmd, redact_regex: /-p .* -d/).to_s).must_equal(expected_to_s)
|
||||
|
|
|
@ -53,7 +53,7 @@ describe "Inspec::Resources::EtcHostsAllow" do
|
|||
end
|
||||
|
||||
describe "Inspec::Resources::EtcHostsDeny" do
|
||||
describe "EtcHostsDeny Paramaters" do
|
||||
describe "EtcHostsDeny Parameters" do
|
||||
resource = load_resource("etc_hosts_deny")
|
||||
it "Verify etc_hosts_deny filtering by `daemon`" do
|
||||
entries = resource.where { daemon == "ALL" }
|
||||
|
|
|
@ -22,11 +22,11 @@ describe "Inspec::Resources::JSON" do
|
|||
_(resource.send("run_list")).must_equal %w{a b}
|
||||
end
|
||||
|
||||
it "doesnt resolve dot-notation names" do
|
||||
it "doesn't resolve dot-notation names" do
|
||||
_(resource.send("x.y.z")).must_be_nil
|
||||
end
|
||||
|
||||
it "doesnt resolve symbol-notation names" do
|
||||
it "doesn't resolve symbol-notation names" do
|
||||
_(resource.send(:'x.y.z')).must_be_nil
|
||||
end
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ describe "Inspec::Resources::Port" do
|
|||
_(resource.protocols("udp").entries.length).must_equal 15
|
||||
end
|
||||
|
||||
it "verify port on Windows 2008 (unpriviledged)" do
|
||||
it "verify port on Windows 2008 (unprivileged)" do
|
||||
ml = MockLoader.new(:windows)
|
||||
# kill windows 2012 shell commands
|
||||
ml.backend.backend.commands
|
||||
|
@ -144,7 +144,7 @@ describe "Inspec::Resources::Port" do
|
|||
_(resource.addresses).must_equal %w{0.0.0.0 ::}
|
||||
end
|
||||
|
||||
it "verify port list on Windows 2008 (unpriviledged)" do
|
||||
it "verify port list on Windows 2008 (unprivileged)" do
|
||||
ml = MockLoader.new(:windows)
|
||||
# kill windows 2012 shell commands
|
||||
ml.backend.backend.commands
|
||||
|
|
|
@ -5,7 +5,7 @@ require "inspec/resource"
|
|||
require "inspec/resources/postgres_hba_conf"
|
||||
|
||||
describe "Inspec::Resources::PGHbaConf" do
|
||||
describe "PGHbaConf Paramaters" do
|
||||
describe "PGHbaConf Parameters" do
|
||||
resource = load_resource("postgres_hba_conf", "/test/path/to/postgres/pg_hba.conf")
|
||||
|
||||
it "Verify postgres_hba_conf filtering by `type`" do
|
||||
|
|
|
@ -25,7 +25,7 @@ describe "Inspec::Resources::X509Certificate" do
|
|||
end
|
||||
|
||||
# TODO: Regenerate certificate using `InSpec` not `Inspec`
|
||||
it "verify subject distingushed name" do
|
||||
it "verify subject distinguished name" do
|
||||
_(resource_cert.send("subject_dn")).must_match "Inspec Test Certificate"
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ describe "Inspec::Resources::X509Certificate" do
|
|||
end
|
||||
|
||||
# TODO: Regenerate certificate using `InSpec` not `Inspec`
|
||||
it "verify issue distingushed name" do
|
||||
it "verify issue distinguished name" do
|
||||
_(resource_cert.send("issuer_dn")).must_match "Inspec Test CA"
|
||||
end
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ describe Inspec::Runner do
|
|||
_(config["reporter"]).must_equal expected
|
||||
end
|
||||
|
||||
it "delets format if set to a rspec format" do
|
||||
it "deletes format if set to a rspec format" do
|
||||
opts = { command_runner: :generic, backend_cache: true, "reporter" => ["progress"] }
|
||||
runner = Inspec::Runner.new(opts)
|
||||
config = runner.instance_variable_get(:"@conf")
|
||||
|
|
|
@ -38,25 +38,25 @@ describe NginxParser do
|
|||
_(result[0][:assignment][:args][0][:value]).must_equal "/a/b/c/*.conf"
|
||||
end
|
||||
|
||||
it "parses an assignemnt with single quote in a double quoted value" do
|
||||
it "parses an assignment with single quote in a double quoted value" do
|
||||
result = parse('include "/a/\'b/*.conf";')
|
||||
_(result[0][:assignment][:identifier]).must_equal "include"
|
||||
_(result[0][:assignment][:args][0][:value]).must_equal "/a/'b/*.conf"
|
||||
end
|
||||
|
||||
it "parses an assignemnt with double quote in a single quoted value" do
|
||||
it "parses an assignment with double quote in a single quoted value" do
|
||||
result = parse("include '/a/\"b/*.conf';")
|
||||
_(result[0][:assignment][:identifier]).must_equal "include"
|
||||
_(result[0][:assignment][:args][0][:value]).must_equal "/a/\"b/*.conf"
|
||||
end
|
||||
|
||||
it "parses an assignemnt with single quote in a single quoted value" do
|
||||
it "parses an assignment with single quote in a single quoted value" do
|
||||
result = parse("include '/a/\\\'b/*.conf';")
|
||||
_(result[0][:assignment][:identifier]).must_equal "include"
|
||||
_(result[0][:assignment][:args][0][:value]).must_equal "/a/\\\'b/*.conf"
|
||||
end
|
||||
|
||||
it "parses an assignemnt with double quote in a double quoted value" do
|
||||
it "parses an assignment with double quote in a double quoted value" do
|
||||
result = parse('include "/a/\"b/*.conf";')
|
||||
_(result[0][:assignment][:identifier]).must_equal "include"
|
||||
_(result[0][:assignment][:args][0][:value]).must_equal '/a/\"b/*.conf'
|
||||
|
|
Loading…
Reference in a new issue