2010-06-17 19:58:09 -04:00
|
|
|
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2010-06-08 21:39:00 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
if Fog.mocking?
|
|
|
|
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
|
|
|
subject { @vcloud }
|
2010-06-08 21:39:00 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it { should respond_to :get_network }
|
2010-06-08 21:39:00 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
describe :get_network, :type => :vcloud_request do
|
|
|
|
context "with a valid network uri" do
|
|
|
|
before { @network = @vcloud.get_network(URI.parse(@mock_network[:href])) }
|
|
|
|
subject { @network }
|
2010-06-08 21:39:00 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it_should_behave_like "all responses"
|
|
|
|
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.network+xml" }
|
2010-06-08 21:39:00 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
describe :body do
|
|
|
|
subject { @network.body }
|
2010-06-08 21:39:00 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it { should have(9).keys }
|
2010-06-08 21:39:00 -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
|
|
|
|
it { should have_key_with_value :type, "application/vnd.vmware.vcloud.network+xml" }
|
|
|
|
it { should have_key_with_value :Features, "" }
|
|
|
|
it { should have_key_with_value :Description, @mock_network[:name] }
|
|
|
|
it { should have_key_with_value :href, @mock_network[:href] }
|
|
|
|
it { should have_key_with_value :name, @mock_network[:name] }
|
|
|
|
it { should have_key_with_value :Configuration, {:Gateway => @mock_network[:gateway],
|
|
|
|
:Netmask => @mock_network[:netmask],
|
|
|
|
:Dns => @mock_network[:dns] } }
|
2010-06-08 21:39:00 -04:00
|
|
|
end
|
|
|
|
end
|
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-08 21:39:00 -04:00
|
|
|
end
|
|
|
|
end
|
2010-06-17 19:58:09 -04:00
|
|
|
else
|
|
|
|
|
|
|
|
describe Fog::Vcloud, :type => :vcloud_request do
|
|
|
|
end
|
|
|
|
|
2010-06-08 21:39:00 -04:00
|
|
|
end
|