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

[brightbox] Revised tests structure

This commit is contained in:
Paul Thornthwaite 2011-09-29 10:15:03 +01:00
parent 5fe0d6c57f
commit e418c6540e
11 changed files with 157 additions and 124 deletions

View file

@ -2,20 +2,25 @@ Shindo.tests('Fog::Compute[:brightbox] | account requests', ['brightbox']) do
tests('success') do tests('success') do
tests("#get_account").formats(Brightbox::Compute::Formats::Full::ACCOUNT) do tests("#get_account") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_account result = Fog::Compute[:brightbox].get_account
formats(Brightbox::Compute::Formats::Full::ACCOUNT) { result }
test("ftp password is blanked") { result["library_ftp_password"].nil? }
end end
update_options = {:name => "Fog@#{Time.now.iso8601}"} update_options = {:name => "Fog@#{Time.now.iso8601}"}
tests("#update_account(#{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::ACCOUNT) do tests("#update_account(#{update_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].update_account(update_options) result = Fog::Compute[:brightbox].update_account(update_options)
formats(Brightbox::Compute::Formats::Full::ACCOUNT) { result }
end end
tests("#reset_ftp_password_account").formats(Brightbox::Compute::Formats::Full::ACCOUNT) do tests("#reset_ftp_password_account") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].reset_ftp_password_account result = Fog::Compute[:brightbox].reset_ftp_password_account
formats(Brightbox::Compute::Formats::Full::ACCOUNT) { result }
test("new ftp password is visible") { ! result["library_ftp_password"].nil? }
end end
end end

View file

@ -7,32 +7,36 @@ Shindo.tests('Fog::Compute[:brightbox] | api client requests', ['brightbox']) do
:description => "Description from Fog test" :description => "Description from Fog test"
} }
tests("#create_api_client(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do tests("#create_api_client(#{create_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].create_api_client(create_options) result = Fog::Compute[:brightbox].create_api_client(create_options)
@api_client_id = data["id"] @api_client_id = result["id"]
data formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
end end
tests("#list_api_clients").formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) do tests("#list_api_clients") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].list_api_clients result = Fog::Compute[:brightbox].list_api_clients
formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) { result }
end end
tests("#get_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do tests("#get_api_client('#{@api_client_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_api_client(@api_client_id) result = Fog::Compute[:brightbox].get_api_client(@api_client_id)
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
end end
update_options = {:name => "Fog@#{Time.now.iso8601}"} update_options = {:name => "Fog@#{Time.now.iso8601}"}
tests("#update_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do tests("#update_api_client('#{@api_client_id}', #{update_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options) result = Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
end end
tests("#destroy_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do tests("#destroy_api_client('#{@api_client_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].destroy_api_client(@api_client_id) result = Fog::Compute[:brightbox].destroy_api_client(@api_client_id)
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
end end
end end

View file

@ -6,41 +6,46 @@ Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
@server = Brightbox::Compute::TestSupport.get_test_server @server = Brightbox::Compute::TestSupport.get_test_server
end end
tests("#create_cloud_ip").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do tests("#create_cloud_ip") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].create_cloud_ip result = Fog::Compute[:brightbox].create_cloud_ip
@cloud_ip_id = data["id"] @cloud_ip_id = result["id"]
data formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
end end
tests("#list_cloud_ips").formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) do tests("#list_cloud_ips") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].list_cloud_ips result = Fog::Compute[:brightbox].list_cloud_ips
formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) { result }
end end
tests("#get_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do tests("#get_cloud_ip('#{@cloud_ip_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_cloud_ip(@cloud_ip_id) result = Fog::Compute[:brightbox].get_cloud_ip(@cloud_ip_id)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
end end
map_options = {:destination => @server.interfaces.first["id"]} map_options = {:destination => @server.interfaces.first["id"]}
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})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options) result = Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
end end
unless Fog.mocking? unless Fog.mocking?
Fog::Compute[:brightbox].cloud_ips.get(@cloud_ip_id).wait_for { mapped? } Fog::Compute[:brightbox].cloud_ips.get(@cloud_ip_id).wait_for { mapped? }
end end
tests("#unmap_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do tests("#unmap_cloud_ip('#{@cloud_ip_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id) result = Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
end end
tests("#destroy_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do tests("#destroy_cloud_ip('#{@cloud_ip_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id) result = Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
end end
unless Fog.mocking? unless Fog.mocking?

View file

@ -7,35 +7,38 @@ Shindo.tests('Fog::Compute[:brightbox] | image requests', ['brightbox']) do
# "arch" => "i686", # "arch" => "i686",
# "source" => "fnord" # "source" => "fnord"
# } # }
# tests("#create_image(#{creation_options.inspect})").formats(Brightbox::Compute::Formats::Full::IMAGE) do # tests("#create_image(#{creation_options.inspect})")
# data = Fog::Compute[:brightbox].create_image(creation_options) # result = Fog::Compute[:brightbox].create_image(creation_options)
# @image_id = data["id"] # @image_id = result["id"]
# data # formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
# end # end
# Fog::Compute[:brightbox].images.get(@image_id).wait_for { ready? } # Fog::Compute[:brightbox].images.get(@image_id).wait_for { ready? }
tests("#list_images").formats(Brightbox::Compute::Formats::Collection::IMAGES) do tests("#list_images") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].list_images result = Fog::Compute[:brightbox].list_images
@image_id = data.first["id"] @image_id = result.first["id"]
data formats(Brightbox::Compute::Formats::Collection::IMAGES) { result }
end end
tests("#get_image('#{@image_id}')").formats(Brightbox::Compute::Formats::Full::IMAGE) do tests("#get_image('#{@image_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_image(@image_id) result = Fog::Compute[:brightbox].get_image(@image_id)
formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
end end
## Until Image creation can be automated, we shouldn't be updating Images randomly ## Until Image creation can be automated, we shouldn't be updating Images randomly
# update_options = {} # update_options = {}
# tests("#update_image('#{@image_id}', #{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::IMAGE) do # tests("#update_image('#{@image_id}', #{update_options.inspect})") do
# Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test") # result = Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test")
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
# end # end
## Same as other tests - can't be deleting them unless part of the test run ## Same as other tests - can't be deleting them unless part of the test run
# tests("#destroy_server('#{@image_id}')").formats(Brightbox::Compute::Formats::Full::IMAGE) do # tests("#destroy_server('#{@image_id}')") do
# Fog::Compute[:brightbox].destroy_image(@image_id) # result = Fog::Compute[:brightbox].destroy_image(@image_id)
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
# end # end
end end

View file

@ -7,9 +7,10 @@ Shindo.tests('Fog::Compute[:brightbox] | interface requests', ['brightbox']) do
@interface_id = server.interfaces.first["id"] @interface_id = server.interfaces.first["id"]
end end
tests("#get_interface('#{@interface_id}')").formats(Brightbox::Compute::Formats::Full::INTERFACE) do tests("#get_interface('#{@interface_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_interface(@interface_id) result = Fog::Compute[:brightbox].get_interface(@interface_id)
formats(Brightbox::Compute::Formats::Full::INTERFACE) { result }
end end
end end

View file

@ -22,30 +22,33 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
} }
} }
tests("#create_load_balancer(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) do tests("#create_load_balancer(#{create_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].create_load_balancer(create_options) result = Fog::Compute[:brightbox].create_load_balancer(create_options)
@load_balancer_id = data["id"] @load_balancer_id = result["id"]
data formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
end end
unless Fog.mocking? unless Fog.mocking?
Fog::Compute[:brightbox].load_balancers.get(@load_balancer_id).wait_for { ready? } Fog::Compute[:brightbox].load_balancers.get(@load_balancer_id).wait_for { ready? }
end end
tests("#list_load_balancers()").formats(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS) do tests("#list_load_balancers()") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].list_load_balancers result = Fog::Compute[:brightbox].list_load_balancers
formats(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS) { result }
end end
tests("#get_load_balancer('#{@load_balancer_id}')").formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) do tests("#get_load_balancer('#{@load_balancer_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id) result = Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
end end
tests("#destroy_load_balancer('#{@load_balancer_id}')").formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) do tests("#destroy_load_balancer('#{@load_balancer_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id) result = Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
end end
unless Fog.mocking? unless Fog.mocking?

View file

@ -14,51 +14,58 @@ Shindo.tests('Fog::Compute[:brightbox] | server group requests', ['brightbox'])
}] }]
} }
tests("#create_server_group(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#create_server_group(#{create_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].create_server_group(create_options) result = Fog::Compute[:brightbox].create_server_group(create_options)
@server_group_id = data["id"] @server_group_id = result["id"]
data formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
tests("#list_server_groups").formats(Brightbox::Compute::Formats::Collection::SERVER_GROUPS) do tests("#list_server_groups") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].list_server_groups result = Fog::Compute[:brightbox].list_server_groups
formats(Brightbox::Compute::Formats::Collection::SERVER_GROUPS) { result }
end end
tests("#get_server_group('#{@server_group_id}')").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#get_server_group('#{@server_group_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_server_group(@server_group_id) result = Fog::Compute[:brightbox].get_server_group(@server_group_id)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
update_options = {:name => "Fog@#{Time.now.iso8601}"} update_options = {:name => "Fog@#{Time.now.iso8601}"}
tests("#update_server_group(#{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#update_server_group('#{@server_group_id}', #{update_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options) result = Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
remove_options = {:servers => [{:server => server_id}]} remove_options = {:servers => [{:server => server_id}]}
tests("#remove_servers_server_group(#{remove_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#remove_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options) result = Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
add_options = {:servers => [{:server => server_id}]} add_options = {:servers => [{:server => server_id}]}
tests("#add_servers_server_group(#{remove_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#add_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options) result = Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
# Server Group must be empty to delete so we need to remove it again # Server Group must be empty to delete so we need to remove it again
remove_options = {:servers => [{:server => server_id}]} remove_options = {:servers => [{:server => server_id}]}
tests("#remove_servers_server_group(#{remove_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#remove_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options) result = Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
tests("#destroy_server_group('#{@server_group_id}')").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do tests("#destroy_server_group('#{@server_group_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].destroy_server_group(@server_group_id) result = Fog::Compute[:brightbox].destroy_server_group(@server_group_id)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
end end
unless Fog.mocking? unless Fog.mocking?

View file

@ -5,55 +5,63 @@ Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
image_id = Brightbox::Compute::TestSupport.image_id image_id = Brightbox::Compute::TestSupport.image_id
server_id = nil server_id = nil
tests("#create_server(:image => '#{image_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#create_server(:image => '#{image_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].create_server(:image => image_id) result = Fog::Compute[:brightbox].create_server(:image => image_id)
server_id = data["id"] server_id = result["id"]
data formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
unless Fog.mocking? unless Fog.mocking?
Fog::Compute[:brightbox].servers.get(server_id).wait_for { ready? } Fog::Compute[:brightbox].servers.get(server_id).wait_for { ready? }
end end
tests("#list_servers").formats(Brightbox::Compute::Formats::Collection::SERVERS) do tests("#list_servers") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].list_servers result = Fog::Compute[:brightbox].list_servers
formats(Brightbox::Compute::Formats::Collection::SERVERS) { result }
end end
tests("#get_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#get_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_server(server_id) result = Fog::Compute[:brightbox].get_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
tests("#update_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#update_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].update_server(server_id, :name => "Fog@#{Time.now.iso8601}") result = Fog::Compute[:brightbox].update_server(server_id, :name => "Fog@#{Time.now.iso8601}")
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
tests("#activate_console_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#activate_console_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].activate_console_server(server_id) result = Fog::Compute[:brightbox].activate_console_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
tests("#stop_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#stop_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].stop_server(server_id) result = Fog::Compute[:brightbox].stop_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
tests("#start_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#start_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].start_server(server_id) result = Fog::Compute[:brightbox].start_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
tests("#shutdown_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#shutdown_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].shutdown_server(server_id) result = Fog::Compute[:brightbox].shutdown_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
tests("#destroy_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do tests("#destroy_server('#{server_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].destroy_server(server_id) result = Fog::Compute[:brightbox].destroy_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER) { result }
end end
end end

View file

@ -2,16 +2,17 @@ Shindo.tests('Fog::Compute[:brightbox] | server type requests', ['brightbox']) d
tests('success') do tests('success') do
tests("#list_server_types").formats(Brightbox::Compute::Formats::Collection::SERVER_TYPES) do tests("#list_server_types") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].list_server_types result = Fog::Compute[:brightbox].list_server_types
@server_type_id = data.first["id"] @server_type_id = result.first["id"]
data formats(Brightbox::Compute::Formats::Collection::SERVER_TYPES) { result }
end end
tests("#get_server_type('#{@server_type_id}')").formats(Brightbox::Compute::Formats::Full::SERVER_TYPE) do tests("#get_server_type('#{@server_type_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_server_type(@server_type_id) result = Fog::Compute[:brightbox].get_server_type(@server_type_id)
formats(Brightbox::Compute::Formats::Full::SERVER_TYPE) { result }
end end
end end

View file

@ -2,29 +2,24 @@ Shindo.tests('Fog::Compute[:brightbox] | user requests', ['brightbox']) do
tests('success') do tests('success') do
tests("#list_users").formats(Brightbox::Compute::Formats::Collection::USERS) do tests("#list_users") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].list_users result = Fog::Compute[:brightbox].list_users
@user_id = data.first["id"] @user_id = result.first["id"]
data formats(Brightbox::Compute::Formats::Collection::USERS) { result }
end end
tests("#get_user('#{@user_id}')").formats(Brightbox::Compute::Formats::Full::USER) do tests("#get_user('#{@user_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].get_user(@user_id) result = Fog::Compute[:brightbox].get_user(@user_id)
@original_name = data["name"] formats(Brightbox::Compute::Formats::Full::USER) { result }
data
end end
update_options = { :name => "Fog@#{Time.now.iso8601}" } update_options = { :name => "Example User" }
tests("#update_user('#{@user_id}', #{update_options.inspect})") do
tests("#update_user('#{@user_id}', #{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::USER) do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].update_user(@user_id, update_options) result = Fog::Compute[:brightbox].update_user(@user_id, update_options)
end formats(Brightbox::Compute::Formats::Full::USER) { result }
unless Fog.mocking?
Fog::Compute[:brightbox].update_user(@user_id, :name => @original_name)
end end
end end

View file

@ -2,16 +2,17 @@ Shindo.tests('Fog::Compute[:brightbox] | zone requests', ['brightbox']) do
tests('success') do tests('success') do
tests("#list_zones").formats(Brightbox::Compute::Formats::Collection::ZONES) do tests("#list_zones") do
pending if Fog.mocking? pending if Fog.mocking?
data = Fog::Compute[:brightbox].list_zones result = Fog::Compute[:brightbox].list_zones
@zone_id = data.first["id"] @zone_id = result.first["id"]
data formats(Brightbox::Compute::Formats::Collection::ZONES) { result }
end end
tests("#get_zone('#{@zone_id}')").formats(Brightbox::Compute::Formats::Full::ZONE) do tests("#get_zone('#{@zone_id}')") do
pending if Fog.mocking? pending if Fog.mocking?
Fog::Compute[:brightbox].get_zone(@zone_id) result = Fog::Compute[:brightbox].get_zone(@zone_id)
formats(Brightbox::Compute::Formats::Full::ZONE) { result }
end end
end end