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

* Request tests for accounts, api_clients, cloud_ips, images, interfaces, server types, user and zones * Added 'ready?' methods to CloudIp and Image models * Reworked brightbox helper to include Format patterns for all of the * Added "hack" to allow select objects to be one class OR NilClass for fields that may be a JSON string or null if unset * Some tests are not enabled (commented out) because they need manual steps (such as uploading Image to your account before registration)
41 lines
1.4 KiB
Ruby
41 lines
1.4 KiB
Ruby
Shindo.tests('Brightbox::Compute | api client requests', ['brightbox']) do
|
|
|
|
tests('success') do
|
|
|
|
create_options = {:name => "Name from Fog test (#{Time.now.to_i})", :description => "Description from Fog test"}
|
|
tests("#create_api_client(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
|
|
data = Brightbox[:compute].create_api_client(create_options)
|
|
@api_client_id = data["id"]
|
|
data
|
|
end
|
|
|
|
tests("#list_api_clients()").formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) do
|
|
Brightbox[:compute].list_api_clients()
|
|
end
|
|
|
|
tests("#get_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
|
|
Brightbox[:compute].get_api_client(@api_client_id)
|
|
end
|
|
|
|
tests("#update_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
|
|
Brightbox[:compute].update_api_client(@api_client_id, :name => "New name from Fog test")
|
|
end
|
|
|
|
tests("#destroy_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
|
|
Brightbox[:compute].destroy_api_client(@api_client_id)
|
|
end
|
|
|
|
end
|
|
|
|
tests('failure') do
|
|
|
|
tests("#get_api_client('cli-00000')").raises(Excon::Errors::NotFound) do
|
|
Brightbox[:compute].get_api_client('cli-00000')
|
|
end
|
|
|
|
tests("#get_api_client()").raises(ArgumentError) do
|
|
Brightbox[:compute].get_api_client()
|
|
end
|
|
end
|
|
|
|
end
|