diff options
author | Davin Taddeo <davin@chef.io> | 2020-06-15 16:06:28 -0400 |
---|---|---|
committer | Davin Taddeo <davin@chef.io> | 2020-06-15 16:06:28 -0400 |
commit | 96f152f0a87440b4b7b788f62173ebfea72ab0f3 (patch) | |
tree | c2385476150b0d9de9636af04a0a427ab69b433a /spec | |
parent | 689484b3cc0c71dd0abc1e3736d4ad7a9d86ddb9 (diff) | |
parent | ad345a5d39e3aa36b56b94481a010dcef0571dda (diff) | |
download | chef-96f152f0a87440b4b7b788f62173ebfea72ab0f3.tar.gz |
Merge branch 'master' of github.com:chef/chef into windows_firewall_profile
Signed-off-by: Davin Taddeo <davin@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/application_spec.rb | 7 | ||||
-rw-r--r-- | spec/unit/resource/windows_audit_policy_spec.rb | 64 |
2 files changed, 71 insertions, 0 deletions
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index ea784f1d55..031132f31d 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -94,6 +94,13 @@ describe Chef::Application do end end + describe "when enforce_license is set to false" do + it "should not check the license acceptance" do + expect(@app).to_not receive(:check_license_acceptance) + @app.run(enforce_license: false) + end + end + it "should run the actual application" do expect(@app).to receive(:run_application).and_return(true) @app.run diff --git a/spec/unit/resource/windows_audit_policy_spec.rb b/spec/unit/resource/windows_audit_policy_spec.rb new file mode 100644 index 0000000000..80a92f2656 --- /dev/null +++ b/spec/unit/resource/windows_audit_policy_spec.rb @@ -0,0 +1,64 @@ +# +# Copyright:: Copyright (c) Chef Software Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "spec_helper" + +describe Chef::Resource::WindowsAuditPolicy do + let(:resource) { Chef::Resource::WindowsAuditPolicy.new("fakey_fakerton") } + + it "sets resource name as :windows_audit_policy" do + expect(resource.resource_name).to eql(:windows_audit_policy) + end + + it "expects crash_on_audit_fail to have a true or false value if entered" do + expect { resource.crash_on_audit_fail "not_a_true_or_false" }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + it "expects full_privilege_auditing to have a true or false value if entered" do + expect { resource.full_privilege_auditing "not_a_true_or_false" }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + it "expects audit_base_objects to have a true or false value if entered" do + expect { resource.audit_base_objects "not_a_true_or_false" }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + it "expects audit_base_directories to have a true or false value if entered" do + expect { resource.audit_base_directories "not_a_true_or_false" }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + it "expects success property to have a true or false value if entered" do + expect { resource.success "not_a_true_or_false" }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + it "expects failure property to have a true or false value if entered" do + expect { resource.failure "not_a_true_or_false" }.to raise_error(Chef::Exceptions::ValidationFailed) + end + + Chef::Resource::WindowsAuditPolicy::WIN_AUDIT_SUBCATEGORIES.each do |val| + it "the subcategory property accepts :#{val}" do + expect { resource.subcategory val }.not_to raise_error + end + end + + it "the resource raises an ArgumentError if invalid subcategory property is set" do + expect { resource.subcategory "Logount" }.to raise_error(ArgumentError) + end + + it "sets the default action as :set" do + expect(resource.action).to eql([:set]) + end +end |