1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/brightbox/requests/compute/user_tests.rb
Paul Thornthwaite 6500fa46bf [brightbox] Tests for remaining API requests
* 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)
2010-12-09 13:28:51 +00:00

33 lines
938 B
Ruby

Shindo.tests('Brightbox::Compute | user requests', ['brightbox']) do
tests('success') do
tests("#list_users()").formats(Brightbox::Compute::Formats::Collection::USERS) do
data = Brightbox[:compute].list_users()
@user_id = data.first["id"]
data
end
tests("#get_user('#{@user_id}')").formats(Brightbox::Compute::Formats::Full::USER) do
data = Brightbox[:compute].get_user(@user_id)
@original_name = data["name"]
data
end
update_options = { :name => "New name from Fog" }
tests("#update_user('#{@user_id}', #{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::USER) do
Brightbox[:compute].update_user(@user_id, update_options)
end
Brightbox[:compute].update_user(@user_id, :name => @original_name)
end
tests('failure') do
tests("#update_user()").raises(ArgumentError) do
Brightbox[:compute].update_user()
end
end
end