2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:brightbox] | api client requests', ['brightbox']) do
|
2010-12-06 09:50:59 -05:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2011-08-23 07:05:05 -04:00
|
|
|
create_options = {
|
|
|
|
:name => "Fog@#{Time.now.iso8601}",
|
|
|
|
:description => "Description from Fog test"
|
|
|
|
}
|
2010-12-17 19:49:22 -05:00
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#create_api_client(#{create_options.inspect})") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].create_api_client(create_options)
|
|
|
|
@api_client_id = result["id"]
|
|
|
|
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#list_api_clients") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].list_api_clients
|
|
|
|
formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#get_api_client('#{@api_client_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].get_api_client(@api_client_id)
|
|
|
|
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-08-23 07:05:05 -04:00
|
|
|
update_options = {:name => "Fog@#{Time.now.iso8601}"}
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#update_api_client('#{@api_client_id}', #{update_options.inspect})") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
|
|
|
|
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:17:00 -04:00
|
|
|
tests("#reset_secret_api_client('#{@api_client_id}')") do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
result = Fog::Compute[:brightbox].reset_secret_api_client(@api_client_id)
|
|
|
|
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
|
|
|
test("new secret is visible") { ! result["secret"].nil? }
|
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#destroy_api_client('#{@api_client_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].destroy_api_client(@api_client_id)
|
|
|
|
formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
|
|
|
tests("#get_api_client('cli-00000')").raises(Excon::Errors::NotFound) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_api_client('cli-00000')
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#get_api_client").raises(ArgumentError) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_api_client
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|