2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:brightbox] | user requests', ['brightbox']) do
|
2010-12-06 09:50:59 -05:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#list_users").formats(Brightbox::Compute::Formats::Collection::USERS) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
data = Fog::Compute[:brightbox].list_users
|
2010-12-06 09:50:59 -05:00
|
|
|
@user_id = data.first["id"]
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_user('#{@user_id}')").formats(Brightbox::Compute::Formats::Full::USER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
data = Fog::Compute[:brightbox].get_user(@user_id)
|
2010-12-06 09:50:59 -05:00
|
|
|
@original_name = data["name"]
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2011-08-23 07:05:05 -04:00
|
|
|
update_options = { :name => "Fog@#{Time.now.iso8601}" }
|
2010-12-17 19:49:22 -05:00
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
tests("#update_user('#{@user_id}', #{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::USER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].update_user(@user_id, update_options)
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
2010-12-17 19:49:22 -05:00
|
|
|
|
|
|
|
unless Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].update_user(@user_id, :name => @original_name)
|
2010-12-17 19:49:22 -05:00
|
|
|
end
|
2010-12-06 09:50:59 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#update_user").raises(ArgumentError) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].update_user
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|