summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXabier de Zuazo <xabier@onddo.com>2014-05-24 17:21:17 +0200
committerXabier de Zuazo <xabier@onddo.com>2014-05-24 17:21:17 +0200
commitadfa511fdb998c9774aaaabde9e86ffac10f436d (patch)
tree6691377b924780a00effbcea15c17457b848c027
parentc6c0020841eeca3774e91acf3c52b5cbfb4df860 (diff)
downloadchef-adfa511fdb998c9774aaaabde9e86ffac10f436d.tar.gz
[CHEF-5328] Added tests for Chef::User.list with inflate=true
-rw-r--r--spec/unit/user_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index c535e4172b..08bde33d7b 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -205,6 +205,8 @@ describe Chef::User do
Chef::Config[:chef_server_url] = "http://www.example.com"
@osc_response = { "admin" => "http://www.example.com/users/admin"}
@ohc_response = [ { "user" => { "username" => "admin" }} ]
+ Chef::User.stub(:load).with("admin").and_return(@user)
+ @osc_inflated_response = { "admin" => @user }
end
it "lists all clients on an OSC server" do
@@ -212,12 +214,22 @@ describe Chef::User do
Chef::User.list.should == @osc_response
end
+ it "inflate all clients on an OSC server" do
+ @http_client.stub(:get_rest).with("users").and_return(@osc_response)
+ Chef::User.list(true).should == @osc_inflated_response
+ end
+
it "lists all clients on an OHC/OPC server" do
@http_client.stub(:get_rest).with("users").and_return(@ohc_response)
# We expect that Chef::User.list will give a consistent response
# so OHC API responses should be transformed to OSC-style output.
Chef::User.list.should == @osc_response
end
+
+ it "inflate all clients on an OHC/OPC server" do
+ @http_client.stub(:get_rest).with("users").and_return(@ohc_response)
+ Chef::User.list(true).should == @osc_inflated_response
+ end
end
describe "create" do