summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2016-04-07 16:02:03 -0700
committerSalim Alam <salam@chef.io>2016-04-07 16:02:03 -0700
commit42a7bd45202848b19f25e90a4131b967cbf4f675 (patch)
tree6f66e4e20d37ee297b8dcfa28f31373c4879717c
parentefc7e38ac32dd362029e65b57ae4825db4d15cb0 (diff)
downloadchef-salam/group-fix.tar.gz
Update specssalam/group-fix
-rw-r--r--lib/chef/provider/group/windows.rb2
-rw-r--r--spec/functional/resource/group_spec.rb8
-rw-r--r--spec/unit/provider/group/windows_spec.rb7
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/chef/provider/group/windows.rb b/lib/chef/provider/group/windows.rb
index c115c40ccf..5873e42a6b 100644
--- a/lib/chef/provider/group/windows.rb
+++ b/lib/chef/provider/group/windows.rb
@@ -100,7 +100,7 @@ class Chef
begin
Chef::ReservedNames::Win32::Security.lookup_account_name(locally_qualified_name(account_name))[1].to_s
rescue Chef::Exceptions::Win32APIError
- Chef::Log.warn("SID for '#{locally_qualified_name}' could not be found")
+ Chef::Log.warn("SID for '#{locally_qualified_name(account_name)}' could not be found")
""
end
end
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index 521c8e887d..f7c232b588 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -267,14 +267,14 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
end
describe "when removing members" do
- it "raises an error for a non well-formed domain name" do
+ it "does not raise an error for a non well-formed domain name" do
group_resource.excluded_members [invalid_domain_user_name]
- expect { group_resource.run_action(tested_action) }.to raise_error Chef::Exceptions::Win32APIError
+ expect { group_resource.run_action(tested_action) }.to_not raise_error Chef::Exceptions::Win32APIError
end
- it "raises an error for a nonexistent domain" do
+ it "does not raise an error for a nonexistent domain" do
group_resource.excluded_members [nonexistent_domain_user_name]
- expect { group_resource.run_action(tested_action) }.to raise_error Chef::Exceptions::Win32APIError
+ expect { group_resource.run_action(tested_action) }.to_not raise_error Chef::Exceptions::Win32APIError
end
end
end
diff --git a/spec/unit/provider/group/windows_spec.rb b/spec/unit/provider/group/windows_spec.rb
index f551a898d9..f059f2e717 100644
--- a/spec/unit/provider/group/windows_spec.rb
+++ b/spec/unit/provider/group/windows_spec.rb
@@ -51,6 +51,7 @@ describe Chef::Provider::Group::Windows do
@new_resource.members([ "us" ])
@current_resource = Chef::Resource::Group.new("staff")
@current_resource.members %w{all your base}
+ @new_resource.excluded_members %w{all}
allow(Chef::Util::Windows::NetGroup).to receive(:new).and_return(@net_group)
allow(@net_group).to receive(:local_add_members)
@@ -72,6 +73,12 @@ describe Chef::Provider::Group::Windows do
@provider.manage_group
end
+ it "should call @net_group.local_delete_members" do
+ allow(@new_resource).to receive(:append).and_return(true)
+ allow(@provider).to receive(:lookup_account_name).with("all").and_return("all")
+ expect(@net_group).to receive(:local_delete_members).with(@new_resource.excluded_members)
+ @provider.manage_group
+ end
end
describe "remove_group" do