diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-11-21 12:13:51 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 12:13:51 -0800 |
commit | 7c2665b6d1cfeb4e98f87235b4cc5d284da66740 (patch) | |
tree | 39329bac07d47f3b89a53de91a7919c18e15b218 /spec | |
parent | 92448e24b146e0f01063ac0b51bcfa2c621d0b3b (diff) | |
parent | 037355caa9ff049892df8469d64f57e5ff330bc2 (diff) | |
download | chef-7c2665b6d1cfeb4e98f87235b4cc5d284da66740.tar.gz |
Merge pull request #6588 from chef/lcg/test-revert
Revert "add missing functional tests for users"
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/win32/security_spec.rb | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb index f3faf24c52..40ae99bfa4 100644 --- a/spec/functional/win32/security_spec.rb +++ b/spec/functional/win32/security_spec.rb @@ -17,8 +17,6 @@ # require "spec_helper" -require "mixlib/shellout" -require "chef/mixin/user_context" if Chef::Platform.windows? require "chef/win32/security" end @@ -28,37 +26,13 @@ describe "Chef::Win32::Security", :windows_only do expect(Chef::ReservedNames::Win32::Security.has_admin_privileges?).to eq(true) end - describe "running as non admin user" do - include Chef::Mixin::UserContext - let(:user) { "security_user" } - let(:password) { "Security@123" } - - let(:domain) do - whoami = Mixlib::ShellOut.new("whoami") - whoami.run_command - whoami.error! - whoami.stdout.split("\\")[0] - end - before do - allow_any_instance_of(Chef::Mixin::UserContext).to receive(:node).and_return({ "platform_family" => "windows" }) - allow(Chef::Platform).to receive(:windows_server_2003?).and_return(false) - allow(Chef::ReservedNames::Win32::Security).to receive(:OpenProcessToken).and_return(true) - add_user = Mixlib::ShellOut.new("net user #{user} #{password} /ADD") - add_user.run_command - add_user.error! - end - - after do - delete_user = Mixlib::ShellOut.new("net user #{user} /delete") - delete_user.run_command - delete_user.error! - end - it "has_admin_privileges? returns false" do - has_admin_privileges = with_user_context(user, password, domain) do - Chef::ReservedNames::Win32::Security.has_admin_privileges? - end - expect(has_admin_privileges).to eq(false) - end + # We've done some investigation adding a negative test and it turned + # out to be a lot of work since mixlib-shellout doesn't have user + # support for windows. + # + # TODO - Add negative tests once mixlib-shellout has user support + it "has_admin_privileges? returns false when running as non-admin" do + skip "requires user support in mixlib-shellout" end describe "get_file_security" do |