1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

set status when instantiating a vapp template, return it from the mock data in get vapp

This commit is contained in:
Dan Peterson 2010-10-15 15:04:25 -03:00
parent 549b3abb04
commit cee42dce00
5 changed files with 7 additions and 5 deletions

View file

@ -333,7 +333,8 @@ module Fog
:ip => "1.2.3.3", :ip => "1.2.3.3",
:memory => 1024, :memory => 1024,
:cpus => 1, :cpus => 1,
:disks => [{ :size => 25 }] :disks => [{ :size => 25 }],
:status => 2
}, },
{ :href => "#{base_url}/vap/42", { :href => "#{base_url}/vap/42",
:name => "Broom 2", :name => "Broom 2",

View file

@ -30,7 +30,7 @@ module Fog
:href => vapp[:href], :href => vapp[:href],
:type => "application/vnd.vmware.vcloud.vApp+xml", :type => "application/vnd.vmware.vcloud.vApp+xml",
:name => vapp[:name], :name => vapp[:name],
:status => 2 :status => vapp[:status] || 4
)) do )) do
builder.Link(:rel => "up", :href => vdc[:href], :type => "application/vnd.vmware.vcloud.vdc+xml") builder.Link(:rel => "up", :href => vdc[:href], :type => "application/vnd.vmware.vcloud.vdc+xml")

View file

@ -109,7 +109,7 @@ module Fog
if vdc = vdc_from_uri(options[:vdc_uri]) if vdc = vdc_from_uri(options[:vdc_uri])
vapp_id = rand(1000) vapp_id = rand(1000)
vapp_uri = Fog::Vcloud::Terremark::Ecloud::Mock.vapp_href(:id => vapp_id) vapp_uri = Fog::Vcloud::Terremark::Ecloud::Mock.vapp_href(:id => vapp_id)
options.update(:id => vapp_id.to_s, :href => vapp_uri, :disks => catalog_item[:disks], :ip => random_ip_in_network(options[:network_uri])) options.update(:id => vapp_id.to_s, :href => vapp_uri, :disks => catalog_item[:disks], :ip => random_ip_in_network(options[:network_uri]), :status => 2)
vdc[:vms] << options vdc[:vms] << options
xml = generate_instantiate_vapp_template_response(vdc[:href], options[:name], vapp_uri) xml = generate_instantiate_vapp_template_response(vdc[:href], options[:name], vapp_uri)

View file

@ -26,8 +26,8 @@ if Fog.mocking?
its(:href) { should == vm_data[:href] } its(:href) { should == vm_data[:href] }
its(:name) { should == vm_data[:name] } its(:name) { should == vm_data[:name] }
its(:status) { should == "2" } its(:status) { should == vm_data[:status].to_s }
its(:size) { (25 * 1024).to_s } its(:size) { (vm_data[:disks].inject(0) {|s, d| s += d[:size] } * 1024).to_s }
describe "Link" do describe "Link" do
subject { @vapp.body[:Link] } subject { @vapp.body[:Link] }

View file

@ -41,6 +41,7 @@ if Fog.mocking?
it { should include :href } it { should include :href }
it { should include :disks } it { should include :disks }
it { should include :ip } it { should include :ip }
its(:status) { should == 2 }
its(:disks) { should == catalog_item_data[:disks] } its(:disks) { should == catalog_item_data[:disks] }