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_ips) }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
describe "#get_network_ips" do
|
|
|
|
context "with a valid VDC network ips_uri" do
|
2010-10-17 19:06:44 -04:00
|
|
|
before { @ips = @vcloud.get_network_ips(@mock_network_ip_collection.href) }
|
2010-06-17 19:58:09 -04:00
|
|
|
subject { @ips }
|
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.tmrk.ecloud.ipAddressesList+xml") }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
describe "#body" do
|
|
|
|
subject { @ips.body }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
it { should have(1).item }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
context "[:IpAddress]" do
|
|
|
|
subject { @ips.body[:IpAddress] }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
# Note the real TMRK API returns only "assigned" ips currently
|
|
|
|
# This is a bug they've slated to fix in the next release.
|
|
|
|
it { should have(252).addresses }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
context "one we know is assigned" do
|
|
|
|
let(:address) { @ips.body[:IpAddress][0] }
|
2010-11-05 09:45:48 -04:00
|
|
|
specify { address.should have(6).keys }
|
2010-06-17 19:58:09 -04:00
|
|
|
specify { address[:Status].should == "Assigned" }
|
|
|
|
specify { address[:Server].should == "Broom 1" }
|
|
|
|
specify { address[:Name].should == "1.2.3.3" }
|
|
|
|
specify { address[:RnatAddress].should == "99.1.2.3" }
|
2010-06-09 15:31:08 -04:00
|
|
|
end
|
|
|
|
|
2010-11-05 09:45:48 -04:00
|
|
|
context "one we know is not assigned" do
|
2010-06-17 19:58:09 -04:00
|
|
|
let(:address) { @ips.body[:IpAddress][100] }
|
2010-11-05 09:45:48 -04:00
|
|
|
specify { address.should have(5).keys }
|
2010-06-17 19:58:09 -04:00
|
|
|
specify { address[:Status].should == "Available" }
|
|
|
|
specify { address.has_key?(:Server).should be_false }
|
|
|
|
specify { address[:Name].should == "1.2.3.103" }
|
|
|
|
specify { address[:RnatAddress].should == "99.1.2.3" }
|
|
|
|
end
|
2010-06-09 15:31:08 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-06-17 19:58:09 -04:00
|
|
|
context "with a network ips uri that doesn't exist" do
|
|
|
|
subject { lambda { @vcloud.get_network_ips(URI.parse('https://www.fakey.c/piv8vc99')) } }
|
2010-06-09 15:31:08 -04:00
|
|
|
|
2011-02-15 16:47:14 -05:00
|
|
|
it_should_behave_like("a request for a resource that doesn't exist")
|
2010-06-17 19:58:09 -04:00
|
|
|
end
|
2010-06-09 15:31:08 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|