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

Update mocks for address in create_server and corresponding tests.

This commit is contained in:
Rupak Ganguly 2012-04-11 12:39:13 -04:00
parent 86497010ca
commit 54b95431e7
3 changed files with 17 additions and 14 deletions

View file

@ -101,13 +101,13 @@ module Fog
response = Excon::Response.new
response.status = 202
if options['security_groups']
sec_group_name = options['security_groups'][0]
else
sec_group_name = "default"
end
#if options['security_groups']
# sec_group_name = options['security_groups'][0]
#else
# sec_group_name = "default"
#end
data = {
'addresses' => {},
'addresses' => { "private"=>[{"version"=>4, "addr"=>Fog::HP::Mock.ip_address}] },
'flavor' => {"id"=>"#{flavor_id}", "links"=>[{"href"=>"http://nova1:8774/admin/flavors/#{flavor_id}", "rel"=>"bookmark"}]},
'id' => Fog::Mock.random_numbers(6).to_i,
'image' => {"id"=>"#{image_id}", "links"=>[{"href"=>"http://nova1:8774/admin/images/#{image_id}", "rel"=>"bookmark"}]},

View file

@ -4,21 +4,24 @@ Shindo.tests('Fog::Compute[:hp] | address requests', ['hp']) do
tests('success') do
@server = Fog::Compute[:hp].servers.create(:name => 'fogaddresstests', :flavor_id => 100, :image_id => @base_image_id)
@server.wait_for { ready? }
@address = Fog::Compute[:hp].addresses.create
@address.server = @server
# the network name is currently named 'private'
tests("#list_server_addresses(#{@server.id})").formats({'addresses' => {"private" => [Hash]}}) do
tests("#list_server_addresses(#{@server.id})").formats({'addresses' => {"private" => [{'version' => Integer, 'addr' => String}]}}) do
Fog::Compute[:hp].list_server_addresses(@server.id).body
end
tests("#list_server_private_addresses(#{@server.id}, 'private')").formats({'private' => [Hash]}) do
tests("#list_server_private_addresses(#{@server.id}, 'private')").formats({'private' => [{'version' => Integer, 'addr' => String}]}) do
Fog::Compute[:hp].list_server_private_addresses(@server.id, 'private').body
end
tests("#list_server_public_addresses(#{@server.id}, 'private')").formats({'public' => [Hash]}) do
tests("#list_server_public_addresses(#{@server.id}, 'private')").formats({'public' => [{'version' => Integer, 'addr' => String}]}) do
Fog::Compute[:hp].list_server_public_addresses(@server.id, 'private').body
end
@server.wait_for { ready? }
@address.destroy
@server.destroy
end

View file

@ -63,8 +63,8 @@ Shindo.tests('Fog::Compute[:hp] | server requests', ['hp']) do
Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? }
tests("#update_server(#{@server_id}, :name => 'fogupdatedserver')").succeeds do
Fog::Compute[:hp].update_server(@server_id, :name => 'fogupdatedserver')
tests("#update_server(#{@server_id}, :name => 'fogupdateserver')").succeeds do
Fog::Compute[:hp].update_server(@server_id, :name => 'fogupdateserver')
end
Fog::Compute[:hp].servers.get(@server_id).wait_for { ready? }
@ -110,8 +110,8 @@ Shindo.tests('Fog::Compute[:hp] | server requests', ['hp']) do
Fog::Compute[:hp].get_server_details(0)
end
tests("#update_server(0, :name => 'fogupdatedserver')").raises(Fog::Compute::HP::NotFound) do
Fog::Compute[:hp].update_server(0, :name => 'fogupdatedserver')
tests("#update_server(0, :name => 'fognonserver')").raises(Fog::Compute::HP::NotFound) do
Fog::Compute[:hp].update_server(0, :name => 'fognonserver')
end
tests('#reboot_server(0)').raises(Fog::Compute::HP::NotFound) do