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

[brightbox] fix cloud_ip tests

This commit is contained in:
geemus 2011-01-03 17:16:00 -08:00
parent f137582465
commit f9285d3706
2 changed files with 22 additions and 8 deletions

View file

@ -2,16 +2,20 @@ Shindo.tests('Brightbox::Compute | cloud ip requests', ['brightbox']) do
tests('success') do tests('success') do
tests("#create_cloud_ip()").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do unless Fog.mocking?
@server = Brightbox[:compute].servers.create(compute_providers[Brightbox][:server_attributes])
end
tests("#create_cloud_ip").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
pending if Fog.mocking? pending if Fog.mocking?
data = Brightbox[:compute].create_cloud_ip() data = Brightbox[:compute].create_cloud_ip
@cloud_ip_id = data["id"] @cloud_ip_id = data["id"]
data data
end end
tests("#list_cloud_ips()").formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) do tests("#list_cloud_ips").formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) do
pending if Fog.mocking? pending if Fog.mocking?
Brightbox[:compute].list_cloud_ips() Brightbox[:compute].list_cloud_ips
end end
tests("#get_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do tests("#get_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
@ -20,9 +24,8 @@ Shindo.tests('Brightbox::Compute | cloud ip requests', ['brightbox']) do
end end
unless Fog.mocking? unless Fog.mocking?
server = Brightbox[:compute].servers.first @server.wait_for { ready? }
interface_id = server.interfaces.first["id"] map_options = {:interface => @server.interfaces.first["id"]}
map_options = {:interface => interface_id}
end end
tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
@ -44,6 +47,10 @@ Shindo.tests('Brightbox::Compute | cloud ip requests', ['brightbox']) do
Brightbox[:compute].destroy_cloud_ip(@cloud_ip_id) Brightbox[:compute].destroy_cloud_ip(@cloud_ip_id)
end end
unless Fog.mocking?
@server.destroy
end
end end
tests('failure') do tests('failure') do
@ -60,4 +67,5 @@ Shindo.tests('Brightbox::Compute | cloud ip requests', ['brightbox']) do
end end
end end

View file

@ -5,6 +5,7 @@ module Fog
module Account; end module Account; end
module Image; end module Image; end
module Interface; end module Interface; end
module LoadBalancer; end
module Server; end module Server; end
module Zone; end module Zone; end
end end
@ -23,6 +24,9 @@ NilClass.send :include, Fog::Brightbox::Nullable::Image
Hash.send :include, Fog::Brightbox::Nullable::Interface Hash.send :include, Fog::Brightbox::Nullable::Interface
NilClass.send :include, Fog::Brightbox::Nullable::Interface NilClass.send :include, Fog::Brightbox::Nullable::Interface
Hash.send :include, Fog::Brightbox::Nullable::LoadBalancer
NilClass.send :include, Fog::Brightbox::Nullable::LoadBalancer
Hash.send :include, Fog::Brightbox::Nullable::Server Hash.send :include, Fog::Brightbox::Nullable::Server
NilClass.send :include, Fog::Brightbox::Nullable::Server NilClass.send :include, Fog::Brightbox::Nullable::Server
@ -164,6 +168,7 @@ class Brightbox
"reverse_dns" => String, "reverse_dns" => String,
"account" => Brightbox::Compute::Formats::Nested::ACCOUNT, "account" => Brightbox::Compute::Formats::Nested::ACCOUNT,
"interface" => Fog::Brightbox::Nullable::Interface, "interface" => Fog::Brightbox::Nullable::Interface,
"load_balancer" => Fog::Brightbox::Nullable::LoadBalancer,
"server" => Fog::Brightbox::Nullable::String "server" => Fog::Brightbox::Nullable::String
} }
@ -296,8 +301,9 @@ class Brightbox
"public_ip" => String, "public_ip" => String,
"status" => String, "status" => String,
"reverse_dns" => String, "reverse_dns" => String,
"account" => Brightbox::Compute::Formats::Nested::ACCOUNT, "account" => Fog::Brightbox::Nullable::Account,
"interface" => Fog::Brightbox::Nullable::Interface, "interface" => Fog::Brightbox::Nullable::Interface,
"load_balancer" => Fog::Brightbox::Nullable::LoadBalancer,
"server" => Fog::Brightbox::Nullable::Server "server" => Fog::Brightbox::Nullable::Server
} }