1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/openstack/models/identity/user_tests.rb

47 lines
1.1 KiB
Ruby
Raw Normal View History

Shindo.tests("Fog::Identity[:openstack] | user", ['openstack']) do
tenant_id = Fog::Identity[:openstack].list_tenants.body['tenants'].first['id']
@instance = Fog::Identity[:openstack].users.new({
:name => 'User Name',
:email => 'test@fog.com',
:tenant_id => tenant_id,
:password => 'spoof',
:enabled => true
})
2012-02-22 22:40:32 +08:00
tests('success') do
tests('#save').returns(true) do
@instance.save
end
2012-02-22 22:40:32 +08:00
tests('#roles').succeeds do
@instance.roles
end
tests('#update').returns(true) do
@instance.update({:name => 'updatename', :email => 'new@email.com'})
end
tests('#update_password').returns(true) do
@instance.update_password('swordfish')
end
tests('#update_tenant').returns(true) do
@instance.update_tenant('swordfish')
end
tests('#update_enabled').returns(true) do
@instance.update_enabled('swordfish')
end
tests('#destroy').returns(true) do
@instance.destroy
end
end
tests('failure') do
tests('#save').raises(Fog::Errors::Error) do
@instance.save
end
2012-02-22 22:40:32 +08:00
end
end