2011-02-17 10:44:46 -08:00
|
|
|
require 'ecloud/spec_helper'
|
2010-06-29 21:15:36 -07:00
|
|
|
|
|
|
|
if Fog.mocking?
|
2011-02-17 10:44:46 -08:00
|
|
|
describe "Fog::Ecloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
2010-06-29 21:15:36 -07:00
|
|
|
subject { @vcloud }
|
|
|
|
|
2011-02-15 13:47:14 -08:00
|
|
|
it { should respond_to(:configure_node) }
|
2010-06-29 21:15:36 -07:00
|
|
|
|
|
|
|
describe "#configure_node" do
|
2010-10-18 07:06:44 +08:00
|
|
|
let(:original_node) { @vcloud.get_node(@mock_node.href).body }
|
2010-06-29 21:15:36 -07:00
|
|
|
let(:node_data) { { :name => "TEST BOOM", :enabled => "false", :description => "TEST BOOM DESC" } }
|
|
|
|
|
|
|
|
context "with a valid node service uri" do
|
|
|
|
|
2010-10-18 07:06:44 +08:00
|
|
|
subject { @vcloud.configure_node(@mock_node.href,node_data) }
|
2010-06-29 21:15:36 -07:00
|
|
|
|
|
|
|
it_should_behave_like "all responses"
|
|
|
|
|
|
|
|
describe "#body" do
|
2010-10-18 07:06:44 +08:00
|
|
|
subject { @vcloud.configure_node(@mock_node.href,node_data).body }
|
|
|
|
|
|
|
|
#Stuff that shouldn't change
|
|
|
|
its(:Href) { should == @mock_node.href }
|
|
|
|
its(:Id) { should == @mock_node.object_id.to_s }
|
|
|
|
its(:Port) { should == @mock_node.port.to_s }
|
|
|
|
its(:IpAddress) { should == @mock_node.ip_address }
|
|
|
|
|
|
|
|
#Stuff that should change
|
|
|
|
it "should change the name" do
|
|
|
|
expect { subject }.to change { @vcloud.get_node(@mock_node.href).body[:Name] }.to(node_data[:name])
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should change enabled" do
|
|
|
|
expect { subject }.to change { @vcloud.get_node(@mock_node.href).body[:Enabled] }.to(node_data[:enabled])
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should change the description" do
|
|
|
|
expect { subject }.to change { @vcloud.get_node(@mock_node.href).body[:Description] }.to(node_data[:description])
|
|
|
|
end
|
2010-06-29 21:15:36 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with a nodes uri that doesn't exist" do
|
|
|
|
subject { lambda { @vcloud.configure_node(URI.parse('https://www.fakey.c/piv8vc99'), node_data) } }
|
|
|
|
|
|
|
|
it_should_behave_like "a request for a resource that doesn't exist"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
end
|