2011-02-17 13:44:46 -05:00
|
|
|
require 'ecloud/spec_helper'
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
if Fog.mocking?
|
2011-02-17 13:44:46 -05:00
|
|
|
describe "Fog::Ecloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
2010-06-17 19:58:09 -04:00
|
|
|
subject { @vcloud }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2011-02-15 16:47:14 -05:00
|
|
|
it { should respond_to(:get_network) }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-10-17 19:06:44 -04:00
|
|
|
describe "#get_network" do
|
2010-06-17 19:58:09 -04:00
|
|
|
context "with a valid network uri" do
|
2010-10-17 19:06:44 -04:00
|
|
|
before { @network = @vcloud.get_network(@mock_network.href) }
|
2010-06-17 19:58:09 -04:00
|
|
|
subject { @network }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it_should_behave_like "all responses"
|
2011-02-15 16:47:14 -05:00
|
|
|
it { should have_headers_denoting_a_content_type_of("application/vnd.vmware.vcloud.network+xml") }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-10-17 19:06:44 -04:00
|
|
|
describe "#body" do
|
2010-06-17 19:58:09 -04:00
|
|
|
subject { @network.body }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it { should have(9).keys }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-10-17 19:06:44 -04:00
|
|
|
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
|
|
|
its(:Features) { should == @mock_network.features.map {|f| { f[:type] => f[:value] } }.first }
|
|
|
|
its(:href) { should == @mock_network.href }
|
|
|
|
its(:name) { should == @mock_network.name }
|
|
|
|
its(:Configuration) { should == { :Gateway => @mock_network.gateway, :Netmask => @mock_network.netmask } }
|
|
|
|
its(:Link) { should ==
|
|
|
|
[{:type => "application/xml",
|
|
|
|
:rel => "down",
|
|
|
|
:href => @mock_network_ip_collection.href,
|
|
|
|
:name => "IP Addresses"},
|
|
|
|
{:type => "application/xml",
|
|
|
|
:rel => "down",
|
|
|
|
:href => @mock_network_extensions.href,
|
|
|
|
:name => @mock_network_extensions.name}]}
|
2010-06-09 15:31:08 -04:00
|
|
|
end
|
|
|
|
end
|
2010-10-17 19:06:44 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
context "with a network uri that doesn't exist" do
|
|
|
|
subject { lambda { @vcloud.get_network(URI.parse('https://www.fakey.com/api/v0.8/network/999')) } }
|
|
|
|
it_should_behave_like "a request for a resource that doesn't exist"
|
|
|
|
end
|
2010-06-09 15:31:08 -04:00
|
|
|
end
|
|
|
|
end
|
2010-06-17 19:58:09 -04:00
|
|
|
else
|
2010-06-09 15:31:08 -04:00
|
|
|
end
|
|
|
|
|