2010-06-09 19:20:14 -04:00
|
|
|
require File.join(File.dirname(__FILE__),'..','..','..','spec_helper')
|
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
if Fog.mocking?
|
|
|
|
describe "Fog::Vcloud::Terremark::Ecloud::Network", :type => :mock_tmrk_ecloud_model do
|
|
|
|
subject { @vcloud }
|
2010-06-09 19:20:14 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
describe :class do
|
|
|
|
subject { Fog::Vcloud::Terremark::Ecloud::Network }
|
2010-06-09 19:20:14 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it { should have_identity :href }
|
2010-11-17 13:04:32 -05:00
|
|
|
it { should have_only_these_attributes [:href, :name, :features, :links, :type, :gateway, :broadcast, :address, :rnat, :extension_href, :network_type, :vlan, :friendly_name] }
|
2010-06-17 19:58:09 -04:00
|
|
|
end
|
2010-06-09 19:20:14 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
context "with no uri" do
|
2010-06-09 19:20:14 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
subject { Fog::Vcloud::Terremark::Ecloud::Network.new() }
|
2010-06-09 19:20:14 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it { should have_all_attributes_be_nil }
|
2010-06-09 19:20:14 -04:00
|
|
|
end
|
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
context "as a collection member" do
|
2010-10-17 19:06:44 -04:00
|
|
|
subject { @vcloud.vdcs[0].networks[0].reload }
|
2010-06-17 19:58:09 -04:00
|
|
|
|
|
|
|
it { should be_an_instance_of Fog::Vcloud::Terremark::Ecloud::Network }
|
|
|
|
|
2010-10-17 19:06:44 -04:00
|
|
|
its(:href) { should == @mock_network.href }
|
|
|
|
its(:identity) { should == @mock_network.href }
|
|
|
|
its(:name) { should == @mock_network.name }
|
2010-06-17 19:58:09 -04:00
|
|
|
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
2010-10-17 19:06:44 -04:00
|
|
|
its(:gateway) { should == @mock_network.gateway }
|
|
|
|
its(:broadcast) { should == @mock_network.broadcast }
|
|
|
|
its(:address) { should == @mock_network.address }
|
|
|
|
its(:rnat) { should == @mock_network.rnat }
|
|
|
|
its(:extension_href) { should == @mock_network.extensions.href }
|
2010-11-17 13:04:32 -05:00
|
|
|
its(:network_type) { should == @mock_network.extensions.type }
|
|
|
|
its(:vlan) { should == @mock_network.extensions.vlan }
|
|
|
|
its(:friendly_name) { should == @mock_network.extensions.friendly_name }
|
2010-06-17 19:58:09 -04:00
|
|
|
|
|
|
|
it { should have(1).features }
|
|
|
|
|
|
|
|
describe :features do
|
|
|
|
let(:feature) { subject.features[0] }
|
|
|
|
specify { feature.should be_an_instance_of Hash }
|
2010-10-17 19:06:44 -04:00
|
|
|
specify { feature[:FenceMode].should == @mock_network.features[0][:value] }
|
2010-06-17 19:58:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it { should have(2).links }
|
|
|
|
|
|
|
|
describe :links do
|
|
|
|
context "[0]" do
|
|
|
|
let(:link) { subject.links[0] }
|
|
|
|
specify { link[:rel].should == "down" }
|
2010-10-17 19:06:44 -04:00
|
|
|
specify { link[:href].should == @mock_network_ip_collection.href }
|
2010-06-17 19:58:09 -04:00
|
|
|
specify { link[:type].should == "application/xml" }
|
2010-10-17 19:06:44 -04:00
|
|
|
specify { link[:name].should == @mock_network_ip_collection.name }
|
2010-06-17 19:58:09 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context "[1]" do
|
|
|
|
let(:link) { subject.links[1] }
|
|
|
|
specify { link[:rel].should == "down" }
|
2010-10-17 19:06:44 -04:00
|
|
|
specify { link[:href].should == @mock_network.extensions.href }
|
2010-06-17 19:58:09 -04:00
|
|
|
specify { link[:type].should == "application/xml" }
|
2010-10-17 19:06:44 -04:00
|
|
|
specify { link[:name].should == @mock_network.name }
|
2010-06-17 19:58:09 -04:00
|
|
|
end
|
|
|
|
end
|
2010-06-09 19:20:14 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2010-06-17 19:58:09 -04:00
|
|
|
else
|
2010-06-09 19:20:14 -04:00
|
|
|
end
|
|
|
|
|