mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
30446e5ac1
Many changes: -Become more of a proper Fog Service. -Drop most of the Collection/Model customizations. -Add a hook for services to do something after #new with the instance -Move to the ToHashDocument parser ... so no more having to actually make parsers. -Fog::Vcloud::Extension is kind of like Fog::Service, but for writing extension modules to Fog::Vcloud. -Fix up existing specs/mocks (they're not complete atm, but the existing ones are up to date). -Fog::Vcloud::Terremark::Ecloud gets almost all extensions implemented (almost). -Fog::Vcloud::Terremark::Ecloud bumped to working with the current TMRK API release. -Factor out some TMRK/ecloud specifc mock data into the ecloud module. -Probably forgetting something.
63 lines
2.4 KiB
Ruby
63 lines
2.4 KiB
Ruby
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
|
|
|
#
|
|
# WARNING: INCOMPLETE
|
|
#
|
|
|
|
if Fog.mocking?
|
|
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
|
subject { @vcloud }
|
|
|
|
it { should respond_to :get_vdc }
|
|
|
|
describe :get_vdc, :type => :vcloud_request do
|
|
context "with a valid vdc uri" do
|
|
before { @vdc = @vcloud.get_vdc(URI.parse(@mock_vdc[:href])) }
|
|
subject { @vdc }
|
|
|
|
it_should_behave_like "all responses"
|
|
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.vdc+xml" }
|
|
|
|
describe :body do
|
|
subject { @vdc.body }
|
|
|
|
it { should have(16).items }
|
|
|
|
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
|
|
|
its(:name) { should == @mock_vdc[:name] }
|
|
its(:href) { should == @mock_vdc[:href] }
|
|
its(:VmQuota) { should == "0" }
|
|
its(:Description) { should == @mock_vdc[:name] + " VDC" }
|
|
its(:NicQuota) { should == "0" }
|
|
its(:IsEnabled) { should == "true" }
|
|
its(:NetworkQuota) { should == "0" }
|
|
its(:AllocationModel) { should == "AllocationPool" }
|
|
its(:Link) { should have(7).links }
|
|
its(:ResourceEntities) { should have(1).resource }
|
|
|
|
let(:resource_entities) { subject[:ResourceEntities][:ResourceEntity] }
|
|
specify { resource_entities.should have(3).vapps }
|
|
#FIXME: test for the resources
|
|
|
|
its(:ComputeCapacity) { should == {:Memory => { :Units => "MB", :Allocated => @mock_vdc[:memory][:allocated], :Limit => @mock_vdc[:memory][:allocated] },
|
|
:Cpu => { :Units => "Mhz", :Allocated => @mock_vdc[:cpu][:allocated], :Limit => @mock_vdc[:cpu][:allocated] } } }
|
|
|
|
its(:StorageCapacity) { should == {:Units => "MB", :Allocated => @mock_vdc[:storage][:allocated], :Limit => @mock_vdc[:storage][:allocated] } }
|
|
|
|
let(:available_networks) { subject[:AvailableNetworks][:Network] }
|
|
specify { available_networks.should have(2).networks }
|
|
#FIXME :test the available networks
|
|
|
|
end
|
|
end
|
|
context "with a vdc uri that doesn't exist" do
|
|
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
|
|
it_should_behave_like "a request for a resource that doesn't exist"
|
|
end
|
|
end
|
|
end
|
|
else
|
|
end
|
|
|
|
|